<% add_gem_component_stylesheet("layout-for-public") for_static ||= false emergency_banner ||= nil full_width ||= false blue_bar ||= local_assigns.include?(:blue_bar) ? local_assigns[:blue_bar] : !full_width global_banner ||= nil html_lang ||= "en" homepage ||= false layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns) blue_bar_background_colour = layout_helper.blue_bar_background_colours.include?(blue_bar_background_colour) ? blue_bar_background_colour : nil logo_link ||= "/" navigation_items ||= [] one_login_navigation_items ||= {} service_navigation_items ||= [] omit_feedback_form ||= false 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 draft_watermark ||= false show_search = local_assigns.include?(:show_search) ? local_assigns[:show_search] : true title ||= "GOV.UK - The best place to find government services and information" show_account_layout ||= false account_nav_location ||= nil omit_account_navigation ||= false omit_account_phase_banner ||= false # This is a hack - but it's the only way I can find to not have two blue bars on # constrained width layouts. # # The full width layout hides the blue bar underneath the black header bar - so # full width pages won't see the blue bar unless it's added by another component # - and for most pages that component is the global banner. # # The constrained width layout doesn't hide the blue bar - so having the global # banner on a constrained width layout means there are two blue bars. # # The global banner is shown with JavaScript, so users without JavaScript won't # see it. So the constrained width blue bar can't be turned off as then it'll be # off for everyone. # # This booleon adds a CSS class that shifts the banners up by the blue bar's # height, making the two blue bars overlap and appear as one. The class is added # when a) there's content for the emergency or global banner *and* b) when using # the contrained width layout. blue_bar_dedupe = !full_width && global_banner.present? body_css_classes = %w(gem-c-layout-for-public govuk-template__body) body_css_classes << "draft" if draft_watermark body_css_classes << "global-banner-present" if global_banner.present? blue_bar_wrapper_classes = %w() blue_bar_wrapper_classes << "gem-c-layout-for-public__blue-bar-wrapper--#{blue_bar_background_colour}" if blue_bar_background_colour -%> <%= title %> <%= javascript_include_tag "govuk_publishing_components/vendor/lux/lux-measurer", { async: true } %> <%= javascript_include_tag "govuk_publishing_components/rum-custom-data", type: "module" %> <%= javascript_include_tag "govuk_publishing_components/rum-loader", { async: true, data: { "lux-reporter-script": path_to_javascript("govuk_publishing_components/vendor/lux/lux-reporter") } } %> <% # Used for Google Analytics 4 debugging. Must be placed before load-analytics script. %> <%= javascript_include_tag "govuk_publishing_components/load-analytics", type: "module" %> <%= csrf_meta_tags %> <%= stylesheet_link_tag "application", media: "all" %> <% # The default og:image is added below :head so that scrapers see any custom metatags first, and this is just a fallback %> "> <%= yield :head %> <%= tag.body class: body_css_classes do %> <%= javascript_tag nonce: true do -%> document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : ''); <% end -%> <%= render "govuk_publishing_components/components/cookie_banner", layout_helper.cookie_banner_data %> <%= render "govuk_publishing_components/components/skip_link", { href: "#content" } %> <% unless omit_header %> <% if show_explore_header %> <% if homepage %> <%= render "govuk_publishing_components/components/layout_for_public/layout_super_navigation_header_homepage", { logo_link: logo_link, } %> <% else %> <%= render "govuk_publishing_components/components/layout_super_navigation_header", { logo_link: logo_link, } %> <% end %> <% elsif show_cross_service_header %> <%= render "govuk_publishing_components/components/cross_service_header", { one_login_navigation_items: one_login_navigation_items, 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, logo_link: logo_link, navigation_items: navigation_items, product_name: product_name, # The (blue) bottom border needs to be underneath the emergency banner - # so it has been turned off and added in manually. remove_bottom_border: true, } %> <% end %> <% end %> <%= raw(emergency_banner) %> <% if (blue_bar && !global_banner.present? && !homepage) || (blue_bar_dedupe) %> <%= content_tag(:div, class: blue_bar_wrapper_classes) do %>
<% end %> <% end %> <% if global_banner.present? %> <%= content_tag("div", { class: blue_bar_dedupe ? "gem-c-layout-for-public__global-banner-wrapper" : nil, }) do %> <%= raw(global_banner) %> <% end %> <% end %> <% if show_account_layout %> <%= render "govuk_publishing_components/components/layout_for_public/account-layout", { omit_account_phase_banner: omit_account_phase_banner, omit_account_navigation: omit_account_navigation, account_nav_location: account_nav_location, } do %> <%= yield :before_content %> <%= yield %> <% end %> <% elsif custom_layout %> <%= yield %> <% elsif for_static %>
"> <%= yield :before_content %>
<%= yield %>
<% else %> <%= yield %> <% end %> <% unless omit_feedback_form %>
<%= render "govuk_publishing_components/components/feedback" %>
<% end %> <% unless local_assigns[:hide_footer_links] %> <%= render "govuk_publishing_components/components/layout_footer", { with_border: !omit_footer_border, navigation: omit_footer_navigation ? nil : layout_helper.footer_navigation, meta: layout_helper.footer_meta, } %> <% end %> <%= javascript_include_tag 'application', type: "module" %> <% if GovukPublishingComponents::Config.use_es6_components %> <%= javascript_include_tag 'es6-components', type: "module" %> <% end %> <% end %>