diff --git a/app/presenters/corporate_information_page_presenter.rb b/app/presenters/corporate_information_page_presenter.rb index 252146e14..b789b9466 100644 --- a/app/presenters/corporate_information_page_presenter.rb +++ b/app/presenters/corporate_information_page_presenter.rb @@ -5,6 +5,12 @@ class CorporateInformationPagePresenter < ContentItemPresenter include ContentItem::OrganisationBranding include ContentItem::CorporateInformationGroups + ORG_CHANGING_BANNER_BASE_PATHS = %w[ + /government/organisations/department-for-business-energy-and-industrial-strategy/about + /government/organisations/department-for-international-trade/about + /government/organisations/department-for-business-energy-and-industrial-strategy/about + ].freeze + def page_title page_title = super page_title += " - #{default_organisation['title']}" if default_organisation @@ -22,6 +28,10 @@ def contents_items super + extra_headings end + def show_organisation_changing_banner? + ORG_CHANGING_BANNER_BASE_PATHS.include?(base_path) + end + private def extra_headings diff --git a/app/views/content_items/corporate_information_page.html.erb b/app/views/content_items/corporate_information_page.html.erb index e3e9982cf..bdf91e4b3 100644 --- a/app/views/content_items/corporate_information_page.html.erb +++ b/app/views/content_items/corporate_information_page.html.erb @@ -4,6 +4,15 @@ ) %> <% end %> +<% if @content_item.show_organisation_changing_banner? %> +
+ <%= render "govuk_publishing_components/components/notice", { + title: sanitize('This organisation is changing. Read the latest updates on government departments or visit the 10 Downing Street Twitter feed.'), + margin_bottom: 3, + } %> +
+<% end %> + <% @additional_body = capture do %> <% if @content_item.corporate_information? %> <%= @content_item.corporate_information_heading_tag %> diff --git a/test/presenters/corporate_information_page_presenter_test.rb b/test/presenters/corporate_information_page_presenter_test.rb index 33c25766e..b241c5cd8 100644 --- a/test/presenters/corporate_information_page_presenter_test.rb +++ b/test/presenters/corporate_information_page_presenter_test.rb @@ -77,5 +77,15 @@ def schema_name assert presented_item.further_information.include?(information_charter["base_path"]) assert presented_item.further_information.include?(information_charter["title"]) end + + test "returns true for about pages that require a banner" do + presented_item = presented_item(schema_name, "base_path" => "/government/organisations/department-for-business-energy-and-industrial-strategy/about") + assert presented_item.show_organisation_changing_banner? + end + + test "returns false for about pages that don't require a banner" do + presented_item = presented_item(schema_name, "base_path" => "/government/organisations/a-random-org/about") + assert_not presented_item.show_organisation_changing_banner? + end end end