govuk_publishing_components 29.12.0 → 29.14.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/images/govuk_publishing_components/action-link-arrow--white.png +0 -0
- data/app/assets/images/govuk_publishing_components/action-link-arrow--white.svg +1 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-click-tracking.js +8 -3
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-page-views.js +7 -5
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +135 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +2 -0
- data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +10 -0
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +19 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +7 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +1 -92
- data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_date_input.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +33 -36
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +2 -1
- data/app/views/govuk_publishing_components/components/docs/action_link.yml +8 -0
- data/app/views/govuk_publishing_components/components/docs/date_input.yml +7 -0
- data/app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml +1 -1
- data/config/locales/ar.yml +2 -0
- data/config/locales/az.yml +2 -0
- data/config/locales/be.yml +2 -0
- data/config/locales/bg.yml +2 -0
- data/config/locales/bn.yml +2 -0
- data/config/locales/cs.yml +2 -0
- data/config/locales/cy.yml +2 -0
- data/config/locales/da.yml +2 -0
- data/config/locales/de.yml +2 -0
- data/config/locales/dr.yml +2 -0
- data/config/locales/el.yml +2 -0
- data/config/locales/en.yml +4 -2
- data/config/locales/es-419.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/et.yml +2 -0
- data/config/locales/fa.yml +2 -0
- data/config/locales/fi.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/gd.yml +2 -0
- data/config/locales/gu.yml +2 -0
- data/config/locales/he.yml +2 -0
- data/config/locales/hi.yml +2 -0
- data/config/locales/hr.yml +2 -0
- data/config/locales/hu.yml +2 -0
- data/config/locales/hy.yml +2 -0
- data/config/locales/id.yml +2 -0
- data/config/locales/is.yml +2 -0
- data/config/locales/it.yml +2 -0
- data/config/locales/ja.yml +2 -0
- data/config/locales/ka.yml +2 -0
- data/config/locales/kk.yml +2 -0
- data/config/locales/ko.yml +2 -0
- data/config/locales/lt.yml +2 -0
- data/config/locales/lv.yml +2 -0
- data/config/locales/ms.yml +2 -0
- data/config/locales/mt.yml +2 -0
- data/config/locales/nl.yml +2 -0
- data/config/locales/no.yml +2 -0
- data/config/locales/pa-pk.yml +2 -0
- data/config/locales/pa.yml +2 -0
- data/config/locales/pl.yml +2 -0
- data/config/locales/ps.yml +2 -0
- data/config/locales/pt.yml +2 -0
- data/config/locales/ro.yml +2 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/si.yml +2 -0
- data/config/locales/sk.yml +2 -0
- data/config/locales/sl.yml +2 -0
- data/config/locales/so.yml +2 -0
- data/config/locales/sq.yml +2 -0
- data/config/locales/sr.yml +2 -0
- data/config/locales/sv.yml +2 -0
- data/config/locales/sw.yml +2 -0
- data/config/locales/ta.yml +2 -0
- data/config/locales/th.yml +2 -0
- data/config/locales/tk.yml +2 -0
- data/config/locales/tr.yml +2 -0
- data/config/locales/uk.yml +2 -0
- data/config/locales/ur.yml +2 -0
- data/config/locales/uz.yml +2 -0
- data/config/locales/vi.yml +2 -0
- data/config/locales/zh-hk.yml +2 -0
- data/config/locales/zh-tw.yml +2 -0
- data/config/locales/zh.yml +2 -0
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +6 -3
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/govuk/components/_all.scss +1 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +1 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +2 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +102 -44
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +3 -2
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +10 -10
- data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +92 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +2 -1
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +3 -0
- data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +14 -6
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +9 -3
- data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +2 -1
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +76 -1
- data/node_modules/govuk-frontend/govuk/components/pagination/README.md +15 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/_index.scss +244 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/_pagination.scss +2 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +300 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/macro-options.json +128 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/macro.njk +3 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/template.njk +62 -0
- data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +147 -43
- data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/radios/template.njk +3 -2
- data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +56 -2
- data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/select/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +2 -1
- data/node_modules/govuk-frontend/govuk-esm/all.mjs +12 -12
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +3 -3
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +2 -2
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +3 -3
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +4 -4
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +3 -3
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +3 -3
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +3 -3
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +1 -1
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +4 -4
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +3 -3
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +6 -6
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/{DOMTokenList.js → DOMTokenList.mjs} +0 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/{Document.js → Document.mjs} +0 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/{classList.js → classList.mjs} +4 -4
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/{closest.js → closest.mjs} +1 -1
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/{matches.js → matches.mjs} +0 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/{nextElementSibling.js → nextElementSibling.mjs} +2 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/{previousElementSibling.js → previousElementSibling.mjs} +2 -2
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/{Element.js → Element.mjs} +1 -1
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/{Event.js → Event.mjs} +3 -3
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/{bind.js → bind.mjs} +1 -1
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/{defineProperty.js → defineProperty.mjs} +0 -0
- data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/{Window.js → Window.mjs} +0 -0
- data/node_modules/govuk-frontend/package.json +8 -2
- metadata +25 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea69ac62517f1d199c528b86f901ea00cf09b7d09b9c4b7c6550af866ad67cea
|
4
|
+
data.tar.gz: f92c94a1bad3f1516e4cdc4e415202c72e027b42990ed3e1c9c5eacebe389d14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4a5fa8f083422f90461f0473ebe979d1240a5b0a0f4a0a56f19a24936eb33c70f18216b4e29bb43140f945c9985e5da738299563b0ceab1a40932c2cb85b138
|
7
|
+
data.tar.gz: 3ab97ddb79f5ed2a1494c9fa63868573b4bc18d8ba067343d4acc035b5602f90ab6a47b089a36b8590f77b5d45e9cc70084001b355cc458dbe2326346ec63073
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg width="39" height="39" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.01 6.818l-2.828 2.828 7.853 7.854-22 .066L0 21.5h22.035l-7.853 7.854 2.828 2.828L29.69 19.5zM39 19.5C39 30.27 30.27 39 19.5 39 9.373 39 1.05 31.28.092 21.405A19.737 19.737 0 010 19.5C0 8.73 8.73 0 19.5 0S39 8.73 39 19.5z" fill="#fff"/></svg>
|
@@ -64,7 +64,7 @@
|
|
64
64
|
'taxon-slugs': { dimension: 58, defaultValue: 'other' },
|
65
65
|
'taxon-ids': { dimension: 59, defaultValue: 'other' },
|
66
66
|
'content-has-history': { dimension: 39, defaultValue: 'false' },
|
67
|
-
'publishing-
|
67
|
+
'publishing-app': { dimension: 89 },
|
68
68
|
'brexit-audience': { dimension: 112 },
|
69
69
|
'brexit-superbreadcrumb': { dimension: 111 },
|
70
70
|
stepnavs: { dimension: 96 },
|
@@ -25,7 +25,12 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
25
25
|
link_url: window.location.href.substring(window.location.origin.length),
|
26
26
|
ui: JSON.parse(target.getAttribute('data-gtm-attributes')) || {}
|
27
27
|
}
|
28
|
-
|
28
|
+
|
29
|
+
// Ensure it only tracks aria-expanded in an accordion element, instead of in any child of the clicked element
|
30
|
+
if (target.closest('.gem-c-accordion')) {
|
31
|
+
var ariaExpanded = this.getClosestAttribute(target, 'aria-expanded')
|
32
|
+
}
|
33
|
+
|
29
34
|
/*
|
30
35
|
the details component uses an 'open' attribute instead of aria-expanded, so we need to check if we're on a details component.
|
31
36
|
since details deletes the 'open' attribute when closed, we need this boolean, otherwise every element which
|
@@ -35,11 +40,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
35
40
|
|
36
41
|
if (ariaExpanded) {
|
37
42
|
data.ui.text = data.ui.text || target.innerText
|
38
|
-
data.ui.
|
43
|
+
data.ui.action = (ariaExpanded === 'false') ? 'opened' : 'closed'
|
39
44
|
} else if (detailsElement) {
|
40
45
|
data.ui.text = data.ui.text || detailsElement.textContent
|
41
46
|
var openAttribute = detailsElement.getAttribute('open')
|
42
|
-
data.ui.
|
47
|
+
data.ui.action = (openAttribute == null) ? 'opened' : 'closed'
|
43
48
|
}
|
44
49
|
|
45
50
|
window.dataLayer.push(data)
|
@@ -4,6 +4,8 @@
|
|
4
4
|
var GOVUK = global.GOVUK || {}
|
5
5
|
|
6
6
|
GOVUK.Gtm = {
|
7
|
+
PIIRemover: new GOVUK.analyticsGA4.PIIRemover(), // imported in analytics-ga4.js
|
8
|
+
|
7
9
|
sendPageView: function () {
|
8
10
|
if (window.dataLayer) {
|
9
11
|
var data = {
|
@@ -16,8 +18,8 @@
|
|
16
18
|
},
|
17
19
|
publishing: {
|
18
20
|
document_type: this.getMetaContent('format'),
|
19
|
-
|
20
|
-
|
21
|
+
publishing_app: this.getMetaContent('publishing-app'),
|
22
|
+
rendering_app: this.getMetaContent('rendering-app'),
|
21
23
|
schema_name: this.getMetaContent('schema-name'),
|
22
24
|
content_id: this.getMetaContent('content-id')
|
23
25
|
},
|
@@ -48,15 +50,15 @@
|
|
48
50
|
},
|
49
51
|
|
50
52
|
getLocation: function () {
|
51
|
-
return document.location.href
|
53
|
+
return this.PIIRemover.stripPII(document.location.href)
|
52
54
|
},
|
53
55
|
|
54
56
|
getReferrer: function () {
|
55
|
-
return document.referrer
|
57
|
+
return this.PIIRemover.stripPIIWithOverride(document.referrer, true, true)
|
56
58
|
},
|
57
59
|
|
58
60
|
getTitle: function () {
|
59
|
-
return document.title
|
61
|
+
return this.PIIRemover.stripPII(document.title)
|
60
62
|
},
|
61
63
|
|
62
64
|
// window.httpStatusCode is set in the source of the error page in static
|
@@ -0,0 +1,135 @@
|
|
1
|
+
;(function (global) {
|
2
|
+
'use strict'
|
3
|
+
|
4
|
+
var GOVUK = global.GOVUK || {}
|
5
|
+
var EMAIL_PATTERN = /[^\s=/?&#]+(?:@|%40)[^\s=/?&]+/g
|
6
|
+
var POSTCODE_PATTERN = /\b[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9](?!refund)[ABD-HJLNPQ-Z]{2,3}\b/gi
|
7
|
+
var DATE_PATTERN = /\d{4}(-?)\d{2}(-?)\d{2}/g
|
8
|
+
var ESCAPE_REGEX_PATTERN = /[|\\{}()[\]^$+*?.]/g
|
9
|
+
|
10
|
+
// specific URL parameters to be redacted from accounts URLs
|
11
|
+
var RESET_PASSWORD_TOKEN_PATTERN = /reset_password_token=[a-zA-Z0-9-]+/g
|
12
|
+
var UNLOCK_TOKEN_PATTERN = /unlock_token=[a-zA-Z0-9-]+/g
|
13
|
+
var STATE_PATTERN = /state=.[^&]+/g
|
14
|
+
|
15
|
+
function shouldStripDates () {
|
16
|
+
var metas = document.querySelectorAll('meta[name="govuk:static-analytics:strip-dates"]')
|
17
|
+
return metas.length > 0
|
18
|
+
}
|
19
|
+
|
20
|
+
function shouldStripPostcodes () {
|
21
|
+
var metas = document.querySelectorAll('meta[name="govuk:static-analytics:strip-postcodes"]')
|
22
|
+
return metas.length > 0
|
23
|
+
}
|
24
|
+
|
25
|
+
function queryStringParametersToStrip () {
|
26
|
+
var meta = document.querySelector('meta[name="govuk:static-analytics:strip-query-string-parameters"]')
|
27
|
+
var value = false
|
28
|
+
if (meta) {
|
29
|
+
value = meta.getAttribute('content')
|
30
|
+
}
|
31
|
+
var parameters = []
|
32
|
+
|
33
|
+
if (value) {
|
34
|
+
var split = value.split(',')
|
35
|
+
for (var i = 0; i < split.length; i++) {
|
36
|
+
parameters.push(split[i].trim())
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
return parameters
|
41
|
+
}
|
42
|
+
|
43
|
+
var PIIRemover = function () {
|
44
|
+
this.stripDatePII = shouldStripDates()
|
45
|
+
this.stripPostcodePII = shouldStripPostcodes()
|
46
|
+
this.queryStringParametersToStrip = queryStringParametersToStrip()
|
47
|
+
}
|
48
|
+
|
49
|
+
PIIRemover.prototype.PIISafe = function (value) {
|
50
|
+
this.value = value
|
51
|
+
}
|
52
|
+
|
53
|
+
PIIRemover.prototype.stripPII = function (value) {
|
54
|
+
if (typeof value === 'string') {
|
55
|
+
return this.stripPIIFromString(value)
|
56
|
+
} else if (Object.prototype.toString.call(value) === '[object Array]' || Object.prototype.toString.call(value) === '[object Arguments]') {
|
57
|
+
return this.stripPIIFromArray(value)
|
58
|
+
} else if (typeof value === 'object') {
|
59
|
+
return this.stripPIIFromObject(value)
|
60
|
+
} else {
|
61
|
+
return value
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
PIIRemover.prototype.stripPIIWithOverride = function (value, enableDateStripping, enablePostcodeStripping) {
|
66
|
+
var oldStripDatePII = this.stripDatePII
|
67
|
+
var oldPostcodePII = this.stripPostcodePII
|
68
|
+
|
69
|
+
this.stripDatePII = enableDateStripping
|
70
|
+
this.stripPostcodePII = enablePostcodeStripping
|
71
|
+
|
72
|
+
var strippedValue = this.stripPII(value)
|
73
|
+
|
74
|
+
this.stripDatePII = oldStripDatePII
|
75
|
+
this.stripPostcodePII = oldPostcodePII
|
76
|
+
|
77
|
+
return strippedValue
|
78
|
+
}
|
79
|
+
|
80
|
+
PIIRemover.prototype.stripPIIFromString = function (string) {
|
81
|
+
var stripped = string.replace(EMAIL_PATTERN, '[email]')
|
82
|
+
stripped = stripped.replace(RESET_PASSWORD_TOKEN_PATTERN, 'reset_password_token=[reset_password_token]')
|
83
|
+
stripped = stripped.replace(UNLOCK_TOKEN_PATTERN, 'unlock_token=[unlock_token]')
|
84
|
+
stripped = stripped.replace(STATE_PATTERN, 'state=[state]')
|
85
|
+
stripped = this.stripQueryStringParameters(stripped)
|
86
|
+
|
87
|
+
if (this.stripDatePII === true) {
|
88
|
+
stripped = stripped.replace(DATE_PATTERN, '[date]')
|
89
|
+
}
|
90
|
+
if (this.stripPostcodePII === true) {
|
91
|
+
stripped = stripped.replace(POSTCODE_PATTERN, '[postcode]')
|
92
|
+
}
|
93
|
+
return stripped
|
94
|
+
}
|
95
|
+
|
96
|
+
PIIRemover.prototype.stripPIIFromObject = function (object) {
|
97
|
+
if (object) {
|
98
|
+
if (object instanceof this.PIISafe) {
|
99
|
+
return object.value
|
100
|
+
} else {
|
101
|
+
for (var property in object) {
|
102
|
+
var value = object[property]
|
103
|
+
|
104
|
+
object[property] = this.stripPII(value)
|
105
|
+
}
|
106
|
+
return object
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
PIIRemover.prototype.stripPIIFromArray = function (array) {
|
112
|
+
for (var i = 0, l = array.length; i < l; i++) {
|
113
|
+
var elem = array[i]
|
114
|
+
|
115
|
+
array[i] = this.stripPII(elem)
|
116
|
+
}
|
117
|
+
return array
|
118
|
+
}
|
119
|
+
|
120
|
+
PIIRemover.prototype.stripQueryStringParameters = function (string) {
|
121
|
+
for (var i = 0; i < this.queryStringParametersToStrip.length; i++) {
|
122
|
+
var parameter = this.queryStringParametersToStrip[i]
|
123
|
+
var escaped = parameter.replace(ESCAPE_REGEX_PATTERN, '\\$&')
|
124
|
+
var regexp = new RegExp('((?:\\?|&)' + escaped + '=)(?:[^&#\\s]*)', 'g')
|
125
|
+
string = string.replace(regexp, '$1[' + parameter + ']')
|
126
|
+
}
|
127
|
+
|
128
|
+
return string
|
129
|
+
}
|
130
|
+
|
131
|
+
GOVUK.analyticsGA4 = GOVUK.analyticsGA4 || {}
|
132
|
+
GOVUK.analyticsGA4.PIIRemover = PIIRemover
|
133
|
+
|
134
|
+
global.GOVUK = GOVUK
|
135
|
+
})(window)
|
@@ -124,6 +124,16 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
|
|
124
124
|
var label = expanded ? 'Show all sections' : 'Hide all sections'
|
125
125
|
var action = expanded ? 'accordionOpened' : 'accordionClosed'
|
126
126
|
var options = { transport: 'beacon', label: label }
|
127
|
+
|
128
|
+
var extraOptions = event.target && event.target.getAttribute('data-track-options')
|
129
|
+
|
130
|
+
// this uses the same logic as track-click.js handleClick
|
131
|
+
// means we can add a custom dimensions on click
|
132
|
+
if (extraOptions) {
|
133
|
+
extraOptions = JSON.parse(extraOptions)
|
134
|
+
for (var k in extraOptions) options[k] = extraOptions[k]
|
135
|
+
}
|
136
|
+
|
127
137
|
if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
|
128
138
|
window.GOVUK.analytics.trackEvent('pageElementInteraction', action, options)
|
129
139
|
}
|
@@ -19,6 +19,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
19
19
|
this.promptSuccessMessage = this.$module.querySelector('.js-prompt-success')
|
20
20
|
this.surveyWrapper = this.$module.querySelector('#survey-wrapper')
|
21
21
|
this.jshiddenClass = 'js-hidden'
|
22
|
+
this.whatDoingInput = this.$module.querySelector('[name=what_doing]')
|
23
|
+
this.whatWrongInput = this.$module.querySelector('[name=what_wrong]')
|
22
24
|
}
|
23
25
|
|
24
26
|
Feedback.prototype.init = function () {
|
@@ -74,6 +76,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
74
76
|
this.setHiddenValuesNotUsefulForm(gaClientId)
|
75
77
|
}.bind(this))
|
76
78
|
|
79
|
+
this.somethingIsWrongButton.addEventListener('click', function (e) {
|
80
|
+
this.timerInterval = setInterval(function () {
|
81
|
+
this.timer = this.timer + 1
|
82
|
+
this.timerHoneyPot.setAttribute('value', this.timer)
|
83
|
+
}.bind(this), 1000)
|
84
|
+
}.bind(this))
|
85
|
+
|
77
86
|
// much of the JS needed to support sending the form contents via this script is
|
78
87
|
// unsupported by IE, even IE11. This check causes IE to not intercept form submits
|
79
88
|
// and let them happen normally, which is handled already by the backend
|
@@ -94,6 +103,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
94
103
|
this.revealInitialPrompt()
|
95
104
|
this.setInitialAriaAttributes()
|
96
105
|
this.activeForm.hidden = true
|
106
|
+
clearInterval(this.timerInterval)
|
97
107
|
} else {
|
98
108
|
this.showError(xhr)
|
99
109
|
this.enableSubmitFormButton($form)
|
@@ -142,6 +152,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
142
152
|
'<h2>Sorry, we’re unable to send your message as you haven’t given us any information.</h2>',
|
143
153
|
' <p>Please tell us what you were doing or what went wrong</p>'
|
144
154
|
].join('')
|
155
|
+
|
156
|
+
this.timer = 0
|
157
|
+
|
158
|
+
this.timerHoneyPot = document.createElement('input')
|
159
|
+
this.timerHoneyPot.setAttribute('type', 'hidden')
|
160
|
+
this.timerHoneyPot.setAttribute('name', 'timer')
|
161
|
+
this.timerHoneyPot.setAttribute('value', this.timer)
|
162
|
+
this.somethingIsWrongForm.appendChild(this.timerHoneyPot)
|
145
163
|
}
|
146
164
|
|
147
165
|
Feedback.prototype.setHiddenValuesNotUsefulForm = function (gaClientId) {
|
@@ -185,6 +203,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
185
203
|
.focus()
|
186
204
|
} else {
|
187
205
|
this.activeForm = false
|
206
|
+
clearInterval(this.timerInterval)
|
188
207
|
}
|
189
208
|
}
|
190
209
|
|
@@ -92,6 +92,13 @@
|
|
92
92
|
}
|
93
93
|
}
|
94
94
|
|
95
|
+
.gem-c-action-link--white-arrow {
|
96
|
+
&:before {
|
97
|
+
background-image: image-url("govuk_publishing_components/action-link-arrow--white.png");
|
98
|
+
background-image: image-url("govuk_publishing_components/action-link-arrow--white.svg"), linear-gradient(transparent, transparent);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
95
102
|
.gem-c-action-link--blue-arrow {
|
96
103
|
&:before {
|
97
104
|
width: 36px;
|
@@ -1,92 +1 @@
|
|
1
|
-
|
2
|
-
display: block;
|
3
|
-
margin: govuk-spacing(8) 0;
|
4
|
-
}
|
5
|
-
|
6
|
-
.gem-c-pagination__list {
|
7
|
-
margin: 0;
|
8
|
-
padding: 0;
|
9
|
-
}
|
10
|
-
|
11
|
-
.gem-c-pagination__item {
|
12
|
-
@include govuk-font($size: 19);
|
13
|
-
list-style: none;
|
14
|
-
|
15
|
-
&:first-child {
|
16
|
-
margin-bottom: govuk-spacing(4);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
.gem-c-pagination__link {
|
21
|
-
display: block;
|
22
|
-
text-decoration: none;
|
23
|
-
padding-bottom: govuk-spacing(4);
|
24
|
-
|
25
|
-
&:hover,
|
26
|
-
&:active,
|
27
|
-
&:visited {
|
28
|
-
color: $govuk-link-colour;
|
29
|
-
}
|
30
|
-
|
31
|
-
&:hover,
|
32
|
-
&:active {
|
33
|
-
background-color: govuk-colour("light-grey", $legacy: "grey-4");
|
34
|
-
|
35
|
-
// Add govuk-link hover decoration to title if no label present
|
36
|
-
.gem-c-pagination__link-text--decorated {
|
37
|
-
@include govuk-link-decoration;
|
38
|
-
}
|
39
|
-
|
40
|
-
.gem-c-pagination__link-label,
|
41
|
-
.gem-c-pagination__link-text--decorated {
|
42
|
-
@include govuk-link-hover-decoration;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
&:focus {
|
47
|
-
@include govuk-focused-text;
|
48
|
-
|
49
|
-
.gem-c-pagination__link-title {
|
50
|
-
border-top-color: transparent;
|
51
|
-
}
|
52
|
-
|
53
|
-
.gem-c-pagination__link-icon {
|
54
|
-
fill: $govuk-text-colour;
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
.gem-c-pagination__link-title {
|
60
|
-
display: block;
|
61
|
-
border-top: 1px solid $govuk-border-colour;
|
62
|
-
padding-top: govuk-spacing(3);
|
63
|
-
}
|
64
|
-
|
65
|
-
.gem-c-pagination__link-divider {
|
66
|
-
@include govuk-visually-hidden;
|
67
|
-
}
|
68
|
-
|
69
|
-
.gem-c-pagination__link-text {
|
70
|
-
@include govuk-font(19, $weight: bold);
|
71
|
-
margin-left: govuk-spacing(2);
|
72
|
-
}
|
73
|
-
|
74
|
-
.gem-c-pagination__link-icon {
|
75
|
-
@include govuk-font($size: 24, $line-height: (33.75 / 27));
|
76
|
-
display: inline-block;
|
77
|
-
margin-bottom: 1px;
|
78
|
-
height: .482em;
|
79
|
-
width: .63em;
|
80
|
-
fill: govuk-colour("dark-grey", $legacy: "grey-1");
|
81
|
-
}
|
82
|
-
|
83
|
-
.gem-c-pagination__link-label {
|
84
|
-
display: inline-block;
|
85
|
-
margin-top: .1em;
|
86
|
-
margin-left: govuk-spacing(5);
|
87
|
-
@include govuk-link-decoration;
|
88
|
-
|
89
|
-
@include govuk-media-query($from: tablet) {
|
90
|
-
margin-left: govuk-spacing(6);
|
91
|
-
}
|
92
|
-
}
|
1
|
+
@import "govuk/components/pagination/pagination";
|
@@ -10,6 +10,7 @@
|
|
10
10
|
mobile_subtext ||= false
|
11
11
|
light_text ||= false
|
12
12
|
blue_arrow ||= false
|
13
|
+
white_arrow ||= false
|
13
14
|
simple ||= false
|
14
15
|
simple_light ||= false
|
15
16
|
dark_icon ||= false
|
@@ -29,6 +30,7 @@
|
|
29
30
|
css_classes << "gem-c-action-link--nhs" if nhs_icon
|
30
31
|
css_classes << "gem-c-action-link--brexit" if brexit_icon
|
31
32
|
css_classes << "gem-c-action-link--blue-arrow" if blue_arrow
|
33
|
+
css_classes << "gem-c-action-link--white-arrow" if white_arrow
|
32
34
|
css_classes << "gem-c-action-link--simple" if simple
|
33
35
|
css_classes << "gem-c-action-link--simple-light" if simple_light
|
34
36
|
css_classes << "gem-c-action-link--with-subtext" if subtext
|
@@ -6,7 +6,7 @@
|
|
6
6
|
{ :name => "month", :width => 2 },
|
7
7
|
{ :name => "year", :width => 4 }
|
8
8
|
]
|
9
|
-
|
9
|
+
autocomplete_date_of_birth ||= nil
|
10
10
|
legend_text ||= nil
|
11
11
|
hint ||= nil
|
12
12
|
error_message ||= nil
|
@@ -64,7 +64,7 @@
|
|
64
64
|
id: item[:id],
|
65
65
|
type: "number",
|
66
66
|
data: item[:data],
|
67
|
-
autocomplete: item[:
|
67
|
+
autocomplete: autocomplete_date_of_birth ? "bday-#{item[:name]}" : nil
|
68
68
|
} %>
|
69
69
|
<% end %>
|
70
70
|
<% end %>
|
data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
<% if local_assigns.include?(:next_page) || local_assigns.include?(:previous_page) %>
|
2
|
-
<nav
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
>
|
7
|
-
<ul class="gem-c-pagination__list" data-module="gem-track-click">
|
2
|
+
<nav
|
3
|
+
class="govuk-pagination govuk-pagination--block"
|
4
|
+
role="navigation"
|
5
|
+
aria-label="<%= t("components.previous_and_next_navigation.pagination") %>"
|
6
|
+
>
|
8
7
|
<% if local_assigns.include?(:previous_page) %>
|
9
8
|
<%
|
10
|
-
|
11
|
-
link_text_classes
|
9
|
+
title = previous_page[:title] || t("components.previous_and_next_navigation.previous")
|
10
|
+
link_text_classes = %w[govuk-pagination__link-title]
|
11
|
+
link_text_classes << "govuk-pagination__link-title--decorated" unless previous_page[:label].present?
|
12
12
|
%>
|
13
|
-
<
|
14
|
-
<a
|
15
|
-
|
13
|
+
<div class="govuk-pagination__prev">
|
14
|
+
<a class="govuk-link govuk-pagination__link"
|
15
|
+
href="<%= previous_page[:url] %>"
|
16
16
|
rel="prev"
|
17
17
|
data-track-category="contentsClicked"
|
18
18
|
data-track-action="previous"
|
@@ -20,27 +20,27 @@
|
|
20
20
|
data-track-dimension="previous"
|
21
21
|
data-track-dimension-index="29"
|
22
22
|
>
|
23
|
-
<
|
24
|
-
<
|
25
|
-
|
26
|
-
|
27
|
-
<%= tag.span(previous_page[:title], class: link_text_classes) %>
|
28
|
-
</span>
|
23
|
+
<svg class="govuk-pagination__icon govuk-pagination__icon--prev" xmlns="http://www.w3.org/2000/svg" height="13" width="15" aria-hidden="true" focusable="false" viewBox="0 0 15 13">
|
24
|
+
<path d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"></path>
|
25
|
+
</svg>
|
26
|
+
<%= tag.span(title, class: link_text_classes) %>
|
29
27
|
<% if previous_page[:label].present? %>
|
30
|
-
<span class="
|
31
|
-
<span class="
|
28
|
+
<span class="govuk-visually-hidden">:</span>
|
29
|
+
<span class="govuk-pagination__link-label"><%= previous_page[:label] %></span>
|
32
30
|
<% end %>
|
33
31
|
</a>
|
34
|
-
</
|
32
|
+
</div>
|
35
33
|
<% end %>
|
34
|
+
|
36
35
|
<% if local_assigns.include?(:next_page) %>
|
37
36
|
<%
|
38
|
-
|
39
|
-
link_text_classes
|
37
|
+
title = next_page[:title] || t("components.previous_and_next_navigation.next")
|
38
|
+
link_text_classes = %w[govuk-pagination__link-title]
|
39
|
+
link_text_classes << "govuk-pagination__link-title--decorated" unless next_page[:label].present?
|
40
40
|
%>
|
41
|
-
<
|
42
|
-
<a
|
43
|
-
|
41
|
+
<div class="govuk-pagination__next">
|
42
|
+
<a class="govuk-link govuk-pagination__link"
|
43
|
+
href="<%= next_page[:url] %>"
|
44
44
|
rel="next"
|
45
45
|
data-track-category="contentsClicked"
|
46
46
|
data-track-action="next"
|
@@ -48,19 +48,16 @@
|
|
48
48
|
data-track-dimension="next"
|
49
49
|
data-track-dimension-index="29"
|
50
50
|
>
|
51
|
-
<
|
52
|
-
<
|
53
|
-
|
54
|
-
|
55
|
-
<%= tag.span(next_page[:title], class: link_text_classes) %>
|
56
|
-
</span>
|
51
|
+
<svg class="govuk-pagination__icon govuk-pagination__icon--next" xmlns="http://www.w3.org/2000/svg" height="13" width="15" aria-hidden="true" focusable="false" viewBox="0 0 15 13">
|
52
|
+
<path d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"></path>
|
53
|
+
</svg>
|
54
|
+
<%= tag.span(title, class: link_text_classes) %>
|
57
55
|
<% if next_page[:label].present? %>
|
58
|
-
<span class="
|
59
|
-
<span class="
|
56
|
+
<span class="govuk-visually-hidden">:</span>
|
57
|
+
<span class="govuk-pagination__link-label"><%= next_page[:label] %></span>
|
60
58
|
<% end %>
|
61
59
|
</a>
|
62
|
-
</
|
60
|
+
</div>
|
63
61
|
<% end %>
|
64
|
-
</
|
65
|
-
</nav>
|
62
|
+
</nav>
|
66
63
|
<% end %>
|
@@ -189,7 +189,7 @@ examples:
|
|
189
189
|
|
190
190
|
Each item can also have a `data_attributes` hash. These `data_attributes` are placed on the `button` that triggers the opening and closing - useful for differentiating between each section of the accordion.
|
191
191
|
|
192
|
-
Data attributes can also be added to the 'Show/hide all' link using the `data_attributes_show_all` option, primarily where custom tracking is required. These attributes are read from the accordion markup and then added to the link by JavaScript (which is how the link is created).
|
192
|
+
Data attributes can also be added to the 'Show/hide all' link using the `data_attributes_show_all` option, primarily where custom tracking is required. These attributes are read from the accordion markup and then added to the link by JavaScript (which is how the link is created). If `track_options` within `data_attributes_show_all` is set, then it is possible to pass a custom dimension when 'Show/Hide all' is clicked.
|
193
193
|
data:
|
194
194
|
data_attributes:
|
195
195
|
gtm: gtm-accordion
|
@@ -197,6 +197,7 @@ examples:
|
|
197
197
|
data_attributes_show_all:
|
198
198
|
gtm-event-name: example
|
199
199
|
gtm-attributes: "{ 'ui': { 'type': 'type value', 'section': 'section value' } }"
|
200
|
+
tracking-options: "{ 'dimension114': 1 }"
|
200
201
|
items:
|
201
202
|
- heading:
|
202
203
|
text: Writing well for the web
|
@@ -78,6 +78,14 @@ examples:
|
|
78
78
|
light_text: true
|
79
79
|
context:
|
80
80
|
dark_background: true
|
81
|
+
white_arrow:
|
82
|
+
data:
|
83
|
+
text: Find out how to stay safe and help prevent the spread
|
84
|
+
href: "/something"
|
85
|
+
white_arrow: true
|
86
|
+
light_text: true
|
87
|
+
context:
|
88
|
+
dark_background: true
|
81
89
|
blue_arrow:
|
82
90
|
data:
|
83
91
|
text: Find out how to stay safe and help prevent the spread
|
@@ -26,6 +26,13 @@ examples:
|
|
26
26
|
component as follows: `custom-name[day]`, `custom-name[month]`, `custom-name[year]`
|
27
27
|
data:
|
28
28
|
name: "dob"
|
29
|
+
with_autocomplete_for_date_of_birth_fields:
|
30
|
+
description: |
|
31
|
+
Use the `autocomplete_date_of_birth` option when you're asking for the user's date of birth. This supports browsers or tools that can autofill the information on a user's behalf if they've entered it previously.
|
32
|
+
|
33
|
+
Note that the option should only be passed to the component if the date of birth asked for is the date of birth of the person filling the form in and not asked for on behalf of someone else.
|
34
|
+
data:
|
35
|
+
autocomplete_date_of_birth: true
|
29
36
|
with_legend:
|
30
37
|
data:
|
31
38
|
legend_text: "What is your date of birth?"
|
data/config/locales/ar.yml
CHANGED
data/config/locales/az.yml
CHANGED
@@ -131,7 +131,9 @@ az:
|
|
131
131
|
organisation_schema:
|
132
132
|
all_content_search_description: "%{organisation}-dan bütün məzmunu tap"
|
133
133
|
previous_and_next_navigation:
|
134
|
+
next:
|
134
135
|
pagination: Səhifələrə bölmə
|
136
|
+
previous:
|
135
137
|
print_link:
|
136
138
|
text: Bu səhifəni çap et
|
137
139
|
radio:
|
data/config/locales/be.yml
CHANGED
@@ -138,7 +138,9 @@ be:
|
|
138
138
|
organisation_schema:
|
139
139
|
all_content_search_description: Шукаць увесь змест з %{organisation}
|
140
140
|
previous_and_next_navigation:
|
141
|
+
next:
|
141
142
|
pagination: Месцаванне старонак
|
143
|
+
previous:
|
142
144
|
print_link:
|
143
145
|
text: Надрукаваць гэтую странiцу
|
144
146
|
radio:
|
data/config/locales/bg.yml
CHANGED
@@ -136,7 +136,9 @@ bg:
|
|
136
136
|
organisation_schema:
|
137
137
|
all_content_search_description: Намиране на цялото съдържание от %{organisation}
|
138
138
|
previous_and_next_navigation:
|
139
|
+
next:
|
139
140
|
pagination: Страниране
|
141
|
+
previous:
|
140
142
|
print_link:
|
141
143
|
text: Отпечатване на страницата
|
142
144
|
radio:
|