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(id:, title: nil, fields: [], response: nil) ⇒ FacetGroupComponent

Returns a new instance of FacetGroupComponent.

Parameters:



13
14
15
16
17
18
19
20
21
22
# File 'app/components/blacklight/response/facet_group_component.rb', line 13

def initialize(id:, title: nil, fields: [], response: nil)
  @groupname = id
  @id = id ? "facets-#{id}" : 'facets'
  @title = title || I18n.t("blacklight.search.#{@id}.title")
  @panel_id = id ? "facet-panel-#{id}-collapse" : 'facet-panel-collapse'

  # deprecated variables
  @fields = fields
  @response = response
end

Instance Method Details

#before_renderObject

Provide fallback behavior for rendering this object without a body slot



25
26
27
# File 'app/components/blacklight/response/facet_group_component.rb', line 25

def before_render
  set_slot(:body, nil) { default_body } unless body?
end

#render?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/components/blacklight/response/facet_group_component.rb', line 29

def render?
  body.present?
end