diff --git a/app/presenters/worldwide_corporate_information_page_presenter.rb b/app/presenters/worldwide_corporate_information_page_presenter.rb index 74b68cf3ec..7f4ca7dde4 100644 --- a/app/presenters/worldwide_corporate_information_page_presenter.rb +++ b/app/presenters/worldwide_corporate_information_page_presenter.rb @@ -3,6 +3,10 @@ class WorldwideCorporateInformationPagePresenter < ContentItemPresenter include ContentItem::ContentsList include WorldwideOrganisation::Branding + def formatted_title + worldwide_organisation&.formatted_title + end + def show_default_breadcrumbs? false end diff --git a/app/presenters/worldwide_office_presenter.rb b/app/presenters/worldwide_office_presenter.rb index bf26290d85..d65d7fc637 100644 --- a/app/presenters/worldwide_office_presenter.rb +++ b/app/presenters/worldwide_office_presenter.rb @@ -2,6 +2,10 @@ class WorldwideOfficePresenter < ContentItemPresenter include ContentItem::ContentsList include WorldwideOrganisation::Branding + def formatted_title + worldwide_organisation&.formatted_title + end + def body content_item.dig("details", "access_and_opening_times") end diff --git a/app/presenters/worldwide_organisation/branding.rb b/app/presenters/worldwide_organisation/branding.rb index bdfaabf488..72aa32cb43 100644 --- a/app/presenters/worldwide_organisation/branding.rb +++ b/app/presenters/worldwide_organisation/branding.rb @@ -7,7 +7,7 @@ def organisation_logo sponsoring_organisation = sponsoring_organisations&.first { - name: content_item["title"], + name: formatted_title.html_safe, url: link_to_organisation ? worldwide_organisation.base_path : nil, crest: sponsoring_organisation&.dig("details", "logo", "crest") || DEFAULT_ORGANISATION_LOGO, brand: sponsoring_organisation&.dig("details", "brand") || DEFAULT_ORGANISATION_LOGO, diff --git a/app/presenters/worldwide_organisation_presenter.rb b/app/presenters/worldwide_organisation_presenter.rb index 7d116f2f13..b7f98fd07f 100644 --- a/app/presenters/worldwide_organisation_presenter.rb +++ b/app/presenters/worldwide_organisation_presenter.rb @@ -3,6 +3,10 @@ class WorldwideOrganisationPresenter < ContentItemPresenter include WorldwideOrganisation::Branding include ActionView::Helpers::UrlHelper + def formatted_title + content_item.dig("details", "logo", "formatted_title") + end + def sponsoring_organisation_links return if sponsoring_organisations.empty? diff --git a/test/integration/worldwide_corporate_information_page_test.rb b/test/integration/worldwide_corporate_information_page_test.rb index 3e01c505b4..3540c7cfef 100644 --- a/test/integration/worldwide_corporate_information_page_test.rb +++ b/test/integration/worldwide_corporate_information_page_test.rb @@ -20,6 +20,10 @@ class WorldwideCorporateInformationPageTest < ActionDispatch::IntegrationTest assert page.has_css?("#wrapper.direction-rtl"), "has .direction-rtl class on #wrapper element" end + test "includes the formatted title of the worldwide organisation" do + assert_has_component_title("British Embassy\nManila") + end + test "includes the body and contents" do setup_and_visit_content_item("worldwide_corporate_information_page") diff --git a/test/integration/worldwide_office_test.rb b/test/integration/worldwide_office_test.rb index c1fa89b837..ee4f116b78 100644 --- a/test/integration/worldwide_office_test.rb +++ b/test/integration/worldwide_office_test.rb @@ -13,6 +13,10 @@ class WorldwideOfficeTest < ActionDispatch::IntegrationTest assert page.has_selector?("h2", text: "Consular section") end + test "includes the formatted title of the worldwide organisation" do + assert_has_component_title("British Embassy\nManila") + end + test "omits breadcrumbs" do setup_and_visit_content_item("worldwide_office") diff --git a/test/integration/worldwide_organisation_test.rb b/test/integration/worldwide_organisation_test.rb index 9c271f84bb..c4b9563804 100644 --- a/test/integration/worldwide_organisation_test.rb +++ b/test/integration/worldwide_organisation_test.rb @@ -3,7 +3,7 @@ class WorldwideOrganisationTest < ActionDispatch::IntegrationTest test "renders basic worldwide organisation page" do setup_and_visit_content_item("worldwide_organisation") - assert_has_component_title(@content_item["title"]) + assert_has_component_title("British Deputy High Commission\nHyderabad") assert page.has_text?(@content_item["description"]) end