Class: Blacklight::Response::SortComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/response/sort_component.rb

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(search_state:, param: 'sort', choices: {}, id: 'sort-dropdown', classes: [], selected: nil) ⇒ SortComponent

Returns a new instance of SortComponent.



6
7
8
9
10
11
12
13
# File 'app/components/blacklight/response/sort_component.rb', line 6

def initialize(search_state:, param: 'sort', choices: {}, id: 'sort-dropdown', classes: [], selected: nil)
  @param = param
  @choices = choices
  @search_state = search_state
  @id = id
  @classes = classes
  @selected = selected
end

Instance Method Details



20
21
22
23
24
25
26
27
28
# File 'app/components/blacklight/response/sort_component.rb', line 20

def dropdown
  render(dropdown_class.new(
           param: @param,
           choices: @choices,
           id: @id,
           search_state: @search_state,
           selected: @selected
         ))
end

You may override this method in a subclass if you want to use a different dropdown component



16
17
18
# File 'app/components/blacklight/response/sort_component.rb', line 16

def dropdown_class
  helpers.blacklight_config.view_config(:show).dropdown_component
end