Skip to content

Commit

Permalink
Merge pull request #3180 from alphagov/use-relative-url
Browse files Browse the repository at this point in the history
Use relative URL for worldwide organisation links
  • Loading branch information
brucebolt committed May 9, 2024
2 parents 8885d99 + 548dafd commit 82441d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/presenters/worldwide_organisation_presenter.rb
Expand Up @@ -54,7 +54,7 @@ def person_in_primary_role

{
name: person["title"],
href: person["web_url"],
href: person["base_path"],
image_url: person["details"]["image"]["url"],
image_alt: person["details"]["image"]["alt_text"],
description: presented_title_for_roles(current_roles),
Expand All @@ -72,7 +72,7 @@ def people_in_non_primary_roles

{
name: person["title"],
href: person["web_url"],
href: person["base_path"],
description: presented_title_for_roles(current_roles),
}
end
Expand Down Expand Up @@ -110,7 +110,7 @@ def corporate_information_pages
return if ordered_cips.blank?

ordered_cips.map do |cip|
link = cips.find { |cp| cp["content_id"] == cip["content_id"] }["web_url"]
link = cips.find { |cp| cp["content_id"] == cip["content_id"] }["base_path"]
link_to(cip["title"], link, class: "govuk-link").html_safe
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/integration/worldwide_organisation_test.rb
Expand Up @@ -28,14 +28,14 @@ class WorldwideOrganisationTest < ActionDispatch::IntegrationTest

test "renders the person in the primary role" do
setup_and_visit_content_item("worldwide_organisation")
assert page.has_link?("Karen Pierce DCMG", href: "https://www.integration.publishing.service.gov.uk/government/people/karen-pierce")
assert page.has_link?("Karen Pierce DCMG", href: "/government/people/karen-pierce")
assert page.has_css?("img[src=\"https://assets.publishing.service.gov.uk/government/uploads/system/uploads/person/image/583/s216_UKMissionGeneva__HMA_Karen_Pierce_-_uploaded.jpg\"]")
end

test "renders people in secondary and office roles" do
setup_and_visit_content_item("worldwide_organisation")
assert page.has_link?("Justin Sosne", href: "https://www.integration.publishing.service.gov.uk/government/people/justin-sosne")
assert page.has_link?("Rachel Galloway", href: "https://www.integration.publishing.service.gov.uk/government/people/rachel-galloway")
assert page.has_link?("Justin Sosne", href: "/government/people/justin-sosne")
assert page.has_link?("Rachel Galloway", href: "/government/people/rachel-galloway")
end

test "doesn't render the people section if there are no appointed people" do
Expand All @@ -52,7 +52,7 @@ class WorldwideOrganisationTest < ActionDispatch::IntegrationTest

test "renders the navigational corporate information pages" do
setup_and_visit_content_item("worldwide_organisation")
assert page.has_link?("Complaints procedure", href: "https://www.integration.publishing.service.gov.uk/world/organisations/british-deputy-high-commission-hyderabad/about/complaints-procedure")
assert page.has_link?("Complaints procedure", href: "/world/organisations/british-deputy-high-commission-hyderabad/about/complaints-procedure")
end

test "renders the secondary corporate information pages" do
Expand Down

0 comments on commit 82441d1

Please sign in to comment.