Sha256: 2c4e475d063c007d694e5a41a960b70a4bf4e72fc6138d6093403586a42d9736

Contents?: true

Size: 752 Bytes

Versions: 14

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module Arclight
  # Render the hierarchy for a document
  class BreadcrumbsHierarchyComponent < ViewComponent::Base
    delegate :document, to: :@presenter
    delegate :blacklight_icon, to: :helpers

    def initialize(presenter:)
      super

      @presenter = presenter
      collections, @parents_under_collection = document.parents.partition(&:collection?)
      @collection = collections.first
    end

    attr_reader :collection, :parents_under_collection

    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
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
arclight-1.4.0 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.3.0 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.2.0 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.1.3 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.1.2 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.1.1 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.1.0 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.0.1 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.0.0 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.0.0.beta6 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.0.0.beta4 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.0.0.beta3 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.0.0.beta2 app/components/arclight/breadcrumbs_hierarchy_component.rb
arclight-1.0.0.beta1 app/components/arclight/breadcrumbs_hierarchy_component.rb