From 49cd505299ad31f690050d52e8d936a2be1d9267 Mon Sep 17 00:00:00 2001 From: Deborah Chua Date: Wed, 16 May 2018 16:44:24 +0100 Subject: [PATCH 1/2] Add last_updated timestamp on help_page format To ensure we are GDPR compliant we need to follow the privacy notice template where we have to include an updated timestamp on the page. The `last_updated` uses the `public_updated_at` content_item attribute. --- app/views/content_items/_body_with_related_links.html.erb | 3 +-- test/integration/help_page_test.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/content_items/_body_with_related_links.html.erb b/app/views/content_items/_body_with_related_links.html.erb index f1442c309..e5708d882 100644 --- a/app/views/content_items/_body_with_related_links.html.erb +++ b/app/views/content_items/_body_with_related_links.html.erb @@ -15,8 +15,7 @@ disable_youtube_expansions: true, rich_govspeak: true %> - <% #https://github.com/alphagov/government-frontend/pull/329#issuecomment-297681738 %> - <% if false && @content_item.last_updated %> + <% if @content_item.last_updated %>

<%= t 'common.last_updated' %>: <%= @content_item.last_updated %>

diff --git a/test/integration/help_page_test.rb b/test/integration/help_page_test.rb index 779af7b38..d57481691 100644 --- a/test/integration/help_page_test.rb +++ b/test/integration/help_page_test.rb @@ -5,7 +5,7 @@ class HelpPageTest < ActionDispatch::IntegrationTest setup_and_visit_content_item('help_page') assert page.has_text?(@content_item["title"]) - # assert page.has_text?("Last updated: 16 December 2014") + assert page.has_text?("Last updated: 16 December 2014") assert_has_component_govspeak(@content_item["details"]["body"].squish) end end From b54c0f38ad77e236110a69bfd873a8450af68201 Mon Sep 17 00:00:00 2001 From: Deborah Chua Date: Thu, 17 May 2018 10:44:12 +0100 Subject: [PATCH 2/2] Change last updated to use published-dates component For consistency we should be using the frontend component that renders the last_updated attribute. --- app/views/content_items/_body_with_related_links.html.erb | 8 ++++---- test/integration/help_page_test.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/content_items/_body_with_related_links.html.erb b/app/views/content_items/_body_with_related_links.html.erb index e5708d882..86c804fa3 100644 --- a/app/views/content_items/_body_with_related_links.html.erb +++ b/app/views/content_items/_body_with_related_links.html.erb @@ -15,10 +15,10 @@ disable_youtube_expansions: true, rich_govspeak: true %> - <% if @content_item.last_updated %> -

- <%= t 'common.last_updated' %>: <%= @content_item.last_updated %> -

+ <% if @content_item.last_updated && @content_item.schema_name == "help_page" %> + <%= render "components/published-dates", { + last_updated: @content_item.last_updated + } %> <% end %> diff --git a/test/integration/help_page_test.rb b/test/integration/help_page_test.rb index d57481691..131286df4 100644 --- a/test/integration/help_page_test.rb +++ b/test/integration/help_page_test.rb @@ -3,9 +3,9 @@ class HelpPageTest < ActionDispatch::IntegrationTest test "renders title and body" do setup_and_visit_content_item('help_page') - assert page.has_text?(@content_item["title"]) - assert page.has_text?("Last updated: 16 December 2014") + assert page.has_text?(@content_item["title"]) assert_has_component_govspeak(@content_item["details"]["body"].squish) + assert_has_published_dates(@content_item["last_updated"]) end end