Sha256: 19bde5868446260d2f991e2052366ffa49ea18f47b61b9a304821cfc6dfbe418

Contents?: true

Size: 850 Bytes

Versions: 25

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  module Response
    # Render a group of facet fields
    class FacetGroupComponent < Blacklight::Component
      # @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
          helpers.has_facet_values?(@fields, @response)
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.39.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.38.0 app/components/blacklight/response/facet_group_component.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/components/blacklight/response/facet_group_component.rb
blacklight-7.37.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.36.2 app/components/blacklight/response/facet_group_component.rb
blacklight-7.36.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.36.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.35.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.34.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.33.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.33.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.32.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.31.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.30.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.29.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.28.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.27.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.27.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.26.1 app/components/blacklight/response/facet_group_component.rb