Class: Blacklight::Response::FacetGroupComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/response/facet_group_component.rb

Overview

Render a group of facet fields

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(response:, fields: [], title: nil, id: nil) ⇒ FacetGroupComponent

Returns a new instance of FacetGroupComponent.

Parameters:

  • response (Blacklight::Response)
  • fields (Array<String>) (defaults to: [])

    facet fields to render

  • title (String) (defaults to: nil)

    the title of the facet group section

  • id (String) (defaults to: nil)

    a unique identifier for the group



11
12
13
14
15
16
17
# File 'app/components/blacklight/response/facet_group_component.rb', line 11

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

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
# File 'app/components/blacklight/response/facet_group_component.rb', line 19

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