Class: Arclight::BreadcrumbsHierarchyComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Arclight::BreadcrumbsHierarchyComponent
- Defined in:
- app/components/arclight/breadcrumbs_hierarchy_component.rb
Overview
Render the hierarchy for a document
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#parents_under_collection ⇒ Object
readonly
Returns the value of attribute parents_under_collection.
Instance Method Summary collapse
-
#initialize(presenter:) ⇒ BreadcrumbsHierarchyComponent
constructor
A new instance of BreadcrumbsHierarchyComponent.
- #repository ⇒ Object
Constructor Details
#initialize(presenter:) ⇒ BreadcrumbsHierarchyComponent
Returns a new instance of BreadcrumbsHierarchyComponent.
9 10 11 12 13 14 15 |
# File 'app/components/arclight/breadcrumbs_hierarchy_component.rb', line 9 def initialize(presenter:) super @presenter = presenter collections, @parents_under_collection = document.parents.partition(&:collection?) @collection = collections.first end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
17 18 19 |
# File 'app/components/arclight/breadcrumbs_hierarchy_component.rb', line 17 def collection @collection end |
#parents_under_collection ⇒ Object (readonly)
Returns the value of attribute parents_under_collection.
17 18 19 |
# File 'app/components/arclight/breadcrumbs_hierarchy_component.rb', line 17 def parents_under_collection @parents_under_collection end |
Instance Method Details
#repository ⇒ Object
19 20 21 22 23 |
# File 'app/components/arclight/breadcrumbs_hierarchy_component.rb', line 19 def repository return tag.span(t('arclight.show_breadcrumb_label')) if document.repository_config.blank? link_to(document.repository_config.name, helpers.arclight_engine.repository_path(document.repository_config.slug)) end |