Class: Blacklight::AdvancedSearchFormComponent
- Inherits:
-
SearchBarComponent
- Object
- ViewComponent::Base
- Component
- SearchBarComponent
- Blacklight::AdvancedSearchFormComponent
- Includes:
- ContentAreasShim
- Defined in:
- app/components/blacklight/advanced_search_form_component.rb
Instance Method Summary collapse
- #before_render ⇒ Object
- #default_operator_menu ⇒ Object
-
#initialize(response:, **options) ⇒ AdvancedSearchFormComponent
constructor
A new instance of AdvancedSearchFormComponent.
- #sort_fields_select ⇒ Object
Methods included from ContentAreasShim
Methods inherited from SearchBarComponent
#advanced_search_enabled?, #autocomplete_path, #autofocus
Methods inherited from Component
reset_compiler!, sidecar_files, upstream_sidecar_files
Constructor Details
#initialize(response:, **options) ⇒ AdvancedSearchFormComponent
Returns a new instance of AdvancedSearchFormComponent.
16 17 18 19 |
# File 'app/components/blacklight/advanced_search_form_component.rb', line 16 def initialize(response:, **) super(**) @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 |
#default_operator_menu ⇒ Object
27 28 29 30 |
# File 'app/components/blacklight/advanced_search_form_component.rb', line 27 def = [:must, :should].index_by { |op| t(op, scope: 'blacklight.advanced_search.op') } label_tag(:op, t('blacklight.advanced_search.op.label'), class: 'sr-only visually-hidden') + select_tag(:op, (, 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 = sort_fields.values.map { |field_config| [helpers.sort_field_label(field_config.key), field_config.key] } return unless .any? select_tag(:sort, (, params[:sort]), class: "form-select custom-select sort-select w-auto", aria: { labelledby: 'advanced-search-sort-label' }) end |