Sha256: 7ed219ac802f273591d340760a1984d00ee13fabdd7f3e63ebd83c00ce9ab66f

Contents?: true

Size: 897 Bytes

Versions: 31

Compression:

Stored size: 897 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  class SearchNavbarComponent < Blacklight::Component
    def initialize(blacklight_config:)
      @blacklight_config = blacklight_config
    end

    attr_reader :blacklight_config

    delegate :container_classes, to: :helpers

    def search_bar
      render search_bar_component
    end

    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

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

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

Version data entries

31 entries across 30 versions & 2 rubygems

Version Path
blacklight-7.34.0 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.1 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta8 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta7 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta6 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta5 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta4 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta3 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta2 app/components/blacklight/search_navbar_component.rb
blacklight-8.0.0.beta1 app/components/blacklight/search_navbar_component.rb