Class: Blacklight::Facets::ListComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::Facets::ListComponent
show all
- Defined in:
- app/components/blacklight/facets/list_component.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Component
reset_compiler!, sidecar_files, upstream_sidecar_files
Constructor Details
#initialize(facet_field:, role: nil, layout: nil) ⇒ ListComponent
Returns a new instance of ListComponent.
Instance Attribute Details
#layout ⇒ Object
Returns the value of attribute layout.
12
13
14
|
# File 'app/components/blacklight/facets/list_component.rb', line 12
def layout
@layout
end
|
#role ⇒ Object
Returns the value of attribute role.
12
13
14
|
# File 'app/components/blacklight/facets/list_component.rb', line 12
def role
@role
end
|
Instance Method Details
#facet_config ⇒ Object
36
37
38
|
# File 'app/components/blacklight/facets/list_component.rb', line 36
def facet_config
@facet_field.facet_field
end
|
#facet_item_component_class ⇒ Object
32
33
34
|
# File 'app/components/blacklight/facets/list_component.rb', line 32
def facet_item_component_class
facet_config.item_component
end
|
#facet_item_presenter(facet_item) ⇒ Object
28
29
30
|
# File 'app/components/blacklight/facets/list_component.rb', line 28
def facet_item_presenter(facet_item)
facet_config.item_presenter.new(facet_item, facet_config, helpers, @facet_field.key)
end
|
#facet_item_presenters ⇒ Object
18
19
20
21
22
|
# File 'app/components/blacklight/facets/list_component.rb', line 18
def facet_item_presenters
@facet_field.paginator.items.map do |item|
facet_item_presenter(item)
end
end
|
#facet_items(wrapping_element: :li, **item_args) ⇒ Object
14
15
16
|
# File 'app/components/blacklight/facets/list_component.rb', line 14
def facet_items(wrapping_element: :li, **item_args)
facet_item_component_class.with_collection(facet_item_presenters, wrapping_element: wrapping_element, **item_args)
end
|
#render? ⇒ Boolean
24
25
26
|
# File 'app/components/blacklight/facets/list_component.rb', line 24
def render?
@facet_field.paginator&.items&.any?
end
|