Class: Arclight::BreadcrumbsHierarchyComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/arclight/breadcrumbs_hierarchy_component.rb

Overview

Render the hierarchy for a document

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#collectionObject (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_collectionObject (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

#repositoryObject



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