Sha256: 5594f7f7f579aeb1e3c591819d6b02bb954fbf20ae7b1ebd95a48968ef982d7d

Contents?: true

Size: 856 Bytes

Versions: 27

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  module Response
    # Render a group of facet fields
    class FacetGroupComponent < ::ViewComponent::Base
      # @param [Blacklight::Response] response
      # @param [Array<String>] fields facet fields to render
      # @param [String] title the title of the facet group section
      # @param [String] id a unique identifier for the group
      def initialize(response:, fields: [], title: nil, id: nil)
        @response = response
        @fields = fields
        @title = title
        @id = id ? "facets-#{id}" : 'facets'
        @panel_id = id ? "facet-panel-#{id}-collapse" : 'facet-panel-collapse'
      end

      def render?
        Deprecation.silence(Blacklight::FacetsHelperBehavior) do
          @view_context.has_facet_values?(@fields, @response)
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
blacklight-7.22.2 app/components/blacklight/response/facet_group_component.rb
blacklight-7.22.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.22.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.21.2 app/components/blacklight/response/facet_group_component.rb
blacklight-7.21.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.21.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.20.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.20.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.19.2 app/components/blacklight/response/facet_group_component.rb
blacklight-7.19.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.19.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.18.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.18.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.17.2 app/components/blacklight/response/facet_group_component.rb
blacklight-7.17.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.17.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.16.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.15.2 app/components/blacklight/response/facet_group_component.rb
blacklight-7.15.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.15.0 app/components/blacklight/response/facet_group_component.rb