Class: BlacklightRangeLimit::RangeSegmentsComponent
- Inherits:
-
Blacklight::Component
- Object
- Blacklight::Component
- BlacklightRangeLimit::RangeSegmentsComponent
- Defined in:
- app/components/blacklight_range_limit/range_segments_component.rb
Instance Method Summary collapse
- #facet_config ⇒ Object
- #facet_item_presenter(facet_item) ⇒ Object
- #facet_item_presenters ⇒ Object
-
#initialize(facet_field:, facet_items: nil, item_component: nil, classes: []) ⇒ RangeSegmentsComponent
constructor
A new instance of RangeSegmentsComponent.
Constructor Details
#initialize(facet_field:, facet_items: nil, item_component: nil, classes: []) ⇒ RangeSegmentsComponent
Returns a new instance of RangeSegmentsComponent.
5 6 7 8 9 10 11 12 |
# File 'app/components/blacklight_range_limit/range_segments_component.rb', line 5 def initialize(facet_field:, facet_items: nil, item_component: nil, classes: []) super @facet_field = facet_field @facet_items = facet_items || facet_field.try(:range_queries) || [] @item_component = facet_field.facet_field.item_component || Blacklight::FacetItemComponent @classes = classes end |
Instance Method Details
#facet_config ⇒ Object
22 23 24 |
# File 'app/components/blacklight_range_limit/range_segments_component.rb', line 22 def facet_config @facet_field.facet_field end |
#facet_item_presenter(facet_item) ⇒ Object
18 19 20 |
# File 'app/components/blacklight_range_limit/range_segments_component.rb', line 18 def facet_item_presenter(facet_item) facet_config.item_presenter.new(facet_item, facet_config, helpers, @facet_field.key) end |
#facet_item_presenters ⇒ Object
14 15 16 |
# File 'app/components/blacklight_range_limit/range_segments_component.rb', line 14 def facet_item_presenters @facet_items.map { |item| facet_item_presenter(item) } end |