Class: Blacklight::Response::FacetGroupComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::Response::FacetGroupComponent
- Defined in:
- app/components/blacklight/response/facet_group_component.rb
Overview
Render a group of facet fields
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
-
#before_render ⇒ Object
Provide fallback behavior for rendering this object without a body slot.
-
#initialize(id:, title: nil, fields: [], response: nil) ⇒ FacetGroupComponent
constructor
A new instance of FacetGroupComponent.
- #render? ⇒ Boolean
Methods inherited from Component
Constructor Details
#initialize(id:, title: nil, fields: [], response: nil) ⇒ FacetGroupComponent
Returns a new instance of FacetGroupComponent.
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_render ⇒ Object
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
29 30 31 |
# File 'app/components/blacklight/response/facet_group_component.rb', line 29 def render? body.present? end |