Skip to content

Commit

Permalink
Merge pull request #3510 from alphagov/fix-h1-issue-with-worldwide-or…
Browse files Browse the repository at this point in the history
…gs-add-h1

Display an H1 of the page title of all worldwide org pages
  • Loading branch information
hannako authored Jan 30, 2025
2 parents 04b1dbc + 2b5bfa6 commit 104f325
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%= render partial: "content_items/worldwide_organisation/header", locals: {
worldwide_organisation: @content_item.worldwide_organisation,
show_header_title: false,
} %>

<article class="govuk-grid-row">
Expand Down
1 change: 1 addition & 0 deletions app/views/content_items/worldwide_office.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%= render partial: "content_items/worldwide_organisation/header", locals: {
worldwide_organisation: @content_item.worldwide_organisation,
show_header_title: false,
} %>

<article class="govuk-grid-row">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/worldwide_organisation.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: "content_items/worldwide_organisation/header", locals: { worldwide_organisation: @content_item } %>
<%= render partial: "content_items/worldwide_organisation/header", locals: { worldwide_organisation: @content_item, show_header_title: true } %>

<section class="govuk-grid-row" id="about-us">
<div class="govuk-grid-column-two-thirds">
Expand Down
20 changes: 15 additions & 5 deletions app/views/content_items/worldwide_organisation/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<header class="worldwide-organisation-header govuk-grid-row">
<div class="govuk-grid-column-two-thirds worldwide-organisation-header__logo">
<%= render "govuk_publishing_components/components/organisation_logo", {
organisation: @content_item.organisation_logo,
heading_level: 1,
inline: true,
} %>
<% locals = { organisation: @content_item.organisation_logo, inline: true, heading_level: 1 } %>
<% if show_header_title
locals.merge!(margin_bottom: 8)
locals.delete(:heading_level) %>
<%= render "govuk_publishing_components/components/organisation_logo", locals %>
<%= render "govuk_publishing_components/components/heading", {
text: @content_item.title,
heading_level: 1,
inline: true,
font_size: "l",
margin_bottom: 5,
} %>
<% else %>
<%= render "govuk_publishing_components/components/organisation_logo", locals %>
<% end %>
</div>

<div class="govuk-grid-column-one-third govuk-!-padding-top-2">
Expand Down
3 changes: 2 additions & 1 deletion test/integration/worldwide_organisation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
class WorldwideOrganisationTest < ActionDispatch::IntegrationTest
test "renders basic worldwide organisation page" do
setup_and_visit_content_item("worldwide_organisation")
assert_has_component_title("British Deputy High Commission\nHyderabad")
assert_has_component_title("UK Embassy in Country")
assert page.has_css?(".gem-c-organisation-logo__name")
assert page.has_text?(@content_item["description"])
end

Expand Down

0 comments on commit 104f325

Please sign in to comment.