Sha256: f49567404f41be65c0ecf84fa8961c609d07f3073cb12d10515ab8f0a4efb6f5

Contents?: true

Size: 874 Bytes

Versions: 18

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

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

      # @param [Blacklight::Response] response
      def initialize(response:, views: {}, search_state:, 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|
          view(key: key, view: config, selected: @selected == key, search_state: @search_state)
        end
      end

      def render?
        Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
          helpers.has_alternative_views?
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-7.33.1 app/components/blacklight/response/view_type_component.rb
blacklight-7.33.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.32.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.31.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.30.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.29.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.28.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.27.1 app/components/blacklight/response/view_type_component.rb
blacklight-7.27.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.26.1 app/components/blacklight/response/view_type_component.rb
blacklight-7.26.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.25.3 app/components/blacklight/response/view_type_component.rb
blacklight-7.25.2 app/components/blacklight/response/view_type_component.rb
blacklight-7.25.1 app/components/blacklight/response/view_type_component.rb
blacklight-7.25.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.24.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.23.0.1 app/components/blacklight/response/view_type_component.rb
blacklight-7.23.0 app/components/blacklight/response/view_type_component.rb