diff --git a/app/presenters/content_item/manual.rb b/app/presenters/content_item/manual.rb
index 26e515376..dff0fa162 100644
--- a/app/presenters/content_item/manual.rb
+++ b/app/presenters/content_item/manual.rb
@@ -44,8 +44,16 @@ def other_metadata
end
def updated_metadata(updated_at)
- updates_link = view_context.link_to(I18n.t("manuals.see_all_updates"), "#{base_path}/updates")
- { I18n.t("manuals.updated") => "#{display_date(updated_at)}, #{updates_link}" }
+ current_path = view_context.request.path
+
+ if (hmrc? || manual?) && current_path == "#{base_path}/updates"
+ update_at_text = display_date(updated_at).to_s
+ else
+ updates_link = view_context.link_to(I18n.t("manuals.see_all_updates"), "#{base_path}/updates")
+ update_at_text = "#{display_date(updated_at)} - #{updates_link}"
+ end
+
+ { I18n.t("manuals.updated") => update_at_text }
end
def details
@@ -55,5 +63,9 @@ def details
def hmrc?
%w[hmrc_manual hmrc_manual_section].include?(schema_name)
end
+
+ def manual?
+ %w[manual manual_section].include?(schema_name)
+ end
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5e2e611eb..3d3846585 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -47,7 +47,7 @@ en:
hide_all_updates: hide all updates
last_updated: Last updated %{date}
published: Published %{date}
- see_all_updates: see all updates
+ see_all_updates: See all updates
show_all_updates: show all updates
publisher_metadata:
hide_all: hide all
@@ -484,7 +484,7 @@ en:
pages_in_manual_section: Manual section pages
previous_page: Previous page
search_this_manual: Search this manual
- see_all_updates: see all updates
+ see_all_updates: See all updates
title: "%{title}Guidance"
updated: Updated
updates_amendments: published amendments
diff --git a/test/integration/hmrc_manual_updates_test.rb b/test/integration/hmrc_manual_updates_test.rb
index 3cb2be78f..ef04835ad 100644
--- a/test/integration/hmrc_manual_updates_test.rb
+++ b/test/integration/hmrc_manual_updates_test.rb
@@ -25,9 +25,7 @@ class HmrcManualUpdatesTest < ActionDispatch::IntegrationTest
{
from: { "HM Revenue & Customs": "/government/organisations/hm-revenue-customs" },
first_published: "11 February 2015",
- other: {
- I18n.t("manuals.see_all_updates") => "#{@content_item['base_path']}/updates",
- },
+ other: {},
},
extra_metadata_classes: ".gem-c-metadata--inverse",
)
diff --git a/test/integration/manual_updates_test.rb b/test/integration/manual_updates_test.rb
index 0f9dbd435..d270340eb 100644
--- a/test/integration/manual_updates_test.rb
+++ b/test/integration/manual_updates_test.rb
@@ -21,9 +21,7 @@ class ManualUpdatesTest < ActionDispatch::IntegrationTest
{
from: { "Government Digital Service": "/government/organisations/government-digital-service" },
first_published: "27 April 2015",
- other: {
- I18n.t("manuals.see_all_updates") => "#{@content_item['base_path']}/updates",
- },
+ other: {},
},
extra_metadata_classes: ".gem-c-metadata--inverse",
)
diff --git a/test/presenters/content_item/manual_test.rb b/test/presenters/content_item/manual_test.rb
index 6cb60e321..ab7efe2be 100644
--- a/test/presenters/content_item/manual_test.rb
+++ b/test/presenters/content_item/manual_test.rb
@@ -63,11 +63,18 @@ def initialize(schema_name = "manual")
item = DummyContentItem.new
item.stubs(:display_date).returns("23 March 2022")
+ view_context = mock
+ view_context.stubs(:request).returns(ActionDispatch::TestRequest.create)
+ view_context.stubs(:link_to).with("blah", "/blah", class: "govuk-link").returns("blah")
+ view_context.stubs(:link_to).with("See all updates", "/a/base/path/updates").returns("See all updates")
+
+ item.stubs(:view_context).returns(view_context)
+
expected_metadata = {
from: ["blah"],
first_published: "23 March 2022",
other: {
- I18n.t("manuals.updated") => "23 March 2022, #{I18n.t('manuals.see_all_updates')}",
+ I18n.t("manuals.updated") => "23 March 2022 - #{I18n.t('manuals.see_all_updates')}",
},
inverse: true,
inverse_compress: true,