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.
389 390 391 392 393 394 395 396 397 398 |
# File 'frontend/app/helpers/search_helper.rb', line 389 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?
426 427 428 429 430 |
# File 'frontend/app/helpers/search_helper.rb', line 426 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
401 402 403 |
# File 'frontend/app/helpers/search_helper.rb', line 401 def field @field end |
#label ⇒ Object
411 412 413 |
# File 'frontend/app/helpers/search_helper.rb', line 411 def label @label end |
#sort_by ⇒ Object
421 422 423 |
# File 'frontend/app/helpers/search_helper.rb', line 421 def sort_by @sort_by end |
#sortable? ⇒ Boolean
416 417 418 |
# File 'frontend/app/helpers/search_helper.rb', line 416 def sortable? @sortable end |
#value_for(record) ⇒ Object
406 407 408 |
# File 'frontend/app/helpers/search_helper.rb', line 406 def value_for(record) @value_block.call(record) end |