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.26.0 app/components/blacklight/response/facet_group_component.rb
blacklight-7.25.3 app/components/blacklight/response/facet_group_component.rb
blacklight-7.25.2 app/components/blacklight/response/facet_group_component.rb
blacklight-7.25.1 app/components/blacklight/response/facet_group_component.rb
blacklight-7.25.0 app/components/blacklight/response/facet_group_component.rb