Class: SearchHelper::SearchColumn
- Inherits:
-
Object
- Object
- SearchHelper::SearchColumn
- Defined in:
- frontend/app/helpers/search_helper.rb
Instance Method Summary collapse
-
#class ⇒ Object
let’s rename this method?.
-
#field ⇒ Object
-
#initialize(label, value_block, opts, search_data) ⇒ SearchColumn
constructor
A new instance of SearchColumn.
-
#label ⇒ Object
-
#sort_by ⇒ Object
-
#sortable? ⇒ Boolean
-
#value_for(record) ⇒ Object
Constructor Details
#initialize(label, value_block, opts, search_data) ⇒ SearchColumn
Returns a new instance of SearchColumn.
382 383 384 385 386 387 388 389 390 391 |
# File 'frontend/app/helpers/search_helper.rb', line 382 def initialize(label, value_block, opts, search_data) @field = opts[:field] @label = label @value_block = value_block @classes = "col " @classes << opts[:class] if opts[:class] @sortable = opts[:sortable] || false @sort_by = opts[:sort_by] || "" @search_data = search_data end |
Instance Method Details
#class ⇒ Object
let’s rename this method?
419 420 421 422 423 |
# File 'frontend/app/helpers/search_helper.rb', line 419 def class @classes << " sortable" if sortable? @classes << " sort-#{@search_data.current_sort_direction}" if sortable? && @search_data.sorted_by === @sort_by @classes end |
#field ⇒ Object
394 395 396 |
# File 'frontend/app/helpers/search_helper.rb', line 394 def field @field end |
#label ⇒ Object
404 405 406 |
# File 'frontend/app/helpers/search_helper.rb', line 404 def label @label end |
#sort_by ⇒ Object
414 415 416 |
# File 'frontend/app/helpers/search_helper.rb', line 414 def sort_by @sort_by end |
#sortable? ⇒ Boolean
409 410 411 |
# File 'frontend/app/helpers/search_helper.rb', line 409 def sortable? @sortable end |
#value_for(record) ⇒ Object
399 400 401 |
# File 'frontend/app/helpers/search_helper.rb', line 399 def value_for(record) @value_block.call(record) end |