From 4d08d7d9bb7aa9a75f00154926e68ac31df528bd Mon Sep 17 00:00:00 2001 From: davidgisbey Date: Fri, 20 May 2022 14:44:07 +0100 Subject: [PATCH 1/2] Update styling of history notice banner This now uses the publishing component notice component. --- app/views/shared/_history_notice.html.erb | 4 +++- test/integration/detailed_guide_test.rb | 2 +- test/integration/document_collection_test.rb | 2 +- test/integration/news_article_test.rb | 2 +- test/integration/publication_test.rb | 2 +- test/integration/statistical_data_set_test.rb | 2 +- test/integration/world_location_news_article_test.rb | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/views/shared/_history_notice.html.erb b/app/views/shared/_history_notice.html.erb index 67ca10b30..dd4d7bd11 100644 --- a/app/views/shared/_history_notice.html.erb +++ b/app/views/shared/_history_notice.html.erb @@ -1,3 +1,5 @@ <% if content_item.historically_political? %> - <%= render 'components/banner', text: t("shared.historically_political", government: content_item.publishing_government) %> + <%= render "govuk_publishing_components/components/notice", { + title: t("shared.historically_political", government: content_item.publishing_government), + } %> <% end %> diff --git a/test/integration/detailed_guide_test.rb b/test/integration/detailed_guide_test.rb index eeeb0e055..7b7adec9e 100644 --- a/test/integration/detailed_guide_test.rb +++ b/test/integration/detailed_guide_test.rb @@ -39,7 +39,7 @@ class DetailedGuideTest < ActionDispatch::IntegrationTest test "historically political detailed guide" do setup_and_visit_content_item("political_detailed_guide") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/document_collection_test.rb b/test/integration/document_collection_test.rb index 3e6df717b..11bdf403c 100644 --- a/test/integration/document_collection_test.rb +++ b/test/integration/document_collection_test.rb @@ -148,7 +148,7 @@ class DocumentCollectionTest < ActionDispatch::IntegrationTest test "historically political collection" do setup_and_visit_content_item("document_collection_political") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/news_article_test.rb b/test/integration/news_article_test.rb index c7f6fca6c..7b192f3ac 100644 --- a/test/integration/news_article_test.rb +++ b/test/integration/news_article_test.rb @@ -38,7 +38,7 @@ class NewsArticleTest < ActionDispatch::IntegrationTest test "renders history notice" do setup_and_visit_content_item("news_article_history_mode") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/publication_test.rb b/test/integration/publication_test.rb index 6568592c2..07b4b4d06 100644 --- a/test/integration/publication_test.rb +++ b/test/integration/publication_test.rb @@ -59,7 +59,7 @@ class PublicationTest < ActionDispatch::IntegrationTest test "historically political publication" do setup_and_visit_content_item("political_publication") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/statistical_data_set_test.rb b/test/integration/statistical_data_set_test.rb index eeb5212ce..7bf27ceb8 100644 --- a/test/integration/statistical_data_set_test.rb +++ b/test/integration/statistical_data_set_test.rb @@ -35,7 +35,7 @@ class StatisticalDataSetTest < ActionDispatch::IntegrationTest test "historically political statistical data set" do setup_and_visit_content_item("statistical_data_set_political") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end diff --git a/test/integration/world_location_news_article_test.rb b/test/integration/world_location_news_article_test.rb index 81afbb782..2331ffa92 100644 --- a/test/integration/world_location_news_article_test.rb +++ b/test/integration/world_location_news_article_test.rb @@ -43,7 +43,7 @@ class WorldLocationNewsArticleTest < ActionDispatch::IntegrationTest test "renders history notice" do setup_and_visit_content_item("world_location_news_article_history_mode") - within ".app-c-banner" do + within ".govuk-notification-banner__content" do assert page.has_text?("This was published under the 2010 to 2015 Conservative and Liberal Democrat coalition government") end end From 9c9e46a770c4ad68e09ba6bc0be5004bafd3fb37 Mon Sep 17 00:00:00 2001 From: davidgisbey Date: Mon, 23 May 2022 11:08:15 +0100 Subject: [PATCH 2/2] Render history notice for historically_political html attachments This does the work to ensure that if a html attachment is historically political then the history notice banner is rendered like it is for various other document types such as News Articles. --- app/presenters/html_publication_presenter.rb | 1 + app/views/content_items/html_publication.html.erb | 1 + test/integration/html_publication_test.rb | 8 ++++++++ test/presenters/html_publication_presenter_test.rb | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/app/presenters/html_publication_presenter.rb b/app/presenters/html_publication_presenter.rb index 501b2555f..0595ad9ec 100644 --- a/app/presenters/html_publication_presenter.rb +++ b/app/presenters/html_publication_presenter.rb @@ -2,6 +2,7 @@ class HtmlPublicationPresenter < ContentItemPresenter include ContentItem::Body include ContentItem::OrganisationBranding include ContentItem::ContentsList + include ContentItem::Political def isbn content_item["details"]["isbn"] diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb index bf6f42da6..57bc17c73 100644 --- a/app/views/content_items/html_publication.html.erb +++ b/app/views/content_items/html_publication.html.erb @@ -42,6 +42,7 @@

<%= @content_item.last_changed %>

<% end %> +<%= render 'shared/history_notice', content_item: @content_item %> <%= render 'govuk_publishing_components/components/notice', @content_item.withdrawal_notice_component %>