Sha256: ad5490ec34045d3dd22e78f179b5ebb00684d1634a0a5be4eaf1d3cd8a2f6923

Contents?: true

Size: 879 Bytes

Versions: 8

Compression:

Stored size: 879 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|
          with_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

8 entries across 8 versions & 2 rubygems

Version Path
blacklight-7.38.0 app/components/blacklight/response/view_type_component.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/components/blacklight/response/view_type_component.rb
blacklight-7.37.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.36.2 app/components/blacklight/response/view_type_component.rb
blacklight-7.36.1 app/components/blacklight/response/view_type_component.rb
blacklight-7.36.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.35.0 app/components/blacklight/response/view_type_component.rb
blacklight-7.34.0 app/components/blacklight/response/view_type_component.rb