Class: Geoblacklight::HomepageFeatureFacetComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/geoblacklight/homepage_feature_facet_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(icon:, label:, facet_field_presenter:, items:) ⇒ HomepageFeatureFacetComponent

Returns a new instance of HomepageFeatureFacetComponent.



5
6
7
8
9
10
11
# File 'app/components/geoblacklight/homepage_feature_facet_component.rb', line 5

def initialize(icon:, label:, facet_field_presenter:, items:)
  @icon = icon
  @label = label
  @facet_field_presenter = facet_field_presenter
  @items = items
  super()
end

Instance Method Details

#facetsObject



13
14
15
16
17
18
19
20
# File 'app/components/geoblacklight/homepage_feature_facet_component.rb', line 13

def facets
  links = @items.map do |item|
    item_presenter = @facet_field_presenter.item_presenter(item)
    link_to(item_presenter.value, item_presenter.href, class: "home-facet-link")
  end
  links << link_to("more ยป", facet_catalog_path(@facet_field_presenter.key), class: "more_facets_link")
  safe_join(links, ", ")
end