govuk_publishing_components 27.12.0 → 27.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +24 -3
- data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +24 -8
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +1 -0
- data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +48 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +96 -83
- data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +9 -0
- data/app/views/govuk_publishing_components/components/_big_number.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_search.html.erb +25 -9
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +13 -17
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -6
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +7 -0
- data/app/views/govuk_publishing_components/components/docs/search.yml +25 -0
- data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml +21 -3
- data/config/locales/en.yml +2 -4
- data/lib/govuk_publishing_components/presenters/button_helper.rb +1 -0
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +4 -4
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +37 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -0
- metadata +4 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_summary.scss +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07e0c548e46fc4a7dcb04e7f2838f17b7fc6234804695cfbeca50d1aec4f4431
|
4
|
+
data.tar.gz: 33b0e798aed35a5ab8808ad6b6e0ee99a929c6d2b8da837d6acb156cf66d4f2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b48854f3ab1990a2166fbef3f8e57f2487778b7c9df6a0327e05318821b978ba3ef21f0a0865c6cc3cb714d0bff8a3fd6e102cd855fa1b28b78c32d66d92f0a0
|
7
|
+
data.tar.gz: 7bb47453cfc2208ffe22cb79c6493d85720a137b405709a545b3a6a6f37ee59e05b953a59c8cd067d2661038d3dbe323950b6662378ee24ee1ae8c14e98dbcd0
|
@@ -31,9 +31,21 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
31
31
|
return
|
32
32
|
}
|
33
33
|
|
34
|
+
this.trackType = this.$module.getAttribute('data-track-type')
|
35
|
+
var trackHeadings = this.$module.getAttribute('data-track-headings')
|
36
|
+
if (trackHeadings) {
|
37
|
+
try {
|
38
|
+
this.config.trackHeadings = JSON.parse(trackHeadings)
|
39
|
+
} catch (e) {
|
40
|
+
// if there's a problem with the config, don't start the tracker
|
41
|
+
console.error('Scroll tracker configuration error: ' + e.message, window.location)
|
42
|
+
window.GOVUK.analyticsVars.scrollTrackerStarted = false
|
43
|
+
return
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
34
47
|
window.GOVUK.analyticsVars.scrollTrackerStarted = true
|
35
48
|
|
36
|
-
this.trackType = this.$module.getAttribute('data-track-type')
|
37
49
|
if (this.trackType === 'headings') {
|
38
50
|
this.track = new AutoScrollTracker.Heading(this.config)
|
39
51
|
} else {
|
@@ -145,15 +157,24 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
145
157
|
|
146
158
|
// check heading is inside allowed elements, generally ignores everything outside of page content
|
147
159
|
AutoScrollTracker.Heading.prototype.findAllowedHeadings = function () {
|
148
|
-
var headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
|
149
160
|
var headingsFound = []
|
161
|
+
var headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
|
162
|
+
var trackHeadings = this.config.trackHeadings
|
150
163
|
|
164
|
+
// this is a loop that only happens once as we currently only have one
|
165
|
+
// allowed element for headings to be in - 'main'
|
151
166
|
for (var h = 0; h < this.config.allowHeadingsInside.length; h++) {
|
152
167
|
var insideElements = document.querySelectorAll(this.config.allowHeadingsInside[h])
|
153
168
|
for (var e = 0; e < insideElements.length; e++) {
|
154
169
|
var found = insideElements[e].querySelectorAll(headings)
|
155
170
|
for (var f = 0; f < found.length; f++) {
|
156
|
-
|
171
|
+
if (trackHeadings) {
|
172
|
+
if (trackHeadings.includes(found[f].textContent.trim())) {
|
173
|
+
headingsFound.push(found[f])
|
174
|
+
}
|
175
|
+
} else {
|
176
|
+
headingsFound.push(found[f])
|
177
|
+
}
|
157
178
|
}
|
158
179
|
}
|
159
180
|
}
|
data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js
CHANGED
@@ -10,12 +10,18 @@
|
|
10
10
|
|
11
11
|
var cookieBannerEngaged = GOVUK.cookie('cookies_preferences_set')
|
12
12
|
|
13
|
-
// If not engaged, append only ?
|
14
|
-
// If engaged and rejected, append only ?
|
15
|
-
// If engaged and accepted usage, append ?_ga=clientid if available and
|
13
|
+
// If not engaged, append only ?cookie_consent=not-engaged
|
14
|
+
// If engaged and rejected, append only ?cookie_consent=reject
|
15
|
+
// If engaged and accepted usage, append ?_ga=clientid if available and cookie_consent=accept
|
16
16
|
|
17
17
|
if (cookieBannerEngaged !== 'true') {
|
18
18
|
this.decorate(element, 'cookie_consent=not-engaged')
|
19
|
+
this.start = this.start.bind(this, $module)
|
20
|
+
|
21
|
+
// if the user has not engaged with the cookie banner yet, listen for the cookie consent accept/reject events
|
22
|
+
// re-start the module if cookies are accepted or rejected on the current page – setting cookie preferences does not reload the page
|
23
|
+
window.addEventListener('cookie-consent', this.start)
|
24
|
+
window.addEventListener('cookie-reject', this.start)
|
19
25
|
return
|
20
26
|
}
|
21
27
|
var cookieConsent = GOVUK.getConsentCookie()
|
@@ -50,6 +56,8 @@
|
|
50
56
|
this.decorate = function (element, param) {
|
51
57
|
var attribute = 'href'
|
52
58
|
var attributeValue = element.getAttribute(attribute)
|
59
|
+
var cookieConsentParameterPattern = /cookie_consent=[^&]*/
|
60
|
+
var paramIsCookieConsent = param.match(cookieConsentParameterPattern)
|
53
61
|
|
54
62
|
if (!attributeValue) {
|
55
63
|
attribute = 'action'
|
@@ -58,13 +66,21 @@
|
|
58
66
|
|
59
67
|
if (!attributeValue) { return }
|
60
68
|
|
61
|
-
|
62
|
-
|
63
|
-
|
69
|
+
var attributeHasCookieConsent = attributeValue.match(cookieConsentParameterPattern)
|
70
|
+
|
71
|
+
if (attributeHasCookieConsent && paramIsCookieConsent) {
|
72
|
+
// if the decorate function has received a cookie_consent parameter, but the target element already has a cookie_consent parameter, replace the existing parameter with the new value
|
73
|
+
attributeValue = attributeValue.replace(cookieConsentParameterPattern, param)
|
64
74
|
} else {
|
65
|
-
|
66
|
-
|
75
|
+
// otherwise, simply append the parameter to the target element href query string
|
76
|
+
if (attributeValue.includes('?')) {
|
77
|
+
attributeValue += '&' + param
|
78
|
+
} else {
|
79
|
+
attributeValue += '?' + param
|
80
|
+
}
|
67
81
|
}
|
82
|
+
|
83
|
+
element.setAttribute(attribute, attributeValue)
|
68
84
|
}
|
69
85
|
}
|
70
86
|
|
@@ -97,6 +97,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
97
97
|
this.$module.cookieBannerConfirmationMessage.focus()
|
98
98
|
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
99
99
|
window.GOVUK.setDefaultConsentCookie()
|
100
|
+
window.GOVUK.triggerEvent(window, 'cookie-reject')
|
100
101
|
}
|
101
102
|
|
102
103
|
CookieBanner.prototype.showConfirmationMessage = function () {
|
data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js
CHANGED
@@ -102,7 +102,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
102
102
|
// either `desktop` or `mobile` so it can be interpolated to access the
|
103
103
|
// `data-toggle-{desktop|mobile}-group` attribute.
|
104
104
|
var windowSize = function () {
|
105
|
-
return
|
105
|
+
return document.documentElement.clientWidth >= SETTINGS.breakpoint.desktop ? 'desktop' : 'mobile'
|
106
106
|
}
|
107
107
|
|
108
108
|
function SuperNavigationMegaMenu ($module) {
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/* global XMLHttpRequest */
|
2
|
+
window.GOVUK = window.GOVUK || {}
|
3
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
4
|
+
|
5
|
+
(function (Modules) {
|
6
|
+
function SinglePageNotificationButton ($module) {
|
7
|
+
this.$module = $module
|
8
|
+
this.basePath = this.$module.querySelector('input[name="base_path"]').value
|
9
|
+
this.buttonLocation = this.$module.getAttribute('data-button-location')
|
10
|
+
|
11
|
+
this.personalisationEndpoint = '/api/personalisation/check-email-subscription?base_path=' + this.basePath
|
12
|
+
// This attribute is passed through to the personalisation API to ensure the updated button has the same button_location for analytics
|
13
|
+
if (this.buttonLocation) this.personalisationEndpoint += '&button_location=' + this.buttonLocation
|
14
|
+
}
|
15
|
+
|
16
|
+
SinglePageNotificationButton.prototype.init = function () {
|
17
|
+
var xhr = new XMLHttpRequest()
|
18
|
+
xhr.open('GET', this.personalisationEndpoint, true)
|
19
|
+
|
20
|
+
xhr.onreadystatechange = function () {
|
21
|
+
if (xhr.readyState === 4 && xhr.status === 200) {
|
22
|
+
var responseText = xhr.responseText
|
23
|
+
// if response text exists and is JSON parse-able, parse the response and get the button html
|
24
|
+
if (responseText && this.responseIsJSON(responseText)) {
|
25
|
+
var newButton = JSON.parse(responseText).button_html
|
26
|
+
var html = document.createElement('div')
|
27
|
+
html.innerHTML = newButton
|
28
|
+
// test that the html returned contains the button component; if yes, swap the button for the updated version
|
29
|
+
var responseButtonContainer = html.querySelector('form.gem-c-single-page-notification-button')
|
30
|
+
if (responseButtonContainer) {
|
31
|
+
this.$module.parentNode.replaceChild(responseButtonContainer, this.$module)
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}.bind(this)
|
36
|
+
xhr.send()
|
37
|
+
}
|
38
|
+
|
39
|
+
SinglePageNotificationButton.prototype.responseIsJSON = function (string) {
|
40
|
+
try {
|
41
|
+
JSON.parse(string)
|
42
|
+
} catch (e) {
|
43
|
+
return false
|
44
|
+
}
|
45
|
+
return true
|
46
|
+
}
|
47
|
+
Modules.SinglePageNotificationButton = SinglePageNotificationButton
|
48
|
+
})(window.GOVUK.Modules)
|
@@ -134,7 +134,7 @@ $search-width-or-height: $black-bar-height;
|
|
134
134
|
background: none;
|
135
135
|
bottom: 0;
|
136
136
|
content: " ";
|
137
|
-
height:
|
137
|
+
height: 3px;
|
138
138
|
left: govuk-spacing(3);
|
139
139
|
position: absolute;
|
140
140
|
right: govuk-spacing(3);
|
@@ -284,7 +284,7 @@ $search-width-or-height: $black-bar-height;
|
|
284
284
|
font-size: govuk-px-to-rem(19px);
|
285
285
|
}
|
286
286
|
font-weight: bold;
|
287
|
-
margin: govuk-spacing(3) 0
|
287
|
+
margin: govuk-spacing(3) 0;
|
288
288
|
|
289
289
|
@include govuk-media-query($from: "desktop") {
|
290
290
|
display: block;
|
@@ -480,7 +480,7 @@ $search-width-or-height: $black-bar-height;
|
|
480
480
|
&.gem-c-layout-super-navigation-header__open-button {
|
481
481
|
@include focus-not-focus-visible {
|
482
482
|
&:before {
|
483
|
-
@include prefixed-transform($rotate: 225deg, $translateY:
|
483
|
+
@include prefixed-transform($rotate: 225deg, $translateY: 1px);
|
484
484
|
}
|
485
485
|
}
|
486
486
|
|
@@ -617,6 +617,7 @@ $search-width-or-height: $black-bar-height;
|
|
617
617
|
cursor: pointer;
|
618
618
|
height: $black-bar-height;
|
619
619
|
padding: 0;
|
620
|
+
margin: 0;
|
620
621
|
position: absolute;
|
621
622
|
right: (($search-width-or-height - govuk-spacing(3)) - 1px); // width of the search button (50px) - 15px - 1px to create an overlap between buttons and stop the border appearing to hang off the buttons when they're focused/open
|
622
623
|
top: 0;
|
@@ -656,6 +657,10 @@ $search-width-or-height: $black-bar-height;
|
|
656
657
|
}
|
657
658
|
}
|
658
659
|
|
660
|
+
&:after {
|
661
|
+
@include pseudo-underline;
|
662
|
+
}
|
663
|
+
|
659
664
|
// Open button modifier
|
660
665
|
&.gem-c-layout-super-navigation-header__open-button {
|
661
666
|
// stylelint-disable max-nesting-depth
|
@@ -663,6 +668,10 @@ $search-width-or-height: $black-bar-height;
|
|
663
668
|
@include govuk-focused-text;
|
664
669
|
box-shadow: none;
|
665
670
|
|
671
|
+
&:after {
|
672
|
+
background-color: $govuk-focus-colour;
|
673
|
+
}
|
674
|
+
|
666
675
|
.gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
|
667
676
|
color: govuk-colour("black");
|
668
677
|
border-color: $govuk-focus-colour;
|
@@ -670,7 +679,7 @@ $search-width-or-height: $black-bar-height;
|
|
670
679
|
@include govuk-media-query($from: 360px) {
|
671
680
|
&:before {
|
672
681
|
@include chevron(govuk-colour("black"), true);
|
673
|
-
@include prefixed-transform($rotate: 225deg, $translateY:
|
682
|
+
@include prefixed-transform($rotate: 225deg, $translateY: 1px);
|
674
683
|
}
|
675
684
|
}
|
676
685
|
}
|
@@ -679,14 +688,18 @@ $search-width-or-height: $black-bar-height;
|
|
679
688
|
@include focus-not-focus-visible {
|
680
689
|
background: govuk-colour("light-grey");
|
681
690
|
|
691
|
+
&:after {
|
692
|
+
background-color: $govuk-link-colour;
|
693
|
+
}
|
694
|
+
|
682
695
|
.gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
|
683
|
-
color: govuk-colour
|
696
|
+
color: $govuk-link-colour;
|
684
697
|
border-color: govuk-colour("light-grey");
|
685
698
|
|
686
699
|
@include govuk-media-query($from: 360px) {
|
687
700
|
&:before {
|
688
|
-
@include chevron(govuk-colour
|
689
|
-
@include prefixed-transform($rotate: 225deg, $translateY:
|
701
|
+
@include chevron($govuk-link-colour);
|
702
|
+
@include prefixed-transform($rotate: 225deg, $translateY: 1px);
|
690
703
|
}
|
691
704
|
}
|
692
705
|
}
|
@@ -825,96 +838,57 @@ $search-width-or-height: $black-bar-height;
|
|
825
838
|
|
826
839
|
// Dropdown menu items.
|
827
840
|
.gem-c-layout-super-navigation-header__dropdown-list-item {
|
828
|
-
|
829
|
-
padding: govuk-spacing(
|
841
|
+
box-sizing: border-box;
|
842
|
+
padding: 0 0 govuk-spacing(4) 0;
|
830
843
|
position: relative;
|
831
|
-
|
832
|
-
@include govuk-media-query($from: "desktop") {
|
833
|
-
margin: 0;
|
834
|
-
padding: govuk-spacing(2) 0;
|
835
|
-
}
|
836
844
|
}
|
837
845
|
|
838
846
|
// Navigation menu items.
|
839
847
|
.gem-c-layout-super-navigation-header__navigation-second-items {
|
840
|
-
|
841
|
-
|
848
|
+
list-style: none;
|
849
|
+
margin: 0;
|
850
|
+
padding: govuk-spacing(6) govuk-spacing(4);
|
851
|
+
|
852
|
+
& > li {
|
853
|
+
margin: 0;
|
854
|
+
}
|
842
855
|
|
843
856
|
@include govuk-media-query($from: "desktop") {
|
844
|
-
margin
|
845
|
-
|
846
|
-
padding: govuk-spacing(6) 0 govuk-spacing(8) 0;
|
857
|
+
margin: 0 (0 - govuk-spacing(3));
|
858
|
+
padding: govuk-spacing(7) 0 govuk-spacing(8) 0;
|
847
859
|
|
848
860
|
& > li {
|
849
|
-
|
850
|
-
margin: 0 govuk-spacing(3) govuk-spacing(2) govuk-spacing(3);
|
861
|
+
margin: 0 govuk-spacing(3);
|
851
862
|
}
|
852
863
|
}
|
853
864
|
}
|
854
865
|
|
855
866
|
.gem-c-layout-super-navigation-header__navigation-second-items--topics {
|
856
867
|
@include govuk-media-query($from: "desktop") {
|
857
|
-
@include columns(
|
858
|
-
@include columns-children(
|
868
|
+
@include columns(17, 2, "li");
|
869
|
+
@include columns-children(17, 2, "li");
|
859
870
|
}
|
860
871
|
}
|
861
872
|
|
862
873
|
.gem-c-layout-super-navigation-header__navigation-second-items--government-activity {
|
863
|
-
& > li:first-child {
|
864
|
-
margin-bottom: govuk-spacing(7);
|
865
|
-
}
|
866
|
-
|
867
874
|
@include govuk-media-query($from: "desktop") {
|
868
|
-
@include columns(
|
875
|
+
@include columns(6, 2, "li");
|
876
|
+
@include columns-children(6, 2, "li");
|
869
877
|
padding-bottom: 0;
|
870
878
|
|
871
|
-
& > li
|
872
|
-
|
873
|
-
|
874
|
-
}
|
875
|
-
|
876
|
-
@supports (display: grid) {
|
877
|
-
& > li:first-child {
|
878
|
-
grid-column: span 2;
|
879
|
-
}
|
880
|
-
}
|
881
|
-
|
882
|
-
& > li:first-child {
|
883
|
-
border-bottom: 1px solid $govuk-border-colour;
|
884
|
-
padding-bottom: 0;
|
885
|
-
-ms-grid-column-span: 2;
|
886
|
-
-ms-grid-column: 1;
|
887
|
-
-ms-grid-row: 1;
|
888
|
-
}
|
889
|
-
|
890
|
-
& > li:nth-child(2) {
|
891
|
-
-ms-grid-column: 1;
|
892
|
-
-ms-grid-row: 2;
|
893
|
-
}
|
894
|
-
|
895
|
-
& > li:nth-child(3) {
|
896
|
-
-ms-grid-column: 1;
|
897
|
-
-ms-grid-row: 3;
|
898
|
-
}
|
899
|
-
|
900
|
-
& > li:nth-child(4) {
|
901
|
-
-ms-grid-column: 1;
|
902
|
-
-ms-grid-row: 4;
|
903
|
-
}
|
904
|
-
|
905
|
-
& > li:nth-child(5) {
|
906
|
-
-ms-grid-column: 2;
|
907
|
-
-ms-grid-row: 2;
|
908
|
-
}
|
909
|
-
|
910
|
-
& > li:nth-child(6) {
|
911
|
-
-ms-grid-column: 2;
|
912
|
-
-ms-grid-row: 3;
|
879
|
+
& > li {
|
880
|
+
box-sizing: border-box;
|
881
|
+
padding-bottom: govuk-spacing(4);
|
913
882
|
}
|
914
883
|
}
|
915
884
|
}
|
916
885
|
|
917
886
|
.gem-c-layout-super-navigation-header__navigation-second-item-link {
|
887
|
+
font-size: 16px;
|
888
|
+
@if $govuk-typography-use-rem {
|
889
|
+
font-size: govuk-px-to-rem(16px);
|
890
|
+
}
|
891
|
+
|
918
892
|
&:after {
|
919
893
|
@include make-selectable-area-bigger;
|
920
894
|
}
|
@@ -930,9 +904,11 @@ $search-width-or-height: $black-bar-height;
|
|
930
904
|
}
|
931
905
|
|
932
906
|
.gem-c-layout-super-navigation-header__navigation-second-item-link--with-description {
|
933
|
-
|
934
|
-
|
935
|
-
|
907
|
+
font-size: 16px;
|
908
|
+
@if $govuk-typography-use-rem {
|
909
|
+
font-size: govuk-px-to-rem(16px);
|
910
|
+
}
|
911
|
+
font-weight: bold;
|
936
912
|
}
|
937
913
|
|
938
914
|
// Dropdown menu footer links.
|
@@ -944,28 +920,31 @@ $search-width-or-height: $black-bar-height;
|
|
944
920
|
|
945
921
|
.gem-c-layout-super-navigation-header__navigation-second-footer-list {
|
946
922
|
list-style: none;
|
947
|
-
padding: 0 0 govuk-spacing(8)
|
923
|
+
padding: 0 0 govuk-spacing(8) govuk-spacing(4);
|
948
924
|
|
949
925
|
@include govuk-media-query($from: "desktop") {
|
950
|
-
margin: 0 (0 - govuk-spacing(3)) 0 (0 - govuk-spacing(3));
|
951
|
-
padding: govuk-spacing(8) 0 govuk-spacing(9) 0;
|
952
926
|
@include columns(2, 2, "li");
|
953
927
|
@include columns-children(2, 2, "li");
|
928
|
+
margin: 0 (0 - govuk-spacing(3));
|
929
|
+
padding: govuk-spacing(6) 0 govuk-spacing(7) 0;
|
954
930
|
}
|
955
931
|
}
|
956
932
|
|
957
933
|
.gem-c-layout-super-navigation-header__navigation-second-footer-item {
|
958
|
-
padding: govuk-spacing(2) 0
|
934
|
+
padding: govuk-spacing(2) 0;
|
959
935
|
position: relative;
|
960
936
|
|
961
937
|
@include govuk-media-query($from: "desktop") {
|
962
|
-
padding: 0 govuk-spacing(3)
|
938
|
+
padding: 0 govuk-spacing(3);
|
963
939
|
}
|
964
940
|
}
|
965
941
|
|
966
942
|
.gem-c-layout-super-navigation-header__navigation-second-footer-link {
|
967
|
-
@include govuk-font($size: 19, $weight: normal);
|
968
943
|
display: inline-block;
|
944
|
+
font-size: 16px;
|
945
|
+
@if $govuk-typography-use-rem {
|
946
|
+
font-size: govuk-px-to-rem(16px);
|
947
|
+
}
|
969
948
|
margin: govuk-spacing(1) 0;
|
970
949
|
|
971
950
|
&:after {
|
@@ -974,11 +953,23 @@ $search-width-or-height: $black-bar-height;
|
|
974
953
|
|
975
954
|
@include govuk-media-query($from: "desktop") {
|
976
955
|
display: inline;
|
977
|
-
font-weight: bold;
|
978
956
|
padding: 0;
|
957
|
+
|
958
|
+
&:after {
|
959
|
+
content: none;
|
960
|
+
}
|
979
961
|
}
|
980
962
|
}
|
981
963
|
|
964
|
+
.gem-c-layout-super-navigation-header__navigation-second-item-description {
|
965
|
+
font-size: 16px;
|
966
|
+
@if $govuk-typography-use-rem {
|
967
|
+
font-size: govuk-px-to-rem(16px);
|
968
|
+
}
|
969
|
+
font-weight: normal;
|
970
|
+
margin: govuk-spacing(1) 0 0 0;
|
971
|
+
}
|
972
|
+
|
982
973
|
// Search dropdown.
|
983
974
|
.gem-c-layout-super-navigation-header__search-items {
|
984
975
|
background: govuk-colour("light-grey");
|
@@ -1004,12 +995,34 @@ $search-width-or-height: $black-bar-height;
|
|
1004
995
|
}
|
1005
996
|
|
1006
997
|
// Popular links.
|
998
|
+
.gem-c-layout-super-navigation-header__popular-item {
|
999
|
+
position: relative;
|
1000
|
+
padding: govuk-spacing(1) 0;
|
1001
|
+
}
|
1002
|
+
|
1007
1003
|
.gem-c-layout-super-navigation-header__popular-link {
|
1008
|
-
padding: govuk-spacing(2) 0;
|
1009
1004
|
display: inline-block;
|
1005
|
+
font-size: 16px;
|
1006
|
+
@if $govuk-typography-use-rem {
|
1007
|
+
font-size: govuk-px-to-rem(16px);
|
1008
|
+
}
|
1009
|
+
padding: 0;
|
1010
|
+
|
1011
|
+
&:after {
|
1012
|
+
@include make-selectable-area-bigger;
|
1013
|
+
}
|
1010
1014
|
|
1011
1015
|
@include govuk-media-query($from: "desktop") {
|
1012
|
-
|
1013
|
-
|
1016
|
+
&:after {
|
1017
|
+
content: none;
|
1018
|
+
}
|
1019
|
+
}
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
// To be used with .govuk-width-container - we only need the margins from
|
1023
|
+
// desktop onwards.
|
1024
|
+
.gem-c-layout-super-navigation-header__width-container {
|
1025
|
+
@include govuk-media-query($until: "desktop") {
|
1026
|
+
margin: 0;
|
1014
1027
|
}
|
1015
1028
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
margin-bottom: govuk-spacing(3);
|
3
3
|
|
4
4
|
@include govuk-media-query($from: tablet) {
|
5
|
-
margin-bottom: govuk-spacing(
|
5
|
+
margin-bottom: govuk-spacing(7);
|
6
6
|
}
|
7
7
|
}
|
8
8
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
margin-top: govuk-spacing(3);
|
11
11
|
|
12
12
|
@include govuk-media-query($from: tablet) {
|
13
|
-
margin-top: govuk-spacing(
|
13
|
+
margin-top: govuk-spacing(7);
|
14
14
|
}
|
15
15
|
}
|
16
16
|
|
@@ -17,3 +17,12 @@ $gem-quiet-button-colour: govuk-colour("dark-grey", $legacy: "grey-1");
|
|
17
17
|
$gem-quiet-button-hover-colour: darken($gem-quiet-button-colour, 5%);
|
18
18
|
|
19
19
|
$gem-hover-dark-background: #dddcdb;
|
20
|
+
|
21
|
+
$govuk-colours-organisations: map-merge(
|
22
|
+
$govuk-colours-organisations,
|
23
|
+
(
|
24
|
+
"department-for-levelling-up-housing-and-communities": (
|
25
|
+
colour: #012169,
|
26
|
+
),
|
27
|
+
)
|
28
|
+
);
|
data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb
CHANGED
@@ -133,7 +133,7 @@
|
|
133
133
|
class="gem-c-layout-super-navigation-header__navigation-dropdown-menu"
|
134
134
|
id="super-navigation-menu__section-<%= unique_id %>"
|
135
135
|
>
|
136
|
-
<div class="govuk-width-container">
|
136
|
+
<div class="govuk-width-container gem-c-layout-super-navigation-header__width-container">
|
137
137
|
<div class="govuk-grid-row">
|
138
138
|
<div class="govuk-grid-column-one-third-from-desktop">
|
139
139
|
<% if link[:description].present? %>
|
@@ -144,7 +144,7 @@
|
|
144
144
|
</div>
|
145
145
|
<div class="govuk-grid-column-two-thirds-from-desktop">
|
146
146
|
<% if link[:menu_contents].present? %>
|
147
|
-
<ul class="
|
147
|
+
<ul class="gem-c-layout-super-navigation-header__navigation-second-items gem-c-layout-super-navigation-header__navigation-second-items--<%= link[:label].parameterize %>">
|
148
148
|
<% link[:menu_contents].each do | item | %>
|
149
149
|
<%
|
150
150
|
has_description = item[:description].present?
|
@@ -163,7 +163,7 @@
|
|
163
163
|
track_dimension_index: "29",
|
164
164
|
}
|
165
165
|
} %>
|
166
|
-
<%= tag.p item[:description], class: "
|
166
|
+
<%= tag.p item[:description], class: "gem-c-layout-super-navigation-header__navigation-second-item-description" if has_description %>
|
167
167
|
</li>
|
168
168
|
<% end %>
|
169
169
|
</ul>
|
@@ -11,9 +11,11 @@
|
|
11
11
|
direction_class = ""
|
12
12
|
direction_class = " direction-#{direction}" if local_assigns.include?(:direction)
|
13
13
|
|
14
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
14
15
|
classes = %w(gem-c-metadata)
|
15
16
|
classes << "direction-#{direction}" if local_assigns.include?(:direction)
|
16
17
|
classes << "gem-c-metadata--inverse" if inverse
|
18
|
+
classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
|
17
19
|
%>
|
18
20
|
<%= content_tag :div, class: classes, data: { module: "gem-toggle" } do %>
|
19
21
|
<dl data-module="gem-track-click">
|
@@ -1,9 +1,12 @@
|
|
1
1
|
<%
|
2
2
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
3
|
+
heading_helper = GovukPublishingComponents::Presenters::HeadingHelper.new(local_assigns)
|
3
4
|
|
4
5
|
aria_controls ||= nil
|
5
6
|
button_text ||= t("components.search_box.search_button")
|
6
7
|
id ||= "search-main-" + SecureRandom.hex(4)
|
8
|
+
wrap_label_in_a_heading ||= false
|
9
|
+
label_margin_bottom ||= nil
|
7
10
|
label_size ||= nil
|
8
11
|
label_text ||= t("components.search_box.label")
|
9
12
|
name ||= "q"
|
@@ -14,13 +17,6 @@
|
|
14
17
|
data_attributes ||= {}
|
15
18
|
data_attributes[:module] = 'gem-track-click'
|
16
19
|
|
17
|
-
label_classes = []
|
18
|
-
if (shared_helper.valid_heading_size?(label_size))
|
19
|
-
label_classes << "govuk-label govuk-label--#{label_size}"
|
20
|
-
else
|
21
|
-
label_classes << "gem-c-search__label"
|
22
|
-
end
|
23
|
-
|
24
20
|
classes = %w[gem-c-search govuk-!-display-none-print]
|
25
21
|
classes << (shared_helper.get_margin_top)
|
26
22
|
classes << (shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
|
@@ -32,11 +28,31 @@
|
|
32
28
|
classes << "gem-c-search--on-white"
|
33
29
|
end
|
34
30
|
classes << "gem-c-search--separate-label" if local_assigns.include?(:inline_label) or local_assigns.include?(:label_size)
|
31
|
+
|
32
|
+
label_classes = []
|
33
|
+
if (shared_helper.valid_heading_size?(label_size))
|
34
|
+
label_classes << "govuk-label govuk-label--#{label_size}"
|
35
|
+
else
|
36
|
+
label_classes << "gem-c-search__label"
|
37
|
+
end
|
38
|
+
label_classes << "govuk-!-margin-bottom-#{label_margin_bottom}" if [*1..9].include?(label_margin_bottom) and local_assigns.include?(:inline_label)
|
39
|
+
|
40
|
+
tag_label = capture do
|
41
|
+
tag.label({ for: id, class: label_classes }) do
|
42
|
+
label_text
|
43
|
+
end
|
44
|
+
end
|
35
45
|
%>
|
36
46
|
|
37
47
|
<div class="<%= classes.join(" ") %>" data-module="gem-toggle-input-class-on-focus">
|
38
|
-
|
39
|
-
<%=
|
48
|
+
<% if wrap_label_in_a_heading %>
|
49
|
+
<%= content_tag(shared_helper.get_heading_level, {
|
50
|
+
class: "govuk-!-margin-0",
|
51
|
+
}) do %>
|
52
|
+
<%= tag_label %>
|
53
|
+
<% end %>
|
54
|
+
<% else %>
|
55
|
+
<%= tag_label %>
|
40
56
|
<% end %>
|
41
57
|
<div class="gem-c-search__item-wrapper">
|
42
58
|
<%= tag.input(
|
data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb
CHANGED
@@ -1,23 +1,19 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
data_attributes ||= {}
|
4
|
-
base_path ||= nil
|
5
|
-
local_assigns[:margin_bottom] ||= 3
|
6
|
-
already_subscribed ||= false
|
7
|
-
text ||= already_subscribed ? t('components.single_page_notification_button.unsubscribe_text') : t('components.single_page_notification_button.subscribe_text')
|
8
|
-
|
2
|
+
component_helper = GovukPublishingComponents::Presenters::SinglePageNotificationButtonHelper.new(local_assigns)
|
9
3
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
10
|
-
|
4
|
+
|
5
|
+
wrapper_classes = %w(govuk-!-display-none-print)
|
11
6
|
wrapper_classes << shared_helper.get_margin_bottom
|
12
|
-
classes = "govuk-body-s gem-c-single-page-notification-button__submit"
|
13
7
|
%>
|
14
8
|
<% button_text = capture do %>
|
15
|
-
<svg class="gem-c-single-page-notification-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z"/></svg><%=
|
9
|
+
<svg class="gem-c-single-page-notification-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z"/></svg><%= component_helper.button_text %>
|
16
10
|
<% end %>
|
17
|
-
<%= tag.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
11
|
+
<%= tag.div class: wrapper_classes, data: { module: "gem-track-click"} do %>
|
12
|
+
<%= tag.form class: "gem-c-single-page-notification-button", action: "/email/subscriptions/single-page/new", method: "POST", data: component_helper.data do %>
|
13
|
+
<input type="hidden" name="base_path" value="<%= component_helper.base_path %>">
|
14
|
+
<%= content_tag(:button, button_text, {
|
15
|
+
class: "govuk-body-s gem-c-single-page-notification-button__submit",
|
16
|
+
type: "submit",
|
17
|
+
}) %>
|
18
|
+
<% end %>
|
19
|
+
<% end if component_helper.base_path %>
|
@@ -357,3 +357,10 @@ examples:
|
|
357
357
|
Applies to: England, Scotland, and Wales (see detailed guidance for <a href="http://www.dardni.gov.uk/news-dard-pa022-a-13-new-procedure-for" rel="external">Northern Ireland</a>)
|
358
358
|
context:
|
359
359
|
dark_background: true
|
360
|
+
with_custom_margin_bottom:
|
361
|
+
description: |
|
362
|
+
The component accepts a number for margin bottom from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to the `margin-bottom` values defined in the [responsive-bottom-margin mixin](https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss#L1)
|
363
|
+
data:
|
364
|
+
first_published: 14 June 2014
|
365
|
+
last_updated: 10 September 2015
|
366
|
+
margin_bottom: 2
|
@@ -69,3 +69,28 @@ examples:
|
|
69
69
|
Allows the label text size to be set to `xl`, `l`, `m`, or `s`. If this is set, then `inline_label` is automatically set to `false`.
|
70
70
|
data:
|
71
71
|
label_size: "xl"
|
72
|
+
wrap_label_inside_a_heading:
|
73
|
+
description: |
|
74
|
+
Puts the label inside a heading; heading level defaults to 2 if not set.
|
75
|
+
|
76
|
+
(The size of the label can still be set with `label_size` to appear more like a heading.)
|
77
|
+
data:
|
78
|
+
wrap_label_in_a_heading: true
|
79
|
+
heading_level: 1
|
80
|
+
with_margin_bottom:
|
81
|
+
description: |
|
82
|
+
Allows the spacing at the bottom of the component to be adjusted.
|
83
|
+
|
84
|
+
This accepts a number from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to having no margin bottom.
|
85
|
+
data:
|
86
|
+
margin_bottom: 9
|
87
|
+
with_margin_bottom_for_the_label:
|
88
|
+
description: |
|
89
|
+
Allows the spacing between the label and the input be adjusted.
|
90
|
+
|
91
|
+
Requires `inline_label` to be false.
|
92
|
+
|
93
|
+
This accepts a number from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to having no margin bottom.
|
94
|
+
data:
|
95
|
+
label_margin_bottom: 9
|
96
|
+
inline_label: false
|
data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
name: Single page notification button
|
2
2
|
description: A button that subscribes the user to email notifications to a page
|
3
3
|
body: |
|
4
|
-
By default, the component displays with the "Get emails about this page" state.
|
4
|
+
By default, the component displays with the "Get emails about this page" state.
|
5
|
+
If the `js-enhancement` flag is present, the component uses JavaScript to check if the user has already subscribed to email notifications on the current page. If yes, the state of the component updates accordingly.
|
5
6
|
|
6
|
-
The `base_path` is necessary for [checking if an email subscription is active on page load](https://github.com/alphagov/account-api/blob/main/docs/api.md#get-apipersonalisationcheck-email-subscriptiontopic_slug) and the creation/deletion of an email notification subscription.
|
7
|
+
The component does not render without the `base_path` parameter. The `base_path` is necessary for [checking if an email subscription is active on page load](https://github.com/alphagov/account-api/blob/main/docs/api.md#get-apipersonalisationcheck-email-subscriptiontopic_slug) and the creation/deletion of an email notification subscription.
|
7
8
|
|
8
9
|
When the button is clicked, the `base_path` is submitted to an endpoint which proceeds to check the user's authentication status and whether they are already subscribed to the page or not. Depending on these factors, they will be routed accordingly.
|
9
10
|
accessibility_criteria: |
|
@@ -23,10 +24,27 @@ examples:
|
|
23
24
|
data:
|
24
25
|
base_path: '/current-page-path'
|
25
26
|
data_attributes:
|
26
|
-
|
27
|
+
test_attribute: "testing"
|
27
28
|
with_margin_bottom:
|
28
29
|
description: |
|
29
30
|
The component accepts a number for margin bottom from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to having a margin bottom of 15px.
|
30
31
|
data:
|
31
32
|
base_path: '/current-page-path'
|
32
33
|
margin_bottom: 5
|
34
|
+
with_js_enhancement:
|
35
|
+
description: |
|
36
|
+
If the `js-enhancement` flag is present, the component uses JavaScript to check if the user has already subscribed to email notifications on the current page. If yes, the state of the component updates accordingly.
|
37
|
+
data:
|
38
|
+
base_path: '/current-page-path'
|
39
|
+
js_enhancement: true
|
40
|
+
with_button_location:
|
41
|
+
description: |
|
42
|
+
When there is more than one button on a page, we should specify their location so that Analytics can differentiate between them.
|
43
|
+
|
44
|
+
The location should have one of two values: "top" or "bottom".
|
45
|
+
|
46
|
+
When this parameter is passed, its value is reflected in the `data-action` attribute (i.e "Unsubscribe-button-top"). When the flag is not present, `data-action` defaults to "Subscribe-button" or "Unsubscribe-button", depending on the state of the button.
|
47
|
+
data:
|
48
|
+
base_path: '/current-page-path'
|
49
|
+
js_enhancement: true
|
50
|
+
button_location: 'top'
|
data/config/locales/en.yml
CHANGED
@@ -87,7 +87,7 @@ en:
|
|
87
87
|
statistics: Statistics
|
88
88
|
worldwide: Worldwide
|
89
89
|
layout_footer:
|
90
|
-
copyright_html: <a class="govuk-footer__link govuk-footer__copyright-logo" href="
|
90
|
+
copyright_html: <a class="govuk-footer__link govuk-footer__copyright-logo" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">© Crown copyright</a>
|
91
91
|
licence_html: All content is available under the <a class="govuk-footer__link" href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence v3.0</a>, except where otherwise stated
|
92
92
|
support_links: Support links
|
93
93
|
layout_for_public:
|
@@ -125,8 +125,6 @@ en:
|
|
125
125
|
href: "/browse/benefits"
|
126
126
|
- label: Births, death, marriages and care
|
127
127
|
href: "/browse/births-deaths-marriages"
|
128
|
-
- label: Brexit
|
129
|
-
href: "/brexit"
|
130
128
|
- label: Business and self-employed
|
131
129
|
href: "/browse/business"
|
132
130
|
- label: Childcare and parenting
|
@@ -179,7 +177,7 @@ en:
|
|
179
177
|
description: Consultations and strategy
|
180
178
|
- label: Transparency
|
181
179
|
href: "/search/transparency-and-freedom-of-information-releases"
|
182
|
-
description:
|
180
|
+
description: Data, Freedom of Information releases and corporate reports
|
183
181
|
footer_links:
|
184
182
|
- label: How government works
|
185
183
|
href: "/government/how-government-works"
|
@@ -66,6 +66,7 @@ module GovukPublishingComponents
|
|
66
66
|
options[:name] = name if name.present? && value.present?
|
67
67
|
options[:value] = value if name.present? && value.present?
|
68
68
|
options[:aria] = { label: aria_label } if aria_label
|
69
|
+
options[:draggable] = false if link?
|
69
70
|
options
|
70
71
|
end
|
71
72
|
|
@@ -111,10 +111,10 @@ module GovukPublishingComponents
|
|
111
111
|
def show_brexit_related_links?
|
112
112
|
# If tagged directly to /brexit or /world/brexit
|
113
113
|
# Or if tagged to a taxon which has /brexit as a parent
|
114
|
-
# And is not the brexit
|
115
|
-
|
116
|
-
|
117
|
-
tagged_to_brexit?
|
114
|
+
# And is not the brexit hub pages
|
115
|
+
return false if brexit_hub_pages.include?(content_item["content_id"])
|
116
|
+
|
117
|
+
tagged_to_brexit?
|
118
118
|
end
|
119
119
|
|
120
120
|
def brexit_cta_document_exceptions
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class SinglePageNotificationButtonHelper
|
4
|
+
attr_reader :already_subscribed, :data_attributes, :base_path, :js_enhancement, :button_type, :button_location
|
5
|
+
|
6
|
+
def initialize(local_assigns)
|
7
|
+
@local_assigns = local_assigns
|
8
|
+
@data_attributes = @local_assigns[:data_attributes] || {}
|
9
|
+
@js_enhancement = @local_assigns[:js_enhancement] || false
|
10
|
+
@already_subscribed = @local_assigns[:already_subscribed] || false
|
11
|
+
@base_path = @local_assigns[:base_path] || nil
|
12
|
+
@button_location = button_location_is_valid? ? @local_assigns[:button_location] : nil
|
13
|
+
@button_type = @local_assigns[:already_subscribed] ? "Unsubscribe" : "Subscribe"
|
14
|
+
end
|
15
|
+
|
16
|
+
def data
|
17
|
+
@data_attributes[:track_label] = base_path
|
18
|
+
# data-action for tracking should have the format of e.g. "Unsubscribe-button-top", or "Subscribe-button-bottom"
|
19
|
+
# when button_location is not present data-action will fall back to "Unsubscribe-button"/"Subscribe-button"
|
20
|
+
@data_attributes[:track_action] = [button_type, "button", button_location].compact.join("-")
|
21
|
+
@data_attributes[:module] = "single-page-notification-button" if js_enhancement
|
22
|
+
@data_attributes[:track_category] = "Single-page-notification-button"
|
23
|
+
# This attribute is passed through to the personalisation API to ensure when a new button is returned from the API, it has the same button_location
|
24
|
+
@data_attributes[:button_location] = button_location
|
25
|
+
@data_attributes
|
26
|
+
end
|
27
|
+
|
28
|
+
def button_location_is_valid?
|
29
|
+
%w[bottom top].include? @local_assigns[:button_location]
|
30
|
+
end
|
31
|
+
|
32
|
+
def button_text
|
33
|
+
@already_subscribed ? I18n.t("components.single_page_notification_button.unsubscribe_text") : I18n.t("components.single_page_notification_button.subscribe_text")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -33,6 +33,7 @@ require "govuk_publishing_components/presenters/intervention_helper"
|
|
33
33
|
require "govuk_publishing_components/presenters/organisation_logo_helper"
|
34
34
|
require "govuk_publishing_components/presenters/highlight_boxes_helper"
|
35
35
|
require "govuk_publishing_components/presenters/taxonomy_list_helper"
|
36
|
+
require "govuk_publishing_components/presenters/single_page_notification_button_helper"
|
36
37
|
|
37
38
|
require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
|
38
39
|
require "govuk_publishing_components/app_helpers/table_helper"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 27.
|
4
|
+
version: 27.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -501,6 +501,7 @@ files:
|
|
501
501
|
- app/assets/javascripts/govuk_publishing_components/components/radio.js
|
502
502
|
- app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js
|
503
503
|
- app/assets/javascripts/govuk_publishing_components/components/show-password.js
|
504
|
+
- app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js
|
504
505
|
- app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
|
505
506
|
- app/assets/javascripts/govuk_publishing_components/components/tabs.js
|
506
507
|
- app/assets/javascripts/govuk_publishing_components/dependencies.js
|
@@ -624,7 +625,6 @@ files:
|
|
624
625
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss
|
625
626
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss
|
626
627
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss
|
627
|
-
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_summary.scss
|
628
628
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss
|
629
629
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss
|
630
630
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss
|
@@ -969,6 +969,7 @@ files:
|
|
969
969
|
- lib/govuk_publishing_components/presenters/schema_org.rb
|
970
970
|
- lib/govuk_publishing_components/presenters/select.rb
|
971
971
|
- lib/govuk_publishing_components/presenters/shared_helper.rb
|
972
|
+
- lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb
|
972
973
|
- lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
|
973
974
|
- lib/govuk_publishing_components/presenters/subscription_links_helper.rb
|
974
975
|
- lib/govuk_publishing_components/presenters/taxonomy_list_helper.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
.govspeak, // Legacy class name that's still used in some content items - needs to be kept until `.govspeak` is removed from the content items.
|
2
|
-
.gem-c-govspeak {
|
3
|
-
.summary {
|
4
|
-
margin: 0 0 2em;
|
5
|
-
padding: 0;
|
6
|
-
color: $govuk-text-colour;
|
7
|
-
|
8
|
-
p {
|
9
|
-
@include govuk-font($size: 19);
|
10
|
-
}
|
11
|
-
|
12
|
-
@include govuk-media-query($until: tablet) {
|
13
|
-
margin: 0 0 2em;
|
14
|
-
padding: 0;
|
15
|
-
}
|
16
|
-
|
17
|
-
p,
|
18
|
-
h2 {
|
19
|
-
border: 0;
|
20
|
-
margin: 0 .75em 0 0;
|
21
|
-
}
|
22
|
-
|
23
|
-
h2 {
|
24
|
-
line-height: 1.35em;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|