Skip to content

Commit bae6511

Browse files
committed
Use formatted name for worldwide organisations
We are currently presenting the Worldwide Organisation's title in the logo. This means there are no line breaks in the places specified by the user. Updating to use the formatted title, which the publisher would have expected since they entered this in Whitehall. This also applies the change to Worldwide Offices and Worldwide Corporate Information Pages, which include the Worldwide Organisation's logo in the header.
1 parent 543f082 commit bae6511

9 files changed

+25
-15
lines changed

app/presenters/worldwide_corporate_information_page_presenter.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ class WorldwideCorporateInformationPagePresenter < ContentItemPresenter
33
include ContentItem::ContentsList
44
include WorldwideOrganisation::Branding
55

6+
def formatted_title
7+
worldwide_organisation&.formatted_title
8+
end
9+
610
def show_default_breadcrumbs?
711
false
812
end
@@ -17,10 +21,6 @@ def sponsoring_organisations
1721
worldwide_organisation&.sponsoring_organisations
1822
end
1923

20-
def organisation_logo
21-
super.merge!(name: worldwide_organisation&.title)
22-
end
23-
2424
private
2525

2626
def show_contents_list?

app/presenters/worldwide_office_presenter.rb

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ class WorldwideOfficePresenter < ContentItemPresenter
22
include ContentItem::ContentsList
33
include WorldwideOrganisation::Branding
44

5+
def formatted_title
6+
worldwide_organisation&.formatted_title
7+
end
8+
59
def body
610
content_item.dig("details", "access_and_opening_times")
711
end

app/presenters/worldwide_organisation/branding.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def organisation_logo
77

88
sponsoring_organisation = sponsoring_organisations&.first
99
{
10-
name: content_item["title"],
10+
name: formatted_title.html_safe,
1111
url: link_to_organisation ? worldwide_organisation.base_path : nil,
1212
crest: sponsoring_organisation&.dig("details", "logo", "crest") || DEFAULT_ORGANISATION_LOGO,
1313
brand: sponsoring_organisation&.dig("details", "brand") || DEFAULT_ORGANISATION_LOGO,

app/presenters/worldwide_organisation_presenter.rb

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ class WorldwideOrganisationPresenter < ContentItemPresenter
33
include WorldwideOrganisation::Branding
44
include ActionView::Helpers::UrlHelper
55

6+
def formatted_title
7+
content_item.dig("details", "logo", "formatted_title")
8+
end
9+
610
def sponsoring_organisation_links
711
return if sponsoring_organisations.empty?
812

test/integration/worldwide_corporate_information_page_test.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class WorldwideCorporateInformationPageTest < ActionDispatch::IntegrationTest
4141
setup_and_visit_content_item("worldwide_corporate_information_page")
4242

4343
assert_has_component_organisation_logo
44-
assert page.has_link? "British Embassy Manila", href: "/world/organisations/british-embassy-manila"
44+
assert_has_component_title("British Embassy\nManila")
45+
assert page.has_link? "British EmbassyManila", href: "/world/organisations/british-embassy-manila"
4546
end
4647

4748
test "includes the world locations and sponsoring organisations" do

test/integration/worldwide_office_test.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ class WorldwideOfficeTest < ActionDispatch::IntegrationTest
7474
assert page.has_content? "24/7 consular support is available by telephone for all routine enquiries and emergencies."
7575
end
7676

77-
test "includes the logo and name of the worldwide organisation as a link" do
77+
test "includes the logo and formatted name of the worldwide organisation as a link" do
7878
setup_and_visit_content_item("worldwide_office")
7979

8080
assert_has_component_organisation_logo
81-
assert page.has_link? "British Embassy Manila", href: "/world/organisations/british-embassy-manila"
81+
assert_has_component_title("British Embassy\nManila")
82+
assert page.has_link? "British EmbassyManila", href: "/world/organisations/british-embassy-manila"
8283
end
8384

8485
test "includes the world locations and sponsoring organisations" do

test/integration/worldwide_organisation_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class WorldwideOrganisationTest < ActionDispatch::IntegrationTest
44
test "renders basic worldwide organisation page" do
55
setup_and_visit_content_item("worldwide_organisation")
6-
assert_has_component_title(@content_item["title"])
6+
assert_has_component_title("British Deputy High Commission\nHyderabad")
77
assert page.has_text?(@content_item["description"])
88
end
99

test/presenters/worldwide_corporate_information_page_presenter_test.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def schema_name
2020

2121
presented = create_presenter(WorldwideCorporateInformationPagePresenter, content_item: with_non_default_crest)
2222

23-
expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" }
23+
expected = { name: "British Embassy<br/>Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" }
2424
assert_equal expected, presented.organisation_logo
2525
end
2626

@@ -32,7 +32,7 @@ def schema_name
3232

3333
presented = create_presenter(WorldwideCorporateInformationPagePresenter, content_item: with_empty_logo)
3434

35-
expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
35+
expected = { name: "British Embassy<br/>Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
3636
assert_equal expected, presented.organisation_logo
3737
end
3838

@@ -42,7 +42,7 @@ def schema_name
4242

4343
presented = create_presenter(WorldwideCorporateInformationPagePresenter, content_item: without_sponsoring_organisations)
4444

45-
expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
45+
expected = { name: "British Embassy<br/>Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
4646
assert_equal expected, presented.organisation_logo
4747
end
4848

test/presenters/worldwide_office_presenter_test.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def schema_name
2424

2525
presented = create_presenter(WorldwideOfficePresenter, content_item: with_non_default_crest)
2626

27-
expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" }
27+
expected = { name: "British Embassy<br/>Manila", url: "/world/organisations/british-embassy-manila", crest: "dbt", brand: "foreign-commonwealth-development-office" }
2828
assert_equal expected, presented.organisation_logo
2929
end
3030

@@ -36,7 +36,7 @@ def schema_name
3636

3737
presented = create_presenter(WorldwideOfficePresenter, content_item: with_empty_logo)
3838

39-
expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
39+
expected = { name: "British Embassy<br/>Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
4040
assert_equal expected, presented.organisation_logo
4141
end
4242

@@ -46,7 +46,7 @@ def schema_name
4646

4747
presented = create_presenter(WorldwideOfficePresenter, content_item: without_sponsoring_organisations)
4848

49-
expected = { name: "British Embassy Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
49+
expected = { name: "British Embassy<br/>Manila", url: "/world/organisations/british-embassy-manila", crest: "single-identity", brand: "single-identity" }
5050
assert_equal expected, presented.organisation_logo
5151
end
5252

0 commit comments

Comments
 (0)