From 917790c2e1d91033c2fe191105eb2dafaff2d21e Mon Sep 17 00:00:00 2001 From: Katherine Martin <78093815+martikat@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:33:06 +0100 Subject: [PATCH 1/6] Update font size for contents list when in mobile --- app/assets/stylesheets/page-contents.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/stylesheets/page-contents.scss b/app/assets/stylesheets/page-contents.scss index 5a32a8a4..43cadc2a 100644 --- a/app/assets/stylesheets/page-contents.scss +++ b/app/assets/stylesheets/page-contents.scss @@ -176,6 +176,12 @@ The following was govspeak and custom kramdown for the list of page content anch font-size: 16px; } +@media (max-width: 40.0525em) { + .contents-on-page ul { + font-size: 14px; + } + } + .contents-on-page li { padding-top: 10px; line-height: 1.3; From ec04608bba7c24b5fac9bc73b0fd8e128f7c8d61 Mon Sep 17 00:00:00 2001 From: Katherine Martin <78093815+martikat@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:33:48 +0100 Subject: [PATCH 2/6] Address bugs from QA --- app/controllers/pages_controller.rb | 6 +++++- app/views/pages/side_nav.slim | 2 +- config/locales/en.yml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index e53e133e..1f782390 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -9,7 +9,11 @@ def index end def show - render page.to_partial_path + if page.nil? + render 'errors/not_found' + else + render page.to_partial_path + end end private diff --git a/app/views/pages/side_nav.slim b/app/views/pages/side_nav.slim index c96ba8ad..e9ccd360 100644 --- a/app/views/pages/side_nav.slim +++ b/app/views/pages/side_nav.slim @@ -5,7 +5,7 @@ = render partial: 'hero', locals: { hero: page.hero } .govuk-grid-row - .govuk-grid-column-one-quarter.sticky.mob-section + .govuk-grid-column-one-quarter.sticky.mob-section class='govuk-!-margin-bottom-4' input#menu-icon-chk.menu-btn[type="checkbox" name="menu-icon" checked] label.menu-icon.govuk-body-l[for="menu-icon-chk"] svg[xmlns="http://www.w3.org/2000/svg" height="1em" viewbox="0 0 448 512"] diff --git a/config/locales/en.yml b/config/locales/en.yml index 42b7b464..42041fc2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -134,4 +134,4 @@ en: blank: Last name must not be blank settings: cookie_policy_legend: Do you want to accept analytics cookies? - preferences_saved_html: Your cookie settings were saved
Go back to Help for early years providers + preferences_saved_html: Your cookie settings were saved. [Go back to Help for early years providers](%{return_url}). From 33bd6a24507efe98c001d1069fcefedf33ffe8cb Mon Sep 17 00:00:00 2001 From: Katherine Martin <78093815+martikat@users.noreply.github.com> Date: Fri, 26 Apr 2024 09:26:50 +0100 Subject: [PATCH 3/6] Update based on PR comments --- app/assets/stylesheets/hfeyp-v2.scss | 1 + app/views/layouts/application.html.slim | 10 +++++++--- app/views/pages/side_nav.slim | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/hfeyp-v2.scss b/app/assets/stylesheets/hfeyp-v2.scss index e8f6cac6..c368ec09 100644 --- a/app/assets/stylesheets/hfeyp-v2.scss +++ b/app/assets/stylesheets/hfeyp-v2.scss @@ -204,6 +204,7 @@ a:hover .hf-card-container .hf-card-details h3 { .mob-section { background: #f1f2f350; margin-top: -20px; + margin-bottom: 20px; padding: 20px 15px 0px; border-bottom: 1px solid #ccc; } diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 14abd4b9..9c5446f4 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -37,11 +37,15 @@ html.govuk-template lang='en' = navigation - .dfe-content-page--header class='govuk-!-padding-bottom-7' - .dfe-width-container + - if page.nil? + .dfe-width-container = render 'layouts/banner' - = yield :hero + - else + .dfe-content-page--header class='govuk-!-padding-bottom-7' + .dfe-width-container + = render 'layouts/banner' + = yield :hero .dfe-width-container main#main-content.govuk-main-wrapper role='main' diff --git a/app/views/pages/side_nav.slim b/app/views/pages/side_nav.slim index e9ccd360..0e1397a8 100644 --- a/app/views/pages/side_nav.slim +++ b/app/views/pages/side_nav.slim @@ -5,7 +5,7 @@ = render partial: 'hero', locals: { hero: page.hero } .govuk-grid-row - .govuk-grid-column-one-quarter.sticky.mob-section class='govuk-!-margin-bottom-4' + .govuk-grid-column-one-quarter.sticky.mob-section input#menu-icon-chk.menu-btn[type="checkbox" name="menu-icon" checked] label.menu-icon.govuk-body-l[for="menu-icon-chk"] svg[xmlns="http://www.w3.org/2000/svg" height="1em" viewbox="0 0 448 512"] From b16278ab10e675db6d5b7b2cd7ec6604c138d40e Mon Sep 17 00:00:00 2001 From: Katherine Martin <78093815+martikat@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:17:04 +0100 Subject: [PATCH 4/6] Hardcode href in cookie notice --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 42041fc2..c27478f3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -134,4 +134,4 @@ en: blank: Last name must not be blank settings: cookie_policy_legend: Do you want to accept analytics cookies? - preferences_saved_html: Your cookie settings were saved. [Go back to Help for early years providers](%{return_url}). + preferences_saved_html: Your cookie settings were saved.
Go back to Help for early years providers From 22ea5bbd6c922adef40a9bd4d9c2e930da838bf6 Mon Sep 17 00:00:00 2001 From: Katherine Martin <78093815+martikat@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:56:52 +0100 Subject: [PATCH 5/6] Update format of text for preferences saved text --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index c27478f3..6a31e1c2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -134,4 +134,4 @@ en: blank: Last name must not be blank settings: cookie_policy_legend: Do you want to accept analytics cookies? - preferences_saved_html: Your cookie settings were saved.
Go back to Help for early years providers + preferences_saved_html: Your cookie settings were saved. [Go back to Help for early years providers](/). From 084a783474ee004155f0eb3efea0328fe0245b7e Mon Sep 17 00:00:00 2001 From: Katherine Martin <78093815+martikat@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:08:36 +0100 Subject: [PATCH 6/6] Update logic for showing banner styling --- app/controllers/home_controller.rb | 1 + app/controllers/pages_controller.rb | 5 ++- app/helpers/application_helper.rb | 6 +++ app/views/errors/not_found.html.slim | 3 ++ app/views/layouts/application.html.slim | 14 ++----- app/views/layouts/hero.html.slim | 51 +++++++++++++++++++++++++ spec/helpers/application_helper_spec.rb | 9 +++++ spec/system/homepage_spec.rb | 13 +++++++ spec/system/smoke_spec.rb | 11 ------ 9 files changed, 89 insertions(+), 24 deletions(-) create mode 100644 app/views/layouts/hero.html.slim create mode 100644 spec/helpers/application_helper_spec.rb create mode 100644 spec/system/homepage_spec.rb delete mode 100644 spec/system/smoke_spec.rb diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 0c07b37d..54ae0260 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,7 @@ class HomeController < ApplicationController helper_method :section, :page + layout 'hero' def index; end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 1f782390..12c56fcb 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -3,14 +3,15 @@ class PagesController < ApplicationController :slug, :section, :breadcrumbs + layout 'hero' def index - render 'errors/not_found' if page.nil? + render 'errors/not_found', layout: 'application' if page.nil? end def show if page.nil? - render 'errors/not_found' + render 'errors/not_found', layout: 'application' else render page.to_partial_path end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cc9310aa..97320289 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -31,4 +31,10 @@ def track_analytics? def debug? Dry::Types['params.bool'][ENV.fetch('DEBUG', false)] end + + # @param parts [Array] + # @return [String] + def html_title(*parts) + [t('service.name'), *parts].join(' : ') + end end diff --git a/app/views/errors/not_found.html.slim b/app/views/errors/not_found.html.slim index 5ff7f6cb..8e5f0eed 100644 --- a/app/views/errors/not_found.html.slim +++ b/app/views/errors/not_found.html.slim @@ -1,3 +1,6 @@ +- content_for :page_title do + = html_title 'Page not found' + .govuk-grid-row .govuk-grid-column-two-thirds h1.govuk-heading-xl diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index badc5a06..fb4b872e 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -26,7 +26,7 @@ html.govuk-template lang='en' = javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true = yield :head - body#hero-layout.govuk-template__body + body#default-layout.govuk-template__body script | document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); @@ -37,17 +37,9 @@ html.govuk-template lang='en' = navigation - - if page.nil? - .dfe-width-container - = render 'layouts/banner' - = yield :hero - - else - .dfe-content-page--header class='govuk-!-padding-bottom-7' - .dfe-width-container - = render 'layouts/banner' - = yield :hero - .dfe-width-container + = render 'layouts/banner' + main#main-content.govuk-main-wrapper role='main' = yield diff --git a/app/views/layouts/hero.html.slim b/app/views/layouts/hero.html.slim new file mode 100644 index 00000000..6075137b --- /dev/null +++ b/app/views/layouts/hero.html.slim @@ -0,0 +1,51 @@ +doctype html +html.govuk-template lang='en' + head + title= [t('service.name'), yield(:page_title).presence].compact.join(' : ') + = csrf_meta_tags + = csp_meta_tag + + = tag.meta content: 'text/html; charset=UTF-8', 'http-equiv': 'Content-Type' + = render 'layouts/analytics_header' + = render 'layouts/hotjar' + + = tag.meta content: 'width=device-width,initial-scale=1', name: 'viewport' + = tag.meta name: 'robots', content: 'noindex,nofollow' unless Rails.application.live? + = tag.meta property: 'og:image', content: image_path('images/govuk-opengraph-image.png') + = tag.meta name: 'description', content: @page&.meta_description if @page&.meta_description.present? + = csrf_meta_tags + = tag.meta name: 'theme-color', content: '#0b0c0c' + + = favicon_link_tag image_path('dfe_favicon.ico') + = favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" + = favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' + = favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' + = favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' + = favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' + = stylesheet_link_tag 'application', 'data-turbo-track': 'reload' + = javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true + = yield :head + + body#hero-layout.govuk-template__body + script + | document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); + + = render 'layouts/analytics_body' + = render 'layouts/cookie_banner' + + = govuk_skip_link + + = navigation + + .dfe-content-page--header class='govuk-!-padding-bottom-7' + .dfe-width-container + = render 'layouts/banner' + = yield :hero + + .dfe-width-container + main#main-content.govuk-main-wrapper role='main' + = yield + + = yield :other_resources + + = render FooterComponent.new(pages: Page.footer.pages) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb new file mode 100644 index 00000000..24284e14 --- /dev/null +++ b/spec/helpers/application_helper_spec.rb @@ -0,0 +1,9 @@ +require 'rails_helper' + +xdescribe 'ApplicationHelper', type: :helper do + describe '#html_title' do + it 'shows content' do + expect(page).to have_content 'content within html_title' + end + end +end diff --git a/spec/system/homepage_spec.rb b/spec/system/homepage_spec.rb new file mode 100644 index 00000000..559e333a --- /dev/null +++ b/spec/system/homepage_spec.rb @@ -0,0 +1,13 @@ +require 'rails_helper' + +RSpec.describe 'Homepage' do + before do + visit '/' + end + + specify do + within '#hero-layout' do + expect(page).to have_content 'Find helpful articles and resources to support you in your setting.' + end + end +end diff --git a/spec/system/smoke_spec.rb b/spec/system/smoke_spec.rb deleted file mode 100644 index 55b74779..00000000 --- a/spec/system/smoke_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'rails_helper' - -RSpec.describe 'PoC' do - before do - visit '/' - end - - specify do - expect(page).to have_content 'Find helpful articles and resources to support you in your setting.' - end -end