From 64c2cc160d879f4b20498a3e63343b9d66c6a807 Mon Sep 17 00:00:00 2001 From: Ian James <1732331+injms@users.noreply.github.com> Date: Wed, 18 Sep 2019 13:26:59 +0100 Subject: [PATCH 1/7] Revert "Revert "Update to GOV.UK Frontend v3"" --- Gemfile | 4 +- Gemfile.lock | 13 +- app/assets/stylesheets/application.scss | 11 +- app/assets/stylesheets/hacks/_full-width.scss | 25 +- .../stylesheets/hacks/_header-tweaks.scss | 2 +- app/assets/stylesheets/mixins/_margins.scss | 16 +- .../stylesheets/modules/_change-history.scss | 34 +- .../stylesheets/modules/_collection.scss | 12 +- .../modules/_community-contact.scss | 5 +- .../modules/_govspeak-wrapper.scss | 11 +- app/assets/stylesheets/modules/_hero.scss | 62 +-- .../modules/_improve-this-page.scss | 66 ---- app/assets/stylesheets/modules/_metadata.scss | 31 -- app/assets/stylesheets/modules/_notice.scss | 8 +- .../stylesheets/modules/_page-contents.scss | 40 +- .../stylesheets/modules/_page-header.scss | 51 +-- app/assets/stylesheets/modules/_panel.scss | 18 +- .../stylesheets/modules/_related-content.scss | 26 +- app/assets/stylesheets/modules/_search.scss | 118 ------ .../modules/_service-standard-point.scss | 38 +- .../stylesheets/modules/_subsections.scss | 162 -------- .../stylesheets/modules/_typography.scss | 17 +- app/assets/stylesheets/print.scss | 5 - app/presenters/topic_presenter.rb | 69 +++- app/views/content_items/guide.html.erb | 162 ++++---- app/views/content_items/homepage.html.erb | 88 ++--- .../content_items/service_standard.html.erb | 103 +++-- app/views/content_items/topic.html.erb | 119 +++--- app/views/layouts/application.html.erb | 28 +- app/views/shared/_change_history.html.erb | 13 +- .../shared/_custom_phase_message.html.erb | 2 +- .../_custom_phase_message_homepage.html.erb | 2 +- app/views/shared/_email_signup.html.erb | 8 + app/views/shared/_improve_this_page.html.erb | 60 --- .../accordion-with-descriptions-spec.js | 360 ------------------ test/integration/guide_test.rb | 23 +- test/integration/improve_this_page_test.rb | 20 - test/integration/service_standard_test.rb | 9 +- test/integration/topic_test.rb | 32 -- 39 files changed, 452 insertions(+), 1421 deletions(-) delete mode 100644 app/assets/stylesheets/modules/_improve-this-page.scss delete mode 100644 app/assets/stylesheets/modules/_metadata.scss delete mode 100644 app/assets/stylesheets/modules/_search.scss delete mode 100644 app/assets/stylesheets/modules/_subsections.scss create mode 100644 app/views/shared/_email_signup.html.erb delete mode 100644 app/views/shared/_improve_this_page.html.erb delete mode 100644 spec/javascripts/accordion-with-descriptions-spec.js delete mode 100644 test/integration/improve_this_page_test.rb diff --git a/Gemfile b/Gemfile index a3dfe160..f8aaf27f 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gem 'gds-api-adapters', '~> 60.0.0' gem 'govuk_app_config', '~> 2.0' gem 'govuk_elements_rails' gem 'govuk_frontend_toolkit', '~> 8.2.0' -gem 'govuk_publishing_components', '~> 17.21.0' +gem 'govuk_publishing_components', '~> 20.3.0' gem 'plek', '3.0.0' gem 'rails', '~> 5.2.3' gem 'rails-i18n', '~> 5.1.3' @@ -18,7 +18,7 @@ gem 'uglifier', '>= 1.3.0' group :development, :test do gem 'govuk-lint' gem 'jasmine-rails' - gem 'phantomjs', '~> 2.1.1' + gem 'phantomjs', '~> 2.1', '>= 2.1.1.0' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 9092172d..9d8383d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -114,7 +114,7 @@ GEM govuk_frontend_toolkit (8.2.0) railties (>= 3.1.0) sass (>= 3.2.0) - govuk_publishing_components (17.21.0) + govuk_publishing_components (20.3.0) gds-api-adapters govuk_app_config govuk_frontend_toolkit @@ -246,7 +246,7 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) robotex (1.0.0) - rouge (3.7.0) + rouge (3.10.0) rubocop (0.72.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) @@ -274,9 +274,8 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.0.1) + sassc (2.2.0) ffi (~> 1.9) - rake sassc-rails (2.1.2) railties (>= 4.0.0) sassc (>= 2.0) @@ -360,10 +359,10 @@ DEPENDENCIES govuk_app_config (~> 2.0) govuk_elements_rails govuk_frontend_toolkit (~> 8.2.0) - govuk_publishing_components (~> 17.21.0) + govuk_publishing_components (~> 20.3.0) jasmine-rails listen (>= 3.0.5, < 3.2) - phantomjs (~> 2.1.1) + phantomjs (~> 2.1, >= 2.1.1.0) plek (= 3.0.0) poltergeist pry-byebug @@ -382,4 +381,4 @@ RUBY VERSION ruby 2.6.3p62 BUNDLED WITH - 1.16.2 + 1.17.2 diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 6e618e9b..2eda776a 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,4 +1,7 @@ -// The main application stylesheet +$govuk-compatibility-govuktemplate: true; +$govuk-compatibility-govukfrontendtoolkit: true; +$govuk-compatibility-govukelements: true; +@import "govuk_publishing_components/all_components"; @import "common"; @@ -12,18 +15,12 @@ @import "modules/community-contact"; @import "modules/govspeak-wrapper"; @import "modules/hero"; -@import "modules/improve-this-page"; @import "modules/link-unit"; @import "modules/main-service-manual"; -@import "modules/metadata"; @import "modules/notice"; @import "modules/page-contents"; @import "modules/page-header"; @import "modules/panel"; @import "modules/related-content"; -@import "modules/search"; @import "modules/service-standard-point"; -@import "modules/subsections"; @import "modules/typography"; - -@import "govuk_publishing_components/all_components"; diff --git a/app/assets/stylesheets/hacks/_full-width.scss b/app/assets/stylesheets/hacks/_full-width.scss index 85856a2c..d77ce2d4 100644 --- a/app/assets/stylesheets/hacks/_full-width.scss +++ b/app/assets/stylesheets/hacks/_full-width.scss @@ -1,23 +1,10 @@ -.full-width { - // We're overriding static, we have to use IDs. - // scss-lint:disable IdSelector - #wrapper { - margin: 0; - width: auto; - max-width: 100%; - } - - #global-header-bar { +.app-full-width { + #global-header-bar { // scss-lint:disable IdSelector display: none; } +} - .govuk-beta-label { - border-bottom: none; - } - - .full-page-width-wrapper, - #wrapper .report-a-problem-toggle-wrapper, - #wrapper .report-a-problem-container { - @extend %site-width-container; - } +.app-\!-full-width-override { + margin: auto !important; + max-width: none !important; } diff --git a/app/assets/stylesheets/hacks/_header-tweaks.scss b/app/assets/stylesheets/hacks/_header-tweaks.scss index a24c393f..a50dc8fd 100644 --- a/app/assets/stylesheets/hacks/_header-tweaks.scss +++ b/app/assets/stylesheets/hacks/_header-tweaks.scss @@ -2,7 +2,7 @@ // this work, we need to slightly tweak the header's CSS from our app. .header-title { float: left; - color: $white; + color: govuk-colour("white"); @include bold-24; // When the title appears on its own line (the search box is hidden and only a diff --git a/app/assets/stylesheets/mixins/_margins.scss b/app/assets/stylesheets/mixins/_margins.scss index 33e5e42b..6ca7103c 100644 --- a/app/assets/stylesheets/mixins/_margins.scss +++ b/app/assets/stylesheets/mixins/_margins.scss @@ -1,16 +1,16 @@ @mixin responsive-bottom-margin { - margin-bottom: $gutter-half; + margin-bottom: govuk-spacing(3); @include media(tablet) { - margin-bottom: $gutter * 1.5; + margin-bottom: govuk-spacing(7); } } @mixin responsive-top-margin { - margin-top: $gutter-half; + margin-top: govuk-spacing(3); @include media(tablet) { - margin-top: $gutter * 1.5; + margin-top: govuk-spacing(7); } } @@ -21,11 +21,11 @@ @mixin gutter-bottom-margin { - margin-bottom: $gutter; + margin-bottom: govuk-spacing(6); } @mixin gutter-top-margin { - margin-top: $gutter; + margin-top: govuk-spacing(6); } @mixin gutter-vertical-margins { @@ -34,9 +34,9 @@ } @mixin gutter-bottom-margin-to-double { - margin-bottom: $gutter; + margin-bottom: govuk-spacing(3); @include media(tablet) { - margin-bottom: $gutter * 2; + margin-bottom: govuk-spacing(9); } } diff --git a/app/assets/stylesheets/modules/_change-history.scss b/app/assets/stylesheets/modules/_change-history.scss index 36469b5e..fb8c3534 100644 --- a/app/assets/stylesheets/modules/_change-history.scss +++ b/app/assets/stylesheets/modules/_change-history.scss @@ -1,33 +1,3 @@ -.change-history { - margin-top: 30px; - width: 66%; - - &__latest-change { - - dt { - @include core-19; - } - - dd { - @include bold-24; - margin-bottom: 10px; - } - } - - &__summary { - @include core-16; - color: $grey-1; - } - - &__past { - - time { - @include bold-19; - } - - li { - list-style: none; - margin-bottom: 10px; - } - } +.app-c-change-history__change-note { + color: $govuk-secondary-text-colour; } diff --git a/app/assets/stylesheets/modules/_collection.scss b/app/assets/stylesheets/modules/_collection.scss index 40e7701e..5f451fdc 100644 --- a/app/assets/stylesheets/modules/_collection.scss +++ b/app/assets/stylesheets/modules/_collection.scss @@ -1,12 +1,12 @@ .collection { - border-bottom: 1px solid $border-colour; + border-bottom: 1px solid $govuk-border-colour; - padding-bottom: $gutter-half; - margin-bottom: $gutter-half; + padding-bottom: govuk-spacing(3); + margin-bottom: govuk-spacing(3); @include media(tablet) { - padding-bottom: $gutter; - margin-bottom: $gutter; + padding-bottom: govuk-spacing(6); + margin-bottom: govuk-spacing(6); } &:last-child { @@ -22,7 +22,7 @@ &__description { @include core-24; - color: $secondary-text-colour; + color: $govuk-secondary-text-colour; margin-top: 0; } diff --git a/app/assets/stylesheets/modules/_community-contact.scss b/app/assets/stylesheets/modules/_community-contact.scss index 8628f3ec..cadd5cba 100644 --- a/app/assets/stylesheets/modules/_community-contact.scss +++ b/app/assets/stylesheets/modules/_community-contact.scss @@ -1,7 +1,6 @@ -.community-contact { - @include gutter-vertical-margins; +.app-c-community-contact { @include media(tablet) { text-align: right; - padding-top: $gutter-half; + padding-top: govuk-spacing(8); } } diff --git a/app/assets/stylesheets/modules/_govspeak-wrapper.scss b/app/assets/stylesheets/modules/_govspeak-wrapper.scss index e4a99eef..4880188d 100644 --- a/app/assets/stylesheets/modules/_govspeak-wrapper.scss +++ b/app/assets/stylesheets/modules/_govspeak-wrapper.scss @@ -8,17 +8,12 @@ .govuk-govspeak p, .govuk-govspeak ol, .govuk-govspeak ul { + line-height: 1.45; // govspeak margin bottom is 20px - margin-bottom: $gutter-half; + margin-bottom: govuk-spacing(3); } .govuk-govspeak h2 { - margin-top: 15px; - padding-top: 15px; - // govspeak margin-top is 45px - @include media(tablet) { - margin-top: 15px; - padding-top: 30px; - } + @extend %govuk-heading-m; } } diff --git a/app/assets/stylesheets/modules/_hero.scss b/app/assets/stylesheets/modules/_hero.scss index e4773fc0..0644458a 100644 --- a/app/assets/stylesheets/modules/_hero.scss +++ b/app/assets/stylesheets/modules/_hero.scss @@ -1,57 +1,25 @@ -.hero { - background-color: $govuk-blue; - color: $white; - - margin-bottom: $gutter-half; +.app-c-hero { + background-color: $govuk-brand-colour; + color: govuk-colour("white"); + margin-bottom: govuk-spacing(3); + position: relative; + top: -1px; @include media(tablet) { - margin-bottom: $gutter; + margin-bottom: govuk-spacing(6); } a:link, a:visited { - font-weight: bold; - color: $white; - } - - a:hover, - a:active { - color: $light-blue-25; + @include govuk-typography-weight-bold; } +} - &__content { - $border-top-width: 10px; - - @extend %site-width-container; - - padding: ($gutter-half + $border-top-width) 0 $gutter-half; - - @include media(tablet) { - padding: ($gutter + $border-top-width) 0 $gutter; - } - } - - &__title { - @include core-48; - margin-bottom: $gutter; - font-weight: bold; - } - - &__description { - @include core-24; - } - - &__feedback-link { - @include core-16; - line-height: 1.25; - margin-top: $gutter; - - @include media(tablet) { - margin-top: 0; - } - } +.app-c-hero-lead { + line-height: 1.35; +} - &__search { - margin-bottom: $gutter-half; - } +.app-c-hero__heading--inverse, +.app-c-hero__body--inverse { + color: govuk-colour("white"); } diff --git a/app/assets/stylesheets/modules/_improve-this-page.scss b/app/assets/stylesheets/modules/_improve-this-page.scss deleted file mode 100644 index b011b83a..00000000 --- a/app/assets/stylesheets/modules/_improve-this-page.scss +++ /dev/null @@ -1,66 +0,0 @@ -// Here we're using BEM which uses __ to denote an element within a block -// scss-lint:disable SelectorFormat - -.improve-this-page { - @include print { - display: none; - } -} - -.improve-this-page__prompt { - background-color: $govuk-blue; - color: $white; - padding: 10px $gutter-half 0; - - a:link, - a:visited { - color: $white; - display: inline-block; - - &:focus { - color: $black; - } - } - - &:focus { - outline: none; - } -} - -.improve-this-page__page-is-useful-button { - margin-right: 0.2em; -} - -.improve-this-page__is-useful-question { - @include bold-16; - - display: inline; -} - -.improve-this-page__anything-wrong { - float: right; -} - -.improve-this-page__form { - margin-top: $gutter; - padding: $gutter-half 0; - border-top: 10px solid $govuk-blue; - - .form-control { - width: 100%; - } -} - -.improve-this-page__close { - @include core-16; - - text-align: right; - display: block; - margin-bottom: 10px; - - @include media(tablet) { - display: inherit; - float: right; - padding-top: 0; - } -} diff --git a/app/assets/stylesheets/modules/_metadata.scss b/app/assets/stylesheets/modules/_metadata.scss deleted file mode 100644 index 07edd347..00000000 --- a/app/assets/stylesheets/modules/_metadata.scss +++ /dev/null @@ -1,31 +0,0 @@ -.metadata { - @include core-14; - @extend %contain-floats; - margin-bottom: 2em; - - dt { - float: left; - clear: left; - width: auto; - min-width: 120px; - - @include media(tablet) { - padding-right: $gutter-one-third; - } - } - - dd { - float: left; - width: 55%; - - @include media(tablet) { - width: 70%; - } - } - - // Adjust icon position for external links - a[rel="external"]:after { - content: "\A0\A0\A0\A0\A0\A0"; - background-position: right 0%; - } -} diff --git a/app/assets/stylesheets/modules/_notice.scss b/app/assets/stylesheets/modules/_notice.scss index 347412f4..07447485 100644 --- a/app/assets/stylesheets/modules/_notice.scss +++ b/app/assets/stylesheets/modules/_notice.scss @@ -1,17 +1,17 @@ .notice { clear: both; @include responsive-bottom-margin; - padding: $gutter-half; + padding: govuk-spacing(3); - border: 5px solid $govuk-blue; + border: 5px solid $govuk-brand-colour; @include media(tablet) { - padding: $gutter-two-thirds; + padding: govuk-spacing(4); } &__title { @include bold-36; - margin-bottom: $gutter-one-third; + margin-bottom: govuk-spacing(2); } &__description { diff --git a/app/assets/stylesheets/modules/_page-contents.scss b/app/assets/stylesheets/modules/_page-contents.scss index 26403ee6..cb0ea371 100644 --- a/app/assets/stylesheets/modules/_page-contents.scss +++ b/app/assets/stylesheets/modules/_page-contents.scss @@ -1,43 +1,15 @@ -.page-contents { - margin-top: 1em; - - @include media(tablet) { - margin-top: 0; - padding: 2em 0; - } - - &__title { - @include bold-16; - margin-bottom: 5px; - } - +.app-c-page-contents { &__list li { - @include core-16; - list-style-type: none; - margin-bottom: 5px; - margin-left: $gutter-half; - padding-right: $gutter-half; + margin-left: govuk-spacing(0); + padding-right: govuk-spacing(3); &:before { - content: "–"; - float: left; - display: block; - width: $gutter-half; - margin-left: -$gutter-half; + content: "– "; + display: inline-block; + padding-right: govuk-spacing(1); } } - &__list a { - text-decoration: none; - // Prevents emboldening from pushing text onto new lines - letter-spacing: 0.022em; - - &:hover, - &:focus, - &:active { - text-decoration: underline; - } - } // Styles required by GOVUK.HighlightActiveNavItem JS &__list .active { letter-spacing: 0; diff --git a/app/assets/stylesheets/modules/_page-header.scss b/app/assets/stylesheets/modules/_page-header.scss index 4210c173..2e0b4e09 100644 --- a/app/assets/stylesheets/modules/_page-header.scss +++ b/app/assets/stylesheets/modules/_page-header.scss @@ -1,43 +1,20 @@ -// Example usage: - -// - -// Here we're using BEM which uses __ to denote an element within a block -// scss-lint:disable SelectorFormat -.page-header { - @include responsive-vertical-margins; - - &__context { - @include core-24; - - color: $secondary-text-colour; - margin-bottom: 0; - padding-bottom: .167em; - } - - &__title { - @include bold-48; +.app-c-page-header { + &__intro { + p { + @extend %govuk-body-m; + } - @include responsive-bottom-margin; + a { + @extend %govuk-link; + } } - &__summary { - @include core-24; + &__heading { + margin-bottom: govuk-spacing(3); - @include responsive-bottom-margin; + @include govuk-media-query($from: tablet) { + margin-bottom: govuk-spacing(7) + govuk-spacing(1); + margin-top: govuk-spacing(7) + govuk-spacing(1); + } } - - &__intro { - @include core-19; - } - } diff --git a/app/assets/stylesheets/modules/_panel.scss b/app/assets/stylesheets/modules/_panel.scss index 59b0979d..218f6213 100644 --- a/app/assets/stylesheets/modules/_panel.scss +++ b/app/assets/stylesheets/modules/_panel.scss @@ -1,19 +1,3 @@ .panel { - margin-top: $gutter-half; - padding-top: $gutter-half; - - border-top: 1px solid $grey-2; - - @include media(desktop) { - margin-top: $gutter; - } - - &__title { - @include bold-24; - margin-bottom: $gutter-half; - } - - &__description { - @include core-19; - } + border-top: 1px solid $govuk-border-colour; } diff --git a/app/assets/stylesheets/modules/_related-content.scss b/app/assets/stylesheets/modules/_related-content.scss index c2e1d991..a9c8c2c9 100644 --- a/app/assets/stylesheets/modules/_related-content.scss +++ b/app/assets/stylesheets/modules/_related-content.scss @@ -1,34 +1,14 @@ .related { @include media(tablet) { - border-top: 1px solid $border-colour; + border-top: 1px solid $govuk-border-colour; } } .related-item { - padding-top: 1em; - - &__title { - @include bold-19; - margin-bottom: 0.5em; - } - - &__description { - margin-bottom: 0.5em; - } - - &__list { - @include core-16; - list-style: none; - } - - &__list-item { - margin-bottom: 0.5em; - } - &__email-link { - padding-left: 30px; + padding-left: 25px; font-weight: bold; - background: image-url('mail-icon-x2.png') 5px 40% no-repeat; + background: image-url('mail-icon-x2.png') 0 40% no-repeat; background-size: 20px 14px; } } diff --git a/app/assets/stylesheets/modules/_search.scss b/app/assets/stylesheets/modules/_search.scss deleted file mode 100644 index 9ebf4c20..00000000 --- a/app/assets/stylesheets/modules/_search.scss +++ /dev/null @@ -1,118 +0,0 @@ -.search { - @extend %contain-floats; - - &__input { - float: left; - width: 100%; - - input { - width: 100%; - margin: 0.5em 0; - padding: 6px; - - @include core-19($line-height: (28 / 19), $line-height-640: (28 / 16)); - } - } - - &__submit { - float: left; - padding: 6px; - background: $black; - color: $white; - border: 0; - } - - // IE6 + IE7 always get the simplest version, regardless of whether javascript - // is enabled - @if ($is-ie == false) or ($ie-version >= 8) { - $search-button-size: 40px; - - &__input { - @include box-sizing(border-box); - - padding-right: $search-button-size; - margin-right: -$search-button-size; - - input { - @include box-sizing(border-box); - @include appearance(none); - - position: relative; - height: $search-button-size; - margin: 0; - - border: 0; - outline-offset: 0; - } - } - - &__submit { - @include box-sizing(border-box); - height: $search-button-size; - width: $search-button-size; - - cursor: pointer; - - overflow: hidden; - text-indent: -5000px; - background: $black image-url("search-button.png") no-repeat 2px 50%; - - @include device-pixel-ratio() { - background-size: 52.5px 35px; - background-position: 115% 50%; - } - - &:hover { - background-color: lighten($black, 5%); - } - - &:focus { - z-index: 15; - position: relative; - } - - @include border-radius(0); - } - - // If JS is enabled, and browser is not IE6 or IE7, position label as a - // placeholder - .js-enabled & { - position: relative; - background: $white; - - // Absolutely position the label behind the input - &__label { - @include core-19($line-height: 40px, $line-height-640: 40px); - position: absolute; - left: 0; - top: 1px; - z-index: 5; - - text-indent: 15px; - - color: $secondary-text-colour; - } - - // Input is transparent and sits above the label - &__input input { - position: relative; - z-index: 10; - - // Internet Explorer does not play well with "empty" elements. The label - // behind the text box becomes selectable (i.e. it acts as if the input - // is not there.) Setting a background image fixes it. - // http://stackoverflow.com/questions/2098714/input-boxes-with-transparent-background-are-not-clickable-in-ie8 - // http://stackoverflow.com/questions/9109911/ie-z-index-trouble-on-element-with-transparent-background - background: transparent url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); - - // Javascript adds a confusingly named `focus` class to the input when - // it contains text. We use this to set the background to white, hiding - // the label. - &:focus, - &.focus { - background: $white; - } - } - } - } -} diff --git a/app/assets/stylesheets/modules/_service-standard-point.scss b/app/assets/stylesheets/modules/_service-standard-point.scss index 8fa85dbf..5c820686 100644 --- a/app/assets/stylesheets/modules/_service-standard-point.scss +++ b/app/assets/stylesheets/modules/_service-standard-point.scss @@ -1,45 +1,39 @@ -.service-standard-point { - - $gutter-tablet: ($gutter * 1.5); // 45px - - border-top: 1px solid $border-colour; - margin-top: 1.5em; - padding-top: 1.5em; +.app-c-service-standard-point { + border-top: 1px solid $govuk-border-colour; + margin-top: govuk-spacing(5); + padding-top: govuk-spacing(5); &:first-child { - margin-top: 0; + margin-top: govuk-spacing(0); } &__title { - @include bold-24; - margin-bottom: 0.5em; - margin-left: $gutter; + margin-left: govuk-spacing(6); - @include media(tablet) { - margin-left: $gutter-tablet; + @include govuk-media-query($from: tablet) { + margin-left: govuk-spacing(8); } } &__number { float: left; - margin-left: -$gutter; + margin-left: -(govuk-spacing(6)); - @include media(tablet) { - margin-left: -$gutter-tablet; + @include govuk-media-query($from: tablet) { + margin-left: -(govuk-spacing(8)); } } &__details { - @include core-19; - margin-bottom: 0.5em; - margin-left: $gutter; + margin-bottom: govuk-spacing(2); + margin-left: govuk-spacing(6); - @include media(tablet) { - margin-left: $gutter-tablet; + @include govuk-media-query($from: tablet) { + margin-left: govuk-spacing(8); } } &__link { - margin-top: 0.5em; + margin-top: govuk-spacing(2); } } diff --git a/app/assets/stylesheets/modules/_subsections.scss b/app/assets/stylesheets/modules/_subsections.scss deleted file mode 100644 index f3367988..00000000 --- a/app/assets/stylesheets/modules/_subsections.scss +++ /dev/null @@ -1,162 +0,0 @@ -// Topic subsections -// Fallback styles first, for when JS is disabled - -// Here we're using BEM which uses __ to denote an element within a block -// scss-lint:disable SelectorFormat - -.subsection { - width: 100%; - margin-bottom: $gutter; - - @include media(tablet) { - margin-bottom: $gutter * 1.5; - } - - &__title { - @include bold-24; - margin-bottom: 5px; - } - - &__description { - @include core-19; - margin-bottom: $gutter-one-quarter; - - @include media(tablet) { - margin-bottom: $gutter-half; - } - } - - &__list { - @include core-19; - padding-left: 0; - list-style-type: none; - } - - &__list-item { - margin-bottom: 0.5em; - } - - &__list-item a { - text-decoration: none; - } -} - - - // When JavaScript is enabled, create accordion -.js-accordion-with-descriptions { - - // Wrapper for 'open all / close all' button - .subsection-controls { - @extend %contain-floats; - - button { - float: right; - - @include core-16; - cursor: pointer; - background: none; - border: none; - color: $link-colour; - padding: 0.5em 0; - } - } - - // Wrapper for subsections - .subsection-wrapper { - @extend %contain-floats; - border-bottom: 1px solid $border-colour; - } - - .subsection { - margin-bottom: 0; - - @include media(tablet) { - margin-bottom: 0; - } - - &__header { - position: relative; - padding-top: 14px; - padding-bottom: 12px; - border-top: 1px solid $border-colour; - - // Change the background of the header on hover - &:hover { - cursor: pointer; - background: $highlight-colour; - } - } - - &__title { - button { - color: $govuk-blue; - cursor: pointer; - - @include bold-24; - background: none; - border: 0; - padding-left: 0; - text-align: left; - } - - margin-bottom: 0; - margin-right: $gutter-half; - - @include media(tablet) { - margin-right: $gutter; - } - } - - &__description { - margin-bottom: 0; - margin-right: $gutter-half; - - @include media(tablet) { - margin-bottom: 0; - margin-right: $gutter; - } - } - - &__icon { - position: absolute; - top: 50%; - right: 0; - - @include media (tablet) { - right: 15px; - } - - height: 16px; - width: 16px; - margin-top: -8px; - - // PNG fallback for SVG - background-image: image-url('icons-plus-minus.png'); - // SVG sprite - background: image-url("icons-plus-minus.svg"), linear-gradient(transparent, transparent); - background-repeat: no-repeat; - background-position: 0 -16px; - } - - &--is-open { - .subsection__icon { - background-position: 0 0; - } - } - - &__content { - padding-top: 5px; - padding-bottom: $gutter-half; - } - - &--is-open { - .subsection__content { - @include media(tablet) { - padding-top: 10px; - padding-bottom: $gutter; - } - } - } - - } -} diff --git a/app/assets/stylesheets/modules/_typography.scss b/app/assets/stylesheets/modules/_typography.scss index a3f8b842..3a547240 100644 --- a/app/assets/stylesheets/modules/_typography.scss +++ b/app/assets/stylesheets/modules/_typography.scss @@ -1,11 +1,16 @@ // Text -p { - margin-top: em(5, 16); - margin-bottom: em(20, 16); +.app-c-body, +.app-c-body-s { + line-height: 1.45; +} - @include media(tablet) { - margin-top: em(5); - margin-bottom: em(20); +.app-link--inverse { + &:link, + &:visited { + color: govuk-colour("white"); } + &:focus { + @include govuk-focused-text; + } } diff --git a/app/assets/stylesheets/print.scss b/app/assets/stylesheets/print.scss index 26b9d15c..53d5b0fb 100644 --- a/app/assets/stylesheets/print.scss +++ b/app/assets/stylesheets/print.scss @@ -4,9 +4,4 @@ $is-print: true; @import "common"; -// Modules -// We're including a subset of all the modules listed in `application.scss` here -// as not all of them have proper print styling set up. -@import "modules/improve-this-page"; - @import "govuk_publishing_components/all_components_print"; diff --git a/app/presenters/topic_presenter.rb b/app/presenters/topic_presenter.rb index 69621589..b28bdead 100644 --- a/app/presenters/topic_presenter.rb +++ b/app/presenters/topic_presenter.rb @@ -37,10 +37,71 @@ def visually_collapsed? @visually_collapsed end + def visually_expanded? + !visually_collapsed? + end + + def display_as_accordion? + groups.count > 2 && visually_collapsed? + end + + def accordion_content + # Each accordion needs a hash, as shown in the GOV.UK Publishing Components + # guide: https://components.publishing.service.gov.uk/component-guide/accordion + # + # This method returns the content in the required shape from the hash + # supplied by the `groups` method. + + groups.map { |section| + { + heading: { + text: section.name, + }, + summary: { + text: section.description, + }, + content: { + html: accordion_section_links(section.linked_items), + }, + expanded: visually_expanded?, + } + } + end + private - def topic_breadcrumb - { title: title } + def accordion_section_links links + # Expects `links` to be an array of hashes containing `href` and `label` + # for the link. For example: + # + # ```ruby + # [ + # { + # label: 'Link to example', + # href: 'http://example.com' + # } + # ] + # ``` + # + # This will return santitised HTML in a string. The above example would + # return: + # + # ```html + # + # ``` + + links = links.map { |linked_item| + link_html = ActionController::Base.helpers.link_to(linked_item.label, linked_item.href, class: 'govuk-link') + "
  • #{link_html}
  • " + } + + list = "" + + ActionController::Base.helpers.sanitize(list) end def parent_breadcrumbs @@ -51,4 +112,8 @@ def parent_breadcrumbs } ] end + + def topic_breadcrumb + { title: title } + end end diff --git a/app/views/content_items/guide.html.erb b/app/views/content_items/guide.html.erb index cc89d3f8..9edf31b1 100644 --- a/app/views/content_items/guide.html.erb +++ b/app/views/content_items/guide.html.erb @@ -2,116 +2,104 @@ <% content_for :meta_description, @content_item.description %> <% content_for :extra_head do %> - <%= render 'govuk_publishing_components/components/machine_readable_metadata', content_item: @content_item.content_item, schema: :article %> + <%= render "govuk_publishing_components/components/machine_readable_metadata", content_item: @content_item.content_item, schema: :article %> <% end %> <% content_for :phase_message do %> - <%= render 'shared/custom_phase_message', phase: @content_item.phase %> + <%= render "shared/custom_phase_message", phase: @content_item.phase %> <% end %> -<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: @content_item.breadcrumbs %> +
    + <%= render "govuk_publishing_components/components/breadcrumbs", breadcrumbs: @content_item.breadcrumbs %> - -
    + +
    -
    - -
    +
    +
    -
    + <%= render "govuk_publishing_components/components/title", { + context: @content_item.category_title, + title: @content_item.title, + margin_bottom: 8 + } %> + <% if @content_item.show_description? %> +

    + <%= @content_item.description %> +

    + <% end %> +
    +
    -
    +

    - <%= link_to "Give feedback about this page", "/contact/govuk", class: "feedback" %> + <%= link_to "Give feedback about this page", "/contact/govuk", class: "govuk-link" %>

    -
    - - -
    -
    - -
    -
    - - -
    -

    Page contents:

    - -
    - -
    -
    +
    +
    + +
    +

    Page contents:

    +
      + <% @content_item.header_links.each do |header_link| %> +
    • <%= link_to(header_link[:title], header_link[:href], class: 'govuk-link') %>
    • + <% end %> +
    +
    -
    - <%= render 'govuk_publishing_components/components/govspeak', content: @content_item.body.html_safe %>
    +
    +
    + <%= render "govuk_publishing_components/components/govspeak", content: @content_item.body.html_safe %> +
    -
    -
    -
    - <% if @content_item.content_owners.any? %> -
    Published by:
    - <% @content_item.content_owners.each do |content_owner| %> -
    - <%= link_to content_owner.title, content_owner.href %> -
    +
    +
    + <% if @content_item.content_owners.any? %> + <%= render "govuk_publishing_components/components/metadata", { + last_updated: time_ago_in_words(@content_item.visible_updated_at), + from: @content_item.content_owners.map { |content_owner| + link_to(content_owner.title, content_owner.href) + } + } %> <% end %> + <% if @content_item.latest_change.present? %> +
    +
    Last update:
    +
    + <%= render partial: 'shared/change_history', locals: {change: @content_item.latest_change} %> +
    +
    + <% end %> +
    + <% if @content_item.previous_changes.present? %> +

    + +

    +
      + <% @content_item.previous_changes.each do |previous_change| %> +
    1. + <%= render partial: 'shared/change_history', locals: { change: previous_change, compressed: true} %> +
    2. + <% end %> +
    <% end %> - <% if @content_item.latest_change.present? %> -
    Last update:
    -
    - <%= render partial: 'shared/change_history', locals: {change: @content_item.latest_change} %> -
    - <% end %> -
    - <% if @content_item.previous_changes.present? %> -

    -
      - <% @content_item.previous_changes.each do |previous_change| %> -
    1. - <%= render partial: 'shared/change_history', locals: {change: previous_change} %> -
    2. - <% end %> -
    - <% end %>
    -
    diff --git a/app/views/content_items/homepage.html.erb b/app/views/content_items/homepage.html.erb index 2f2df9f2..83ca4368 100644 --- a/app/views/content_items/homepage.html.erb +++ b/app/views/content_items/homepage.html.erb @@ -3,64 +3,66 @@ content_for :phase_message do render 'shared/custom_phase_message_homepage', phase: @content_item.phase end - content_for :body_classes, 'full-width' + content_for :body_classes, 'app-full-width' %> -
    -
    -
    -
    -

    Service Manual

    - -

    - Helping teams to create and run great public services that meet the <%= link_to 'Service Standard', '/service-manual/service-standard' %>. -

    - -