From 1e5ddbcb23f0cbd43fb663e787562ff9aafd5da3 Mon Sep 17 00:00:00 2001 From: chao-xian Date: Wed, 9 Jun 2021 21:14:57 +0100 Subject: [PATCH 1/2] Add explore_header versions of templates This will allow us to switch between the current header menu and the newer design that we want to AB test with. This means that frontend apps using the AB Test gem can request a different template via Slimmer. --- app/views/layouts/_header.html.erb | 2 +- app/views/root/_base.html.erb | 2 ++ app/views/root/core_layout_explore_header.html.erb | 7 +++++++ app/views/root/header_footer_only.html.erb | 2 +- app/views/root/header_footer_only_explore_header.html.erb | 5 +++++ 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 app/views/root/core_layout_explore_header.html.erb create mode 100644 app/views/root/header_footer_only_explore_header.html.erb diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 35ef872e8..f26c927ff 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,5 +1,5 @@ <% - show_super_navigation_header ||= false # will be shown or hidden by A/B Test variable + show_super_navigation_header = content_for?(:show_explore_header) ? yield(:show_explore_header) : false # will be shown or hidden by A/B Test variable %> <% if show_super_navigation_header %> diff --git a/app/views/root/_base.html.erb b/app/views/root/_base.html.erb index b2d142877..14c1bf6ac 100644 --- a/app/views/root/_base.html.erb +++ b/app/views/root/_base.html.erb @@ -12,6 +12,8 @@ <%= render :partial => 'stylesheet', :locals => { :css_file => local_assigns[:css_file] || 'application' } %> <% end %> +<% content_for :show_explore_header, local_assigns[:show_explore_header] %> + <% content_for :inside_header do %> <% diff --git a/app/views/root/core_layout_explore_header.html.erb b/app/views/root/core_layout_explore_header.html.erb new file mode 100644 index 000000000..6d15e2486 --- /dev/null +++ b/app/views/root/core_layout_explore_header.html.erb @@ -0,0 +1,7 @@ +<%= render partial: 'base', locals: { + hide_nav: true, # no breadcrumbs, you can include them using components if + # you need them, rather than using slimmer + show_explore_header: true, + css_file: 'core-layout', + js_file: 'header-footer-only' +} %> diff --git a/app/views/root/header_footer_only.html.erb b/app/views/root/header_footer_only.html.erb index 9c195b50f..c0a105924 100644 --- a/app/views/root/header_footer_only.html.erb +++ b/app/views/root/header_footer_only.html.erb @@ -1,4 +1,4 @@ <%= render partial: 'base', locals: { css_file: 'header-footer-only', - js_file: 'header-footer-only' + js_file: 'header-footer-only', } %> diff --git a/app/views/root/header_footer_only_explore_header.html.erb b/app/views/root/header_footer_only_explore_header.html.erb new file mode 100644 index 000000000..b14a57bf3 --- /dev/null +++ b/app/views/root/header_footer_only_explore_header.html.erb @@ -0,0 +1,5 @@ +<%= render partial: 'base', locals: { + css_file: 'header-footer-only', + js_file: 'header-footer-only', + show_explore_header: true, +} %> From edc1341d48f723bd3c3e4ffcb39ab459651b753d Mon Sep 17 00:00:00 2001 From: chao-xian Date: Fri, 2 Jul 2021 19:01:47 +0100 Subject: [PATCH 2/2] Add explore header templates for public_layout --- app/views/root/_gem_base.html.erb | 10 ++++++---- app/views/root/gem_layout_explore_header.html.erb | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 app/views/root/gem_layout_explore_header.html.erb diff --git a/app/views/root/_gem_base.html.erb b/app/views/root/_gem_base.html.erb index 607b1298c..3307b389a 100644 --- a/app/views/root/_gem_base.html.erb +++ b/app/views/root/_gem_base.html.erb @@ -1,10 +1,11 @@ <% @emergency_banner = emergency_banner_notification - product_name ||= nil - omit_feedback_form ||= nil logo_link ||= Plek.new.website_root.present? ? Plek.new.website_root : "https://www.gov.uk/" full_width ||= false + omit_feedback_form ||= nil + product_name ||= nil + show_explore_header ||= false if @emergency_banner emergency_banner = render "components/emergency_banner", { @@ -23,10 +24,8 @@ <%= render "govuk_publishing_components/components/layout_for_public", { emergency_banner: emergency_banner.presence, full_width: full_width, - omit_feedback_form: omit_feedback_form, global_bar: user_satisfaction_survey + global_bar, logo_link: logo_link, - product_name: product_name, navigation_items: [ # Remember to update the links in _base.html.erb as well. { text: "Account", @@ -52,5 +51,8 @@ link_for: "accounts-signed-out", }, }], + omit_feedback_form: omit_feedback_form, + product_name: product_name, + show_explore_header: show_explore_header, title: content_for?(:title) ? yield(:title) : "GOV.UK - The best place to find government services and information", } %> diff --git a/app/views/root/gem_layout_explore_header.html.erb b/app/views/root/gem_layout_explore_header.html.erb new file mode 100644 index 000000000..bd522ac7c --- /dev/null +++ b/app/views/root/gem_layout_explore_header.html.erb @@ -0,0 +1 @@ +<%= render partial: "gem_base", locals: { show_explore_header: true } %>