diff --git a/app/presenters/html_publication_presenter.rb b/app/presenters/html_publication_presenter.rb index 6bfebdbf6..37a78f0a4 100644 --- a/app/presenters/html_publication_presenter.rb +++ b/app/presenters/html_publication_presenter.rb @@ -4,6 +4,7 @@ class HtmlPublicationPresenter < ContentItemPresenter include ContentItem::ContentsList include ContentItem::Political include ContentItem::NationalApplicability + include ContentItem::Metadata def isbn content_item["details"]["isbn"] @@ -21,17 +22,6 @@ def format_sub_type end end - def last_changed - timestamp = display_date(public_timestamp) - - # This assumes that a translation doesn't need the date to come beforehand. - if content_item["details"]["first_published_version"] - "#{I18n.t('content_item.metadata.published')} #{timestamp}" - else - "#{I18n.t('content_item.metadata.updated')} #{timestamp}" - end - end - def organisations content_item["links"]["organisations"] || [] end @@ -44,6 +34,20 @@ def organisation_logo(organisation) end end + def publisher_metadata + super.tap do |m| + orgs = organisations.map do |organisation| + view_context.link_to(organisation["title"], organisation["base_path"], class: "govuk-link govuk-link--inverse") + end + m.merge!(from: orgs) + + if content_item["details"]["first_published_version"] + m.delete(:see_updates_link) + m.delete(:last_updated) + end + end + end + def full_path(request) request.base_url + request.path end diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb index 4f804de9f..d083d46db 100644 --- a/app/views/content_items/html_publication.html.erb +++ b/app/views/content_items/html_publication.html.erb @@ -9,31 +9,23 @@ content_for :simple_header, true %> -<% if @content_item.organisations %> -
- -
-<% end %> -<%= render 'govuk_publishing_components/components/inverse_header', {} do %> - <%= render 'govuk_publishing_components/components/title', - title: @content_item.title, - context: I18n.t("content_item.schema_name.#{@content_item.format_sub_type}", count: 1), - inverse: true, - margin_bottom: 0, - margin_top: 3 - %> -

<%= @content_item.last_changed %>

-<% end %> +
+ <%= render 'govuk_publishing_components/components/inverse_header', {} do %> + <%= render 'govuk_publishing_components/components/title', + title: @content_item.title, + context: I18n.t("content_item.schema_name.#{@content_item.format_sub_type}", count: 1), + inverse: true, + margin_bottom: 0, + margin_top: 3 + %> + <%= render 'govuk_publishing_components/components/metadata', @content_item.publisher_metadata.merge( + inverse: true, + inverse_compress: true + ) %> + <% end %> +
<%= render 'shared/history_notice', content_item: @content_item %> <% if @content_item.withdrawn? %> <%= render 'govuk_publishing_components/components/notice', @content_item.withdrawal_notice_component %>