Class: Arclight::SearchResultBreadcrumbsComponent
- Inherits:
-
Blacklight::MetadataFieldComponent
- Object
- Blacklight::MetadataFieldComponent
- Arclight::SearchResultBreadcrumbsComponent
- Defined in:
- app/components/arclight/search_result_breadcrumbs_component.rb
Overview
Render the breadcrumbs for a search result document
Instance Method Summary collapse
- #breadcrumb_count ⇒ Object
- #breadcrumbs ⇒ Object
- #compact? ⇒ Boolean
-
#initialize(field:, **kwargs) ⇒ SearchResultBreadcrumbsComponent
constructor
A new instance of SearchResultBreadcrumbsComponent.
- #render? ⇒ Boolean
- #rendered_breadcrumbs ⇒ Object
Constructor Details
#initialize(field:, **kwargs) ⇒ SearchResultBreadcrumbsComponent
Returns a new instance of SearchResultBreadcrumbsComponent.
8 9 10 11 |
# File 'app/components/arclight/search_result_breadcrumbs_component.rb', line 8 def initialize(field:, **kwargs) @field = field super end |
Instance Method Details
#breadcrumb_count ⇒ Object
27 28 29 |
# File 'app/components/arclight/search_result_breadcrumbs_component.rb', line 27 def @field.field_config.compact&.dig(:count) if compact? end |
#breadcrumbs ⇒ Object
13 14 15 16 17 |
# File 'app/components/arclight/search_result_breadcrumbs_component.rb', line 13 def offset = grouped? ? 2 : 0 Arclight::BreadcrumbComponent.new(document: document, count: , offset: offset) end |
#compact? ⇒ Boolean
33 34 35 |
# File 'app/components/arclight/search_result_breadcrumbs_component.rb', line 33 def compact? helpers.document_index_view_type == :compact end |
#render? ⇒ Boolean
23 24 25 |
# File 'app/components/arclight/search_result_breadcrumbs_component.rb', line 23 def render? .present? end |
#rendered_breadcrumbs ⇒ Object
19 20 21 |
# File 'app/components/arclight/search_result_breadcrumbs_component.rb', line 19 def @rendered_breadcrumbs ||= capture { render } end |