Class: Arclight::BreadcrumbComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Arclight::BreadcrumbComponent
- Defined in:
- app/components/arclight/breadcrumb_component.rb
Overview
Display the document hierarchy as “breadcrumbs”
Instance Method Summary collapse
- #build_repository_link ⇒ Object
- #call ⇒ Object
- #components {|build_repository_link| ... } ⇒ Object
-
#initialize(document:, count: nil, offset: 0) ⇒ BreadcrumbComponent
constructor
A new instance of BreadcrumbComponent.
Constructor Details
#initialize(document:, count: nil, offset: 0) ⇒ BreadcrumbComponent
Returns a new instance of BreadcrumbComponent.
7 8 9 10 11 12 |
# File 'app/components/arclight/breadcrumb_component.rb', line 7 def initialize(document:, count: nil, offset: 0) @document = document @count = count @offset = offset super() end |
Instance Method Details
#build_repository_link ⇒ Object
32 33 34 |
# File 'app/components/arclight/breadcrumb_component.rb', line 32 def build_repository_link render Arclight::RepositoryBreadcrumbComponent.new(document: @document) end |
#call ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/components/arclight/breadcrumb_component.rb', line 14 def call return unless .any? tag.ol class: 'breadcrumb' do safe_join() end end |
#components {|build_repository_link| ... } ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/components/arclight/breadcrumb_component.rb', line 22 def components return to_enum(:components) unless block_given? yield build_repository_link @document.parents.each do |parent| yield tag.li(class: 'breadcrumb-item') { link_to(parent.label, solr_document_path(parent.id)) } end end |