Class: Blacklight::SearchNavbarComponent

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

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(blacklight_config:) ⇒ SearchNavbarComponent

Returns a new instance of SearchNavbarComponent.



5
6
7
# File 'app/components/blacklight/search_navbar_component.rb', line 5

def initialize(blacklight_config:)
  @blacklight_config = blacklight_config
end

Instance Attribute Details

#blacklight_configObject (readonly)

Returns the value of attribute blacklight_config.



9
10
11
# File 'app/components/blacklight/search_navbar_component.rb', line 9

def blacklight_config
  @blacklight_config
end

Instance Method Details

#search_barObject



13
14
15
# File 'app/components/blacklight/search_navbar_component.rb', line 13

def search_bar
  render search_bar_component
end

#search_bar_componentObject



17
18
19
20
21
22
23
24
# File 'app/components/blacklight/search_navbar_component.rb', line 17

def search_bar_component
  search_bar_component_class.new(
    url: helpers.search_action_url,
    advanced_search_url: helpers.search_action_url(action: 'advanced_search'),
    params: helpers.search_state.params_for_search.except(:qt),
    autocomplete_path: suggest_index_catalog_path
  )
end

#search_bar_component_classObject



26
27
28
# File 'app/components/blacklight/search_navbar_component.rb', line 26

def search_bar_component_class
  view_config&.search_bar_component || Blacklight::SearchBarComponent
end

#view_configObject



30
31
32
# File 'app/components/blacklight/search_navbar_component.rb', line 30

def view_config
  blacklight_config&.view_config(helpers.document_index_view_type)
end