Sha256: 10e2d593b8ba22c8e1651ed7d1ba272575ce14c57288aa39aa5eb1617a23ac1f
Contents?: true
Size: 1.11 KB
Versions: 11
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module Arclight # Draw the links to the collection info in the sidebar class CollectionSidebarComponent < ViewComponent::Base def initialize(document:, partials:, collection_presenter:) super @document = document @partials = Array(partials) @collection_presenter = collection_presenter end attr_reader :document, :partials, :collection_presenter def has_section?(section) # Access field data comes from repositories.yml not from solr, so handle it in a different way. return true if section == :access_field collection_presenter.with_field_group(section).fields_to_render.any? end def document_section_path(section) [document_path, section_anchor(section)].join end def section_label(section) t("arclight.views.show.sections.#{section}") end def document_path @document_path ||= solr_document_path(normalized_eadid) end def section_anchor(section) "##{t("arclight.views.show.sections.#{section}").parameterize}" end delegate :normalized_eadid, to: :document end end
Version data entries
11 entries across 11 versions & 1 rubygems