diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 5b053c5634..aecc60843f 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -61,6 +61,7 @@ def set_guide_draft_access_token def load_content_item content_item = Services.content_store.content_item(content_item_path) @content_item = PresenterBuilder.new(content_item, content_item_path).presenter + @content_item.include_collections_in_other_publisher_metadata = show_new_navigation? end def load_taxonomy_navigation diff --git a/app/presenters/content_item/metadata.rb b/app/presenters/content_item/metadata.rb index 3e4e6610c2..6daa7d2e96 100644 --- a/app/presenters/content_item/metadata.rb +++ b/app/presenters/content_item/metadata.rb @@ -20,14 +20,18 @@ def important_metadata end def publisher_metadata - { - published: published, - last_updated: updated, - link_to_history: !!updated, - other: { - 'From': from + {}.tap do |publisher_metadata| + publisher_metadata[:published] = published + publisher_metadata[:last_updated] = updated + publisher_metadata[:link_to_history] = !!updated + publisher_metadata[:other] = { + from: from, } - } + + if include_collections_in_other_publisher_metadata + publisher_metadata[:other][:collections] = links('document_collections') + end + end end end end diff --git a/app/presenters/content_item_presenter.rb b/app/presenters/content_item_presenter.rb index c121346aba..876359e522 100644 --- a/app/presenters/content_item_presenter.rb +++ b/app/presenters/content_item_presenter.rb @@ -14,6 +14,8 @@ class ContentItemPresenter :document_type, :taxons + attr_accessor :include_collections_in_other_publisher_metadata + def initialize(content_item, requested_content_item_path = nil) @content_item = content_item @requested_content_item_path = requested_content_item_path diff --git a/app/views/components/_publisher-metadata.html.erb b/app/views/components/_publisher-metadata.html.erb index 9136eca641..b6c55968e8 100644 --- a/app/views/components/_publisher-metadata.html.erb +++ b/app/views/components/_publisher-metadata.html.erb @@ -16,10 +16,33 @@ <% values ||= [] values = Array(values) + toggle_id = "app-c-publisher-metadata__definition--#{title.to_s.parameterize(separator: '-')}" %> <% if values.any? %> -