Class: Blacklight::FacetFieldCheckboxesComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/facet_field_checkboxes_component.rb

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(facet_field:, layout: nil) ⇒ FacetFieldCheckboxesComponent

Returns a new instance of FacetFieldCheckboxesComponent.



5
6
7
8
# File 'app/components/blacklight/facet_field_checkboxes_component.rb', line 5

def initialize(facet_field:, layout: nil)
  @facet_field = facet_field
  @layout = layout == false ? FacetFieldNoLayoutComponent : Blacklight::FacetFieldComponent
end

Instance Method Details

#presentersObject



14
15
16
17
18
19
20
21
22
# File 'app/components/blacklight/facet_field_checkboxes_component.rb', line 14

def presenters
  return [] unless @facet_field.paginator

  return to_enum(:presenters) unless block_given?

  @facet_field.paginator.items.each do |item|
    yield Blacklight::FacetCheckboxItemPresenter.new(item, @facet_field.facet_field, helpers, @facet_field.key, @facet_field.search_state)
  end
end

#render?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/components/blacklight/facet_field_checkboxes_component.rb', line 10

def render?
  presenters.any?
end