Class: Blacklight::AdvancedSearchFormComponent
Instance Method Summary
collapse
#with
#advanced_search_enabled?, #autocomplete_path, #autofocus
Methods inherited from Component
compiler
Constructor Details
Returns a new instance of AdvancedSearchFormComponent.
16
17
18
19
|
# File 'app/components/blacklight/advanced_search_form_component.rb', line 16
def initialize(response:, **options)
super(**options)
@response = response
end
|
Instance Method Details
#before_render ⇒ Object
21
22
23
24
25
|
# File 'app/components/blacklight/advanced_search_form_component.rb', line 21
def before_render
initialize_search_field_controls if search_field_controls.blank?
initialize_search_filter_controls if search_filter_controls.blank?
initialize_constraints if constraints.blank?
end
|
27
28
29
30
|
# File 'app/components/blacklight/advanced_search_form_component.rb', line 27
def
options_with_labels = [:must, :should].index_by { |op| t(op, scope: 'blacklight.advanced_search.op') }
select_tag(:op, options_for_select(options_with_labels, params[:op]), class: 'input-small')
end
|
#sort_fields_select ⇒ Object
32
33
34
35
36
37
|
# File 'app/components/blacklight/advanced_search_form_component.rb', line 32
def sort_fields_select
options = sort_fields.values.map { |field_config| [helpers.sort_field_label(field_config.key), field_config.key] }
return unless options.any?
select_tag(:sort, options_for_select(options, params[:sort]), class: "form-control sort-select w-auto")
end
|