Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class WorldwideCorporateInformationPageController < ContentItemsController
include Cacheable

def show
@presenter = WorldwideCorporateInformationPagePresenter.new(content_item)
@content_item_presenter = WorldwideCorporateInformationPagePresenter.new(content_item)
render layout: "header_content_sidebar"
end
end
10 changes: 10 additions & 0 deletions app/presenters/worldwide_corporate_information_page_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ class WorldwideCorporateInformationPagePresenter < ContentItemPresenter
include WorldwideOrganisationBranding
include ContentsList

def page_title_options
super.merge({
organisation_logo: worldwide_organisation.organisation_logo,
organisation_logo_heading_level: 1,
heading_level: 2,
world_location_links: worldwide_organisation.world_location_links,
sponsoring_organisation_links: worldwide_organisation.sponsoring_organisation_links,
})
end

def worldwide_organisation
return unless content_item.worldwide_organisation

Expand Down
33 changes: 10 additions & 23 deletions app/views/worldwide_corporate_information_page/show.html.erb
Comment thread
andysellick marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
<%= render partial: "worldwide_organisation/header", locals: {
worldwide_organisation: @presenter.worldwide_organisation,
show_header_title: false,
} %>
<% content_for :header do %>
<%= render "shared/headers/page_title", options: @content_item_presenter.page_title_options %>
<% end %>

<article class="govuk-grid-row">
<div class="govuk-grid-column-one-third">
<% content_for :content do %>
<%= render "govuk_publishing_components/components/contents_list",
contents: @presenter.headers_for_contents_list_component,
underline_links: true %>
</div>

<div class="govuk-grid-column-two-thirds">
<%= render "govuk_publishing_components/components/heading", {
text: @content_item.title,
heading_level: 2,
font_size: "xl",
margin_bottom: 4,
} %>

<p class="govuk-body-l"><%= @content_item.description %></p>

contents: @content_item_presenter.headers_for_contents_list_component,
underline_links: true %>
<article>
<%= render "govuk_publishing_components/components/govspeak", {} do
raw(@content_item.body)
raw(content_item.body)
end %>
</div>
</article>
</article>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: I note that this page already used the article tag. I think this is the first time I've noticed it in a page during this piece of work, so we should maybe have a broader conversation about the use of article in page types, as if it's appropriate we should use it everywhere to be consistent.

<% end %>
18 changes: 7 additions & 11 deletions spec/system/worldwide_corporate_information_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@
end

it "includes the world locations and sponsoring organisations" do
within find(".worldwide-organisation-header__metadata", match: :first) do
expect(page).to have_text("News:")
expect(page).to have_link("Philippines with translation and the UK", href: "/world/philippines/news")
expect(page).to have_link("Palau with translation and the UK", href: "/world/palau/news")
expect(page).to have_text("News:")
expect(page).to have_link("Philippines with translation and the UK", href: "/world/philippines/news")
expect(page).to have_link("Palau with translation and the UK", href: "/world/palau/news")

expect(page).to have_text("Part of:")
expect(page).to have_link("Foreign, Commonwealth & Development Office", href: "/government/organisations/foreign-commonwealth-development-office")
end
expect(page).to have_text("Part of:")
expect(page).to have_link("Foreign, Commonwealth & Development Office", href: "/government/organisations/foreign-commonwealth-development-office")
end

it "omits the world locations and sponsoring organisations when they are absent" do
Expand All @@ -51,10 +49,8 @@
stub_content_store_has_item(base_path, content_store_response)
visit base_path

within find(".worldwide-organisation-header__metadata", match: :first) do
expect(page).not_to have_text("Location:")
expect(page).not_to have_text("Part of:")
end
expect(page).not_to have_text("Location:")
expect(page).not_to have_text("Part of:")
end

it "does not render the translations when there are no translations" do
Expand Down