diff --git a/app/presenters/worldwide_corporate_information_page_presenter.rb b/app/presenters/worldwide_corporate_information_page_presenter.rb index 74b68cf3e..d305f5d84 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 @@ -17,10 +21,6 @@ def sponsoring_organisations worldwide_organisation&.sponsoring_organisations end - def organisation_logo - super.merge!(name: worldwide_organisation&.title) - end - private def show_contents_list? diff --git a/app/presenters/worldwide_office_presenter.rb b/app/presenters/worldwide_office_presenter.rb index bf26290d8..d65d7fc63 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 bdfaabf48..72aa32cb4 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 7d116f2f1..b7f98fd07 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 3e01c505b..c09e7e2cb 100644 --- a/test/integration/worldwide_corporate_information_page_test.rb +++ b/test/integration/worldwide_corporate_information_page_test.rb @@ -41,7 +41,8 @@ class WorldwideCorporateInformationPageTest < ActionDispatch::IntegrationTest setup_and_visit_content_item("worldwide_corporate_information_page") assert_has_component_organisation_logo - assert page.has_link? "British Embassy Manila", href: "/world/organisations/british-embassy-manila" + assert_has_component_title("British Embassy\nManila") + assert page.has_link? "British EmbassyManila", href: "/world/organisations/british-embassy-manila" end test "includes the world locations and sponsoring organisations" do diff --git a/test/integration/worldwide_office_test.rb b/test/integration/worldwide_office_test.rb index c1fa89b83..c9670e191 100644 --- a/test/integration/worldwide_office_test.rb +++ b/test/integration/worldwide_office_test.rb @@ -74,11 +74,12 @@ class WorldwideOfficeTest < ActionDispatch::IntegrationTest assert page.has_content? "24/7 consular support is available by telephone for all routine enquiries and emergencies." end - test "includes the logo and name of the worldwide organisation as a link" do + test "includes the logo and formatted name of the worldwide organisation as a link" do setup_and_visit_content_item("worldwide_office") assert_has_component_organisation_logo - assert page.has_link? "British Embassy Manila", href: "/world/organisations/british-embassy-manila" + assert_has_component_title("British Embassy\nManila") + assert page.has_link? "British EmbassyManila", href: "/world/organisations/british-embassy-manila" end test "includes the world locations and sponsoring organisations" do diff --git a/test/integration/worldwide_organisation_test.rb b/test/integration/worldwide_organisation_test.rb index 9c271f84b..c4b956380 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 diff --git a/test/presenters/worldwide_corporate_information_page_presenter_test.rb b/test/presenters/worldwide_corporate_information_page_presenter_test.rb index 6eb7d7f78..b3e1a2c40 100644 --- a/test/presenters/worldwide_corporate_information_page_presenter_test.rb +++ b/test/presenters/worldwide_corporate_information_page_presenter_test.rb @@ -20,7 +20,7 @@ def schema_name presented = create_presenter(WorldwideCorporateInformationPagePresenter, content_item: with_non_default_crest) - expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" } + expected = { name: "British Embassy
Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" } assert_equal expected, presented.organisation_logo end @@ -32,7 +32,7 @@ def schema_name presented = create_presenter(WorldwideCorporateInformationPagePresenter, content_item: with_empty_logo) - expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } + expected = { name: "British Embassy
Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } assert_equal expected, presented.organisation_logo end @@ -42,7 +42,7 @@ def schema_name presented = create_presenter(WorldwideCorporateInformationPagePresenter, content_item: without_sponsoring_organisations) - expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } + expected = { name: "British Embassy
Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } assert_equal expected, presented.organisation_logo end diff --git a/test/presenters/worldwide_office_presenter_test.rb b/test/presenters/worldwide_office_presenter_test.rb index f2c2cc9e6..cdd0bdddd 100644 --- a/test/presenters/worldwide_office_presenter_test.rb +++ b/test/presenters/worldwide_office_presenter_test.rb @@ -24,7 +24,7 @@ def schema_name presented = create_presenter(WorldwideOfficePresenter, content_item: with_non_default_crest) - expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" } + expected = { name: "British Embassy
Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" } assert_equal expected, presented.organisation_logo end @@ -36,7 +36,7 @@ def schema_name presented = create_presenter(WorldwideOfficePresenter, content_item: with_empty_logo) - expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } + expected = { name: "British Embassy
Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } assert_equal expected, presented.organisation_logo end @@ -46,7 +46,7 @@ def schema_name presented = create_presenter(WorldwideOfficePresenter, content_item: without_sponsoring_organisations) - expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } + expected = { name: "British Embassy
Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" } assert_equal expected, presented.organisation_logo end