Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom_header and custom_layout options #4635

Merged
merged 2 commits into from
Feb 18, 2025
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
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