Sha256: de82027ca5dc6f9244391b9a8daea303823917abdcd2d5c8be8422a54f559a92

Contents?: true

Size: 797 Bytes

Versions: 17

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  module Response
    # Render spellcheck results for a search query
    class ViewTypeComponent < Blacklight::Component
      renders_many :views, 'Blacklight::Response::ViewTypeButtonComponent'

      # @param [Blacklight::Response] response
      def initialize(response:, search_state:, views: {}, selected: nil)
        @response = response
        @views = views
        @search_state = search_state
        @selected = selected
      end

      def before_render
        return if views.any?

        @views.each do |key, config|
          with_view(key: key, view: config, selected: @selected == key, search_state: @search_state)
        end
      end

      def render?
        views.many? && !@response.empty?
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/components/blacklight/response/view_type_component.rb
blacklight-8.6.0 app/components/blacklight/response/view_type_component.rb
blacklight-8.5.1 app/components/blacklight/response/view_type_component.rb
blacklight-8.5.0 app/components/blacklight/response/view_type_component.rb
blacklight-8.4.0 app/components/blacklight/response/view_type_component.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/components/blacklight/response/view_type_component.rb
blacklight-8.3.0 app/components/blacklight/response/view_type_component.rb
blacklight-8.2.2 app/components/blacklight/response/view_type_component.rb
blacklight-8.2.1 app/components/blacklight/response/view_type_component.rb
blacklight-8.2.0 app/components/blacklight/response/view_type_component.rb
blacklight-8.1.0 app/components/blacklight/response/view_type_component.rb
blacklight-8.0.1 app/components/blacklight/response/view_type_component.rb
blacklight-8.0.0 app/components/blacklight/response/view_type_component.rb
blacklight-8.0.0.beta8 app/components/blacklight/response/view_type_component.rb
blacklight-8.0.0.beta7 app/components/blacklight/response/view_type_component.rb
blacklight-8.0.0.beta6 app/components/blacklight/response/view_type_component.rb
blacklight-8.0.0.beta5 app/components/blacklight/response/view_type_component.rb