Skip to content

Commit

Permalink
Merge pull request #4635 from alphagov/remove-custom-header-layout-op…
Browse files Browse the repository at this point in the history
…tions

Remove `custom_header` and `custom_layout` options
  • Loading branch information
MartinJJones authored Feb 18, 2025
2 parents d030ea7 + 52b410c commit 50f4d50
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Remove left border from the super nav menu button ([PR #4631](https://github.com/alphagov/govuk_publishing_components/pull/4631))
* Use component wrapper on 'add another' component ([PR #4632](https://github.com/alphagov/govuk_publishing_components/pull/4632))
* Use component wrapper on 'copy to clipboard' component ([PR #4633](https://github.com/alphagov/govuk_publishing_components/pull/4633))
* **BREAKING** Remove custom_header and custom_layout options ([PR #4635](https://github.com/alphagov/govuk_publishing_components/pull/4635))

## 51.2.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
omit_footer_navigation ||= false
omit_footer_border ||= false
omit_header ||= false
custom_layout ||= false
product_name ||= nil
show_explore_header ||= false
show_cross_service_header ||= false
Expand Down Expand Up @@ -119,8 +118,6 @@
service_navigation_items: service_navigation_items,
product_name: product_name,
} %>
<% elsif content_for?(:custom_header) %>
<%= yield :custom_header %>
<% else %>
<%= render "govuk_publishing_components/components/layout_header", {
search: show_search,
Expand Down Expand Up @@ -161,8 +158,6 @@
<%= yield :before_content %>
<%= yield %>
<% end %>
<% elsif custom_layout %>
<%= yield %>
<% elsif for_static %>
<div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
<%= yield :before_content %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,3 @@ examples:
cookie_preferences:
text: How GOV.UK accounts use cookies
href: https://www.gov.uk/government/publications/govuk-accounts-trial-full-privacy-notice-and-accessibility-statement
with_custom_layout:
description: Yields a custom layout for the content.
data:
custom_layout: true
block: |
<main id="custom-layout">
<h1>This is a custom layout</h1>
</main>
with_custom_header:
description: Allows the header to be replaced with HTML injected by the calling application in a `content_for` tag named `:custom_header`.
embed: |
<% content_for(:custom_header) do %>
<header id="custom-header">I'm a custom header</header>
<% end %>
<%= render "govuk_publishing_components/components/layout_for_public", {
} %>
18 changes: 0 additions & 18 deletions spec/components/layout_for_public_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,24 +325,6 @@ def component_name
assert_select ".gem-c-cookie-banner + .gem-c-skip-link"
end

it "can render a custom header instead of the default one" do
view.content_for(:custom_header) { content_tag(:header, "GOV.UK with a custom header", id: "custom-header") }
render_component({})

assert_select "header#custom-header"
assert page.has_no_selector?(".gem-c-layout-header")
end

it "can render a custom layout instead of the default one" do
render_component({ custom_layout: true }) do
content_tag(:main, "GOV.UK with a custom layout", id: "custom-layout")
end

assert_select "main#custom-layout"
assert_select "div#wrapper", false
assert_select "main.govuk-main-wrapper", false
end

it "renders without the wrapper if for_static is not explictly set to true" do
render_component({})

Expand Down

0 comments on commit 50f4d50

Please sign in to comment.