govuk_publishing_components 27.14.1 → 27.17.0
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/custom-dimensions.js +52 -26
- data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +25 -25
- data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +48 -31
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +10 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +12 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +8 -4
- data/app/views/govuk_publishing_components/components/_button.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +21 -4
- 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 +9 -7
- data/app/views/govuk_publishing_components/components/_success_alert.html.erb +4 -1
- data/app/views/govuk_publishing_components/components/docs/intervention.yml +11 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/radio.yml +40 -33
- data/app/views/govuk_publishing_components/components/docs/search.yml +25 -0
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +6 -0
- data/config/i18n-tasks.yml +8 -0
- data/config/locales/ar.yml +134 -131
- data/config/locales/az.yml +131 -131
- data/config/locales/be.yml +136 -130
- data/config/locales/bg.yml +135 -131
- data/config/locales/bn.yml +132 -131
- data/config/locales/cs.yml +136 -131
- data/config/locales/cy.yml +129 -125
- data/config/locales/da.yml +132 -131
- data/config/locales/de.yml +135 -131
- data/config/locales/dr.yml +133 -131
- data/config/locales/el.yml +131 -131
- data/config/locales/en.yml +13 -12
- data/config/locales/es-419.yml +131 -131
- data/config/locales/es.yml +131 -131
- data/config/locales/et.yml +134 -131
- data/config/locales/fa.yml +130 -131
- data/config/locales/fi.yml +133 -131
- data/config/locales/fr.yml +130 -130
- data/config/locales/gd.yml +133 -131
- data/config/locales/gu.yml +131 -131
- data/config/locales/he.yml +131 -131
- data/config/locales/hi.yml +131 -131
- data/config/locales/hr.yml +133 -131
- data/config/locales/hu.yml +134 -131
- data/config/locales/hy.yml +135 -131
- data/config/locales/id.yml +132 -131
- data/config/locales/is.yml +131 -131
- data/config/locales/it.yml +131 -131
- data/config/locales/ja.yml +128 -131
- data/config/locales/ka.yml +134 -131
- data/config/locales/kk.yml +131 -131
- data/config/locales/ko.yml +13 -17
- data/config/locales/lt.yml +136 -131
- data/config/locales/lv.yml +135 -131
- data/config/locales/ms.yml +131 -131
- data/config/locales/mt.yml +133 -131
- data/config/locales/nl.yml +131 -131
- data/config/locales/no.yml +131 -131
- data/config/locales/pa-pk.yml +128 -132
- data/config/locales/pa.yml +131 -131
- data/config/locales/pl.yml +135 -131
- data/config/locales/ps.yml +128 -131
- data/config/locales/pt.yml +131 -131
- data/config/locales/ro.yml +132 -131
- data/config/locales/ru.yml +135 -131
- data/config/locales/si.yml +131 -131
- data/config/locales/sk.yml +136 -131
- data/config/locales/sl.yml +138 -131
- data/config/locales/so.yml +131 -131
- data/config/locales/sq.yml +131 -131
- data/config/locales/sr.yml +133 -131
- data/config/locales/sv.yml +131 -131
- data/config/locales/sw.yml +131 -131
- data/config/locales/ta.yml +132 -131
- data/config/locales/th.yml +130 -131
- data/config/locales/tk.yml +132 -131
- data/config/locales/tr.yml +132 -131
- data/config/locales/uk.yml +138 -131
- data/config/locales/ur.yml +128 -131
- data/config/locales/uz.yml +133 -131
- data/config/locales/vi.yml +131 -131
- data/config/locales/zh-hk.yml +130 -131
- data/config/locales/zh-tw.yml +130 -131
- data/config/locales/zh.yml +130 -131
- data/lib/govuk_publishing_components/presenters/button_helper.rb +24 -0
- data/lib/govuk_publishing_components/presenters/intervention_helper.rb +20 -2
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +4 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d9ee129bde5e753f8180b3b8dfe7f2e4fe257558ac1a6fe40bb289242d849f2
|
4
|
+
data.tar.gz: 4c01bb1d55673a25eef1a408e5360da17b2d4e1a8dfc00291463ecc86dfcd81a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eac4c820f6c86caded7a9e994f1e9e15edbb6ab7fce003ae38f9919dcc6a23f3db7f9dfcd27e0204152e17daa35ccb741ce457b6c9c3c85a8ae51350362fe3c
|
7
|
+
data.tar.gz: b9e8068c2b0746134a37e21fefdd8cc6114055e133fa7240e801be587f34f8ff8a7dd218a71f34cda1fe8dce5c54da3109544d0775e103c2a90e9bec153cd018
|
@@ -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
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* global GOVUK
|
1
|
+
/* global GOVUK */
|
2
2
|
|
3
3
|
(function () {
|
4
4
|
'use strict'
|
@@ -7,11 +7,11 @@
|
|
7
7
|
|
8
8
|
CustomDimensions.getAndExtendDefaultTrackingOptions = function (extraOptions) {
|
9
9
|
var trackingOptions = this.customDimensions()
|
10
|
-
return
|
10
|
+
return this.extend(trackingOptions, extraOptions)
|
11
11
|
}
|
12
12
|
|
13
13
|
CustomDimensions.customDimensions = function () {
|
14
|
-
var dimensions =
|
14
|
+
var dimensions = this.extend(
|
15
15
|
{},
|
16
16
|
customDimensionsFromBrowser(),
|
17
17
|
customDimensionsFromMetaTags(),
|
@@ -19,9 +19,28 @@
|
|
19
19
|
abTestCustomDimensions()
|
20
20
|
)
|
21
21
|
|
22
|
-
|
23
|
-
dimensions[key] = new GOVUK.Analytics.PIISafe(String(
|
24
|
-
}
|
22
|
+
for (var key in dimensions) {
|
23
|
+
dimensions[key] = new GOVUK.Analytics.PIISafe(String(dimensions[key]))
|
24
|
+
}
|
25
|
+
return dimensions
|
26
|
+
}
|
27
|
+
|
28
|
+
CustomDimensions.extend = function (out) {
|
29
|
+
out = out || {}
|
30
|
+
|
31
|
+
for (var i = 1; i < arguments.length; i++) {
|
32
|
+
if (!arguments[i]) {
|
33
|
+
continue
|
34
|
+
}
|
35
|
+
|
36
|
+
for (var key in arguments[i]) {
|
37
|
+
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
|
38
|
+
out[key] = arguments[i][key]
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
return out
|
25
44
|
}
|
26
45
|
|
27
46
|
function customDimensionsFromBrowser () {
|
@@ -70,52 +89,59 @@
|
|
70
89
|
'spelling-suggestion': { dimension: 81 }
|
71
90
|
}
|
72
91
|
|
73
|
-
var
|
92
|
+
var metas = document.querySelectorAll("meta[name^='govuk']")
|
74
93
|
var customDimensions = {}
|
75
94
|
var tags = {}
|
76
95
|
|
77
|
-
|
78
|
-
var
|
79
|
-
var
|
80
|
-
|
81
|
-
var dimension = dimensionMappings[key]
|
96
|
+
for (var i = 0; i < metas.length; i++) {
|
97
|
+
var meta = metas[i]
|
98
|
+
var metaKey = meta.getAttribute('name').split('govuk:')[1]
|
99
|
+
var dimension = dimensionMappings[metaKey]
|
82
100
|
if (dimension) {
|
83
|
-
tags[
|
101
|
+
tags[metaKey] = meta.getAttribute('content')
|
84
102
|
}
|
85
|
-
}
|
103
|
+
}
|
86
104
|
|
87
|
-
|
88
|
-
var value = tags[key] ||
|
105
|
+
for (var key in dimensionMappings) {
|
106
|
+
var value = tags[key] || dimensionMappings[key].defaultValue
|
89
107
|
if (typeof value !== 'undefined') {
|
90
|
-
customDimensions['dimension' +
|
108
|
+
customDimensions['dimension' + dimensionMappings[key].dimension] = value
|
91
109
|
}
|
92
|
-
}
|
110
|
+
}
|
93
111
|
|
94
112
|
return customDimensions
|
95
113
|
}
|
96
114
|
|
97
115
|
function customDimensionsFromDom () {
|
116
|
+
var mainLang = document.getElementById('content')
|
117
|
+
if (mainLang) {
|
118
|
+
mainLang = mainLang.getAttribute('lang')
|
119
|
+
}
|
120
|
+
var globalBar = document.querySelector('[data-module="global-bar"]') || false
|
121
|
+
if (globalBar) {
|
122
|
+
globalBar = globalBar.style.display !== 'none'
|
123
|
+
}
|
98
124
|
return {
|
99
125
|
dimension26: GOVUK.PageContent.getNumberOfSections(),
|
100
126
|
dimension27: GOVUK.PageContent.getNumberOfLinks(),
|
101
|
-
dimension23:
|
102
|
-
dimension38:
|
127
|
+
dimension23: mainLang || 'unknown',
|
128
|
+
dimension38: globalBar && 'Global Banner viewed'
|
103
129
|
}
|
104
130
|
}
|
105
131
|
|
106
132
|
function abTestCustomDimensions () {
|
107
|
-
var
|
133
|
+
var abMetas = document.querySelectorAll("meta[name^='govuk:ab-test']")
|
108
134
|
var customDimensions = {}
|
109
135
|
|
110
|
-
|
111
|
-
var
|
112
|
-
var dimension = parseInt(
|
113
|
-
var testNameAndBucket =
|
136
|
+
for (var i = 0; i < abMetas.length; i++) {
|
137
|
+
var meta = abMetas[i]
|
138
|
+
var dimension = parseInt(meta.getAttribute('data-analytics-dimension'))
|
139
|
+
var testNameAndBucket = meta.getAttribute('content')
|
114
140
|
|
115
141
|
if (dimension) {
|
116
142
|
customDimensions['dimension' + dimension] = testNameAndBucket
|
117
143
|
}
|
118
|
-
}
|
144
|
+
}
|
119
145
|
|
120
146
|
return customDimensions
|
121
147
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
|
2
|
-
/* global GOVUK,
|
2
|
+
/* global GOVUK, ga */
|
3
3
|
|
4
4
|
(function () {
|
5
5
|
'use strict'
|
@@ -12,25 +12,25 @@
|
|
12
12
|
this.init = function (element) {
|
13
13
|
// Limiting to 100 characters to avoid noise from extra longs search queries
|
14
14
|
// and to stop the size of the payload going over 8k limit.
|
15
|
-
var searchQuery = GOVUK.analytics.stripPII(element.
|
16
|
-
var ecommerceRows = element.
|
17
|
-
var startPosition = parseInt(element.
|
18
|
-
var listTitle = element.
|
19
|
-
var variant = element.
|
20
|
-
var trackClickLabel = element.
|
21
|
-
|
22
|
-
ecommerceRows.
|
23
|
-
var
|
24
|
-
var listSubheading =
|
25
|
-
var contentId =
|
26
|
-
var path =
|
27
|
-
|
28
|
-
var indexOverride =
|
29
|
-
index = indexOverride ? parseInt(indexOverride, 10) - 1 :
|
15
|
+
var searchQuery = GOVUK.analytics.stripPII(element.getAttribute('data-search-query')).substring(0, 100).toLowerCase()
|
16
|
+
var ecommerceRows = element.querySelectorAll('[data-ecommerce-row]')
|
17
|
+
var startPosition = parseInt(element.getAttribute('data-ecommerce-start-index'), 10)
|
18
|
+
var listTitle = element.getAttribute('data-list-title') || DEFAULT_LIST_TITLE
|
19
|
+
var variant = element.getAttribute('data-ecommerce-variant') || undefined
|
20
|
+
var trackClickLabel = element.getAttribute('data-track-click-label') || DEFAULT_TRACK_CLICK_LABEL
|
21
|
+
|
22
|
+
for (var i = 0; i < ecommerceRows.length; i++) {
|
23
|
+
var ecommerceRow = ecommerceRows[i]
|
24
|
+
var listSubheading = ecommerceRow.getAttribute('data-ecommerce-subheading') || undefined
|
25
|
+
var contentId = ecommerceRow.getAttribute('data-ecommerce-content-id') || undefined
|
26
|
+
var path = ecommerceRow.getAttribute('data-ecommerce-path')
|
27
|
+
|
28
|
+
var indexOverride = ecommerceRow.getAttribute('data-ecommerce-index')
|
29
|
+
var index = indexOverride ? parseInt(indexOverride, 10) - 1 : i
|
30
30
|
|
31
31
|
addImpression(contentId, path, index + startPosition, searchQuery, listTitle, listSubheading, variant)
|
32
|
-
trackProductOnClick(
|
33
|
-
}
|
32
|
+
trackProductOnClick(ecommerceRow, contentId, path, index + startPosition, searchQuery, listTitle, listSubheading, variant, trackClickLabel)
|
33
|
+
}
|
34
34
|
}
|
35
35
|
|
36
36
|
function constructData (contentId, path, position, listTitle, listSubheading, searchQuery, variant) {
|
@@ -67,7 +67,7 @@
|
|
67
67
|
}
|
68
68
|
|
69
69
|
function trackProductOnClick (row, contentId, path, position, searchQuery, listTitle, listSubheading, variant, trackClickLabel) {
|
70
|
-
row.click
|
70
|
+
row.addEventListener('click', function () {
|
71
71
|
if (contentId || path) {
|
72
72
|
var clickData = constructData(contentId, path, position, listTitle, listSubheading, searchQuery, variant)
|
73
73
|
ga('ec:addProduct', clickData)
|
@@ -82,18 +82,18 @@
|
|
82
82
|
}
|
83
83
|
|
84
84
|
Ecommerce.ecLoaded = false
|
85
|
-
Ecommerce.start = function (
|
85
|
+
Ecommerce.start = function (elements) {
|
86
86
|
if (!window.ga) { return }
|
87
|
-
|
88
|
-
if (
|
87
|
+
elements = elements || document.querySelectorAll('[data-analytics-ecommerce]')
|
88
|
+
if (elements.length > 0) {
|
89
89
|
if (!Ecommerce.ecLoaded) {
|
90
90
|
ga('require', 'ec')
|
91
91
|
Ecommerce.ecLoaded = true
|
92
92
|
}
|
93
|
-
|
93
|
+
for (var i = 0; i < elements.length; i++) {
|
94
94
|
var ecommerce = new Ecommerce()
|
95
|
-
ecommerce.init(
|
96
|
-
}
|
95
|
+
ecommerce.init(elements[i])
|
96
|
+
}
|
97
97
|
}
|
98
98
|
}
|
99
99
|
|
data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js
CHANGED
@@ -6,27 +6,57 @@
|
|
6
6
|
|
7
7
|
GOVUK.Modules.ExplicitCrossDomainLinks = function () {
|
8
8
|
this.start = function ($module) {
|
9
|
-
|
9
|
+
this.element = $module[0]
|
10
|
+
this.attribute = 'href'
|
11
|
+
this.attributeValue = this.element.getAttribute(this.attribute)
|
12
|
+
this.eventType = 'click'
|
13
|
+
if (!this.attributeValue) {
|
14
|
+
this.attribute = 'action'
|
15
|
+
this.attributeValue = this.element.getAttribute(this.attribute)
|
16
|
+
this.eventType = 'submit'
|
17
|
+
}
|
10
18
|
|
11
|
-
|
19
|
+
this.handleEvent = this.handleEvent.bind(this)
|
20
|
+
this.handleCookiesAccepted = this.handleCookiesAccepted.bind(this)
|
21
|
+
// Listens for the 'submit' event if the element is a form, and the 'click' event if it is a link
|
22
|
+
this.element.addEventListener(this.eventType, this.handleEvent)
|
23
|
+
}
|
12
24
|
|
13
|
-
|
14
|
-
//
|
15
|
-
|
25
|
+
this.handleEvent = function (e) {
|
26
|
+
// prevent default: we want the link href and/or form action to be decorated before we navigate away
|
27
|
+
e.preventDefault()
|
28
|
+
var cookieBannerEngaged = GOVUK.cookie('cookies_preferences_set')
|
29
|
+
var cookieConsent = GOVUK.getConsentCookie()
|
16
30
|
|
17
31
|
if (cookieBannerEngaged !== 'true') {
|
18
|
-
|
19
|
-
|
32
|
+
// If not engaged, append only ?cookie_consent=not-engaged
|
33
|
+
this.decorate(this.element, 'cookie_consent=not-engaged', this.attribute)
|
34
|
+
} else if (cookieConsent && cookieConsent.usage === true) {
|
35
|
+
this.handleCookiesAccepted()
|
36
|
+
} else {
|
37
|
+
this.decorate(this.element, 'cookie_consent=reject', this.attribute)
|
20
38
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
39
|
+
|
40
|
+
// remove the event listener to avoid an infinite loop
|
41
|
+
this.element.removeEventListener(this.eventType, this.handleEvent)
|
42
|
+
|
43
|
+
// if the element is a form, submit it. If it is a link, click it
|
44
|
+
if (this.eventType === 'submit') {
|
45
|
+
this.element.submit()
|
46
|
+
} else {
|
47
|
+
this.element.click()
|
25
48
|
}
|
49
|
+
}
|
26
50
|
|
27
|
-
|
51
|
+
this.handleCookiesAccepted = function () {
|
52
|
+
// If the cookie banner was engaged and usage cookie accepted, append ?_ga=clientid if available and cookie_consent=accept
|
53
|
+
var element = this.element
|
54
|
+
var attribute = this.attribute
|
55
|
+
this.decorate(element, 'cookie_consent=accept', attribute)
|
28
56
|
|
29
|
-
if (!global.ga) {
|
57
|
+
if (!global.ga) {
|
58
|
+
return
|
59
|
+
}
|
30
60
|
|
31
61
|
global.ga(function () {
|
32
62
|
var trackers = global.ga.getAll()
|
@@ -34,37 +64,24 @@
|
|
34
64
|
if (!trackers.length) { return }
|
35
65
|
|
36
66
|
var linker = new global.gaplugins.Linker(trackers[0])
|
67
|
+
var attrValue = element.getAttribute(attribute)
|
37
68
|
|
38
|
-
|
39
|
-
if (attrAction) {
|
40
|
-
element.setAttribute('action', linker.decorate(attrAction))
|
41
|
-
}
|
42
|
-
|
43
|
-
var attrHref = element.getAttribute('href')
|
44
|
-
if (attrHref) {
|
45
|
-
element.href = linker.decorate(attrHref)
|
46
|
-
}
|
69
|
+
element.setAttribute(attribute, linker.decorate(attrValue))
|
47
70
|
})
|
48
71
|
}
|
49
72
|
|
50
|
-
this.decorate = function (element, param) {
|
51
|
-
var attribute = 'href'
|
73
|
+
this.decorate = function (element, param, attribute) {
|
52
74
|
var attributeValue = element.getAttribute(attribute)
|
53
75
|
|
54
|
-
if (!attributeValue) {
|
55
|
-
attribute = 'action'
|
56
|
-
attributeValue = element.getAttribute(attribute)
|
57
|
-
}
|
58
|
-
|
59
76
|
if (!attributeValue) { return }
|
60
77
|
|
61
78
|
if (attributeValue.includes('?')) {
|
62
79
|
attributeValue += '&' + param
|
63
|
-
element.setAttribute(attribute, attributeValue)
|
64
80
|
} else {
|
65
81
|
attributeValue += '?' + param
|
66
|
-
element.setAttribute(attribute, attributeValue)
|
67
82
|
}
|
83
|
+
|
84
|
+
element.setAttribute(attribute, attributeValue)
|
68
85
|
}
|
69
86
|
}
|
70
87
|
|
@@ -26,9 +26,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
26
26
|
var html = document.createElement('div')
|
27
27
|
html.innerHTML = newButton
|
28
28
|
// test that the html returned contains the button component; if yes, swap the button for the updated version
|
29
|
-
var
|
30
|
-
if (
|
31
|
-
this.$module.
|
29
|
+
var responseButtonContainer = html.querySelector('form.gem-c-single-page-notification-button')
|
30
|
+
if (responseButtonContainer) {
|
31
|
+
this.$module.parentNode.replaceChild(responseButtonContainer, this.$module)
|
32
32
|
}
|
33
33
|
}
|
34
34
|
}
|
@@ -1,13 +1,21 @@
|
|
1
1
|
.gem-c-big-number {
|
2
2
|
margin-bottom: govuk-spacing(3);
|
3
|
+
@include govuk-typography-common;
|
4
|
+
@include govuk-text-colour;
|
3
5
|
}
|
4
6
|
|
5
7
|
.gem-c-big-number__value {
|
6
|
-
|
8
|
+
font-size: 80px;
|
9
|
+
@include govuk-typography-weight-bold;
|
10
|
+
line-height: 1;
|
11
|
+
|
12
|
+
@if $govuk-typography-use-rem {
|
13
|
+
font-size: govuk-px-to-rem(80px);
|
14
|
+
}
|
7
15
|
}
|
8
16
|
|
9
17
|
.gem-c-big-number__label {
|
10
|
-
@include govuk-font($size:
|
18
|
+
@include govuk-font($size: 19, $weight: bold);
|
11
19
|
|
12
20
|
// This pseudo element is to bypass an issue with NVDA where block level elements are dictated separately.
|
13
21
|
// What's happening here is that the label and the number technically have an inline relationship but appear to have a block relationship thanks to this element
|
@@ -102,6 +102,7 @@ $icon-size: 20px;
|
|
102
102
|
$chevron-indent-spacing: 7px;
|
103
103
|
$black-bar-height: 50px;
|
104
104
|
$search-width-or-height: $black-bar-height;
|
105
|
+
$pseudo-underline-height: 3px;
|
105
106
|
|
106
107
|
@mixin chevron($colour, $update: false) {
|
107
108
|
@if ($update == true) {
|
@@ -111,7 +112,7 @@ $search-width-or-height: $black-bar-height;
|
|
111
112
|
@include prefixed-transform($rotate: 45deg, $translateY: -35%);
|
112
113
|
border-bottom: 2px solid $colour;
|
113
114
|
border-right: 2px solid $colour;
|
114
|
-
content: "
|
115
|
+
content: "";
|
115
116
|
display: inline-block;
|
116
117
|
height: 8px;
|
117
118
|
margin: 0 8px 0 2px;
|
@@ -123,21 +124,21 @@ $search-width-or-height: $black-bar-height;
|
|
123
124
|
@mixin make-selectable-area-bigger {
|
124
125
|
background: none;
|
125
126
|
bottom: 0;
|
126
|
-
content: "
|
127
|
+
content: "";
|
127
128
|
left: 0;
|
128
129
|
position: absolute;
|
129
130
|
right: 0;
|
130
131
|
top: 0;
|
131
132
|
}
|
132
133
|
|
133
|
-
@mixin pseudo-underline {
|
134
|
+
@mixin pseudo-underline($left: govuk-spacing(4), $right: govuk-spacing(4)) {
|
134
135
|
background: none;
|
135
136
|
bottom: 0;
|
136
|
-
content: "
|
137
|
-
height:
|
138
|
-
left:
|
137
|
+
content: "";
|
138
|
+
height: $pseudo-underline-height;
|
139
|
+
left: $left;
|
139
140
|
position: absolute;
|
140
|
-
right:
|
141
|
+
right: $right;
|
141
142
|
top: auto;
|
142
143
|
}
|
143
144
|
|
@@ -384,7 +385,7 @@ $search-width-or-height: $black-bar-height;
|
|
384
385
|
// stylelint-enable max-nesting-depth
|
385
386
|
|
386
387
|
&:after {
|
387
|
-
@include pseudo-underline;
|
388
|
+
@include pseudo-underline($left: govuk-spacing(5), $right: govuk-spacing(6));
|
388
389
|
}
|
389
390
|
}
|
390
391
|
}
|
@@ -430,7 +431,7 @@ $search-width-or-height: $black-bar-height;
|
|
430
431
|
|
431
432
|
@include govuk-media-query($from: "desktop") {
|
432
433
|
&:after {
|
433
|
-
@include pseudo-underline;
|
434
|
+
@include pseudo-underline($left: govuk-spacing(5), $right: govuk-spacing(6));
|
434
435
|
}
|
435
436
|
|
436
437
|
@include focus-not-focus-visible {
|
@@ -441,7 +442,7 @@ $search-width-or-height: $black-bar-height;
|
|
441
442
|
font-size: govuk-px-to-rem(16px);
|
442
443
|
}
|
443
444
|
height: $black-bar-height;
|
444
|
-
padding: govuk-spacing(3);
|
445
|
+
padding: govuk-spacing(3) govuk-spacing(6) govuk-spacing(3) govuk-spacing(5);
|
445
446
|
position: relative;
|
446
447
|
text-decoration: none;
|
447
448
|
|
@@ -762,7 +763,7 @@ $search-width-or-height: $black-bar-height;
|
|
762
763
|
|
763
764
|
&:hover {
|
764
765
|
background: govuk-colour("black");
|
765
|
-
border-bottom:
|
766
|
+
border-bottom: $pseudo-underline-height solid govuk-colour("mid-grey");
|
766
767
|
color: govuk-colour("mid-grey");
|
767
768
|
}
|
768
769
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
margin: govuk-spacing(6) 0;
|
15
15
|
overflow-x: auto;
|
16
16
|
width: 100%;
|
17
|
-
@include govuk-font($size:
|
17
|
+
@include govuk-font($size: 19);
|
18
18
|
|
19
19
|
caption {
|
20
20
|
text-align: left;
|
@@ -24,12 +24,16 @@
|
|
24
24
|
th,
|
25
25
|
td {
|
26
26
|
vertical-align: top;
|
27
|
-
padding: govuk-spacing(2) govuk-spacing(
|
28
|
-
border-bottom: solid
|
27
|
+
padding: govuk-spacing(2) govuk-spacing(4) govuk-spacing(2) 0;
|
28
|
+
border-bottom: 1px solid govuk-colour("mid-grey", $legacy: "grey-2");
|
29
|
+
|
30
|
+
&:last-child {
|
31
|
+
padding: govuk-spacing(2) 0 govuk-spacing(2) 0;
|
32
|
+
}
|
29
33
|
}
|
30
34
|
|
31
35
|
th {
|
32
|
-
@include govuk-font($size:
|
36
|
+
@include govuk-font($size: 19, $weight: bold);
|
33
37
|
text-align: left;
|
34
38
|
color: $govuk-text-colour;
|
35
39
|
}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
text = raw(text)
|
15
15
|
|
16
16
|
cookie_preferences_href ||= "/help/cookies"
|
17
|
-
confirmation_message ||= raw(t("components.cookie_banner.
|
17
|
+
confirmation_message ||= raw(t("components.cookie_banner.confirmation_message_html",
|
18
18
|
link: link_to(
|
19
19
|
t("components.cookie_banner.confirmation_message_link"),
|
20
20
|
cookie_preferences_href,
|
@@ -3,6 +3,7 @@
|
|
3
3
|
suggestion_link_text ||= false
|
4
4
|
suggestion_link_url ||= false
|
5
5
|
suggestion_text ||= nil
|
6
|
+
new_tab ||= false
|
6
7
|
|
7
8
|
data_attributes ||= {}
|
8
9
|
data_attributes[:module] = 'intervention'
|
@@ -13,17 +14,33 @@
|
|
13
14
|
aria_attributes[:label] = 'Intervention'
|
14
15
|
|
15
16
|
local_assigns[:query_string] ||= request.query_string
|
17
|
+
local_assigns[:suggestion_link_text] = suggestion_link_text
|
18
|
+
local_assigns[:suggestion_link_url] = suggestion_link_url
|
16
19
|
|
17
20
|
intervention_helper = GovukPublishingComponents::Presenters::InterventionHelper.new(local_assigns)
|
18
21
|
dismiss_href = intervention_helper.dismiss_link
|
22
|
+
|
23
|
+
suggestion_tag_options = {
|
24
|
+
class: "govuk-link gem-c-intervention__suggestion-link",
|
25
|
+
href: suggestion_link_url,
|
26
|
+
data: suggestion_data_attributes,
|
27
|
+
}
|
28
|
+
|
29
|
+
if new_tab && (suggestion_link_text && suggestion_link_url)
|
30
|
+
target = "_blank"
|
31
|
+
rel = intervention_helper.security_attr
|
32
|
+
|
33
|
+
suggestion_tag_options.merge!({ target: target, rel: rel })
|
34
|
+
|
35
|
+
suggestion_link_text = intervention_helper.accessible_text
|
36
|
+
end
|
19
37
|
%>
|
20
|
-
<% if suggestion_text
|
38
|
+
<% if suggestion_text || (suggestion_link_text && suggestion_link_url) %>
|
21
39
|
<%= tag.section class: "gem-c-intervention", role: "region", aria: aria_attributes, data: data_attributes do %>
|
22
40
|
<p class="govuk-body">
|
23
41
|
<%= tag.span suggestion_text, class: "gem-c-intervention__textwrapper" if suggestion_text %>
|
24
|
-
<% if suggestion_link_text
|
25
|
-
<%= tag.a suggestion_link_text,
|
26
|
-
|
42
|
+
<% if suggestion_link_text && suggestion_link_url %>
|
43
|
+
<%= tag.a suggestion_link_text, suggestion_tag_options %>
|
27
44
|
<% end %>
|
28
45
|
</p>
|
29
46
|
|
@@ -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(
|