Class: Hyrax::DropdownFacetFieldComponent
- Inherits:
-
Blacklight::FacetFieldListComponent
- Object
- Blacklight::FacetFieldListComponent
- Hyrax::DropdownFacetFieldComponent
- Defined in:
- app/components/hyrax/dropdown_facet_field_component.rb
Instance Method Summary collapse
- #facet_config(key = nil) ⇒ Object
- #facet_item_presenter(facet_item) ⇒ Object
- #facet_item_presenters ⇒ Object
Instance Method Details
#facet_config(key = nil) ⇒ Object
24 25 26 27 28 |
# File 'app/components/hyrax/dropdown_facet_field_component.rb', line 24 def facet_config(key = nil) return @facet_field.facet_field if key.nil? helpers.blacklight_config.facet_fields[key] end |
#facet_item_presenter(facet_item) ⇒ Object
18 19 20 21 22 |
# File 'app/components/hyrax/dropdown_facet_field_component.rb', line 18 def facet_item_presenter(facet_item) config = facet_config(facet_item.field) (config.item_presenter || Blacklight::FacetItemPresenter).new(facet_item, config, helpers, facet_item.field) end |
#facet_item_presenters ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/hyrax/dropdown_facet_field_component.rb', line 4 def facet_item_presenters return to_enum(:facet_item_presenters) unless block_given? @facet_field.paginator.items.each do |item| skipped = facet_config.skip_item&.call(item) yield facet_item_presenter(item) unless skipped item.items&.each do |subitem| yield facet_item_presenter(subitem.dup.tap { |i| i.fq = nil if skipped }) end end end |