Class: BlacklightRangeLimit::RangeSegmentsComponent

Inherits:
Blacklight::Component
  • Object
show all
Defined in:
app/components/blacklight_range_limit/range_segments_component.rb

Instance Method Summary collapse

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_configObject



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_presentersObject



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