govuk_publishing_components 21.57.0 → 21.60.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -6
- data/app/assets/javascripts/component_guide/accessibility-test.js +21 -21
- data/app/assets/javascripts/component_guide/filter-components.js +19 -19
- data/app/assets/javascripts/component_guide/visual-regression.js +38 -37
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +2 -2
- data/app/assets/javascripts/govuk_publishing_components/components/details.js +6 -4
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +4 -4
- data/app/assets/javascripts/govuk_publishing_components/lib/auto-track-event.js +31 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +24 -24
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +17 -17
- data/app/assets/stylesheets/component_guide/application.scss +15 -15
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +1 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +1 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +4 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +3 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +5 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_list.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +7 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +0 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +1 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +8 -12
- data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +21 -24
- data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +4 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +6 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +0 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss +2 -10
- data/app/controllers/govuk_publishing_components/audit_controller.rb +52 -0
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +2 -1
- data/app/models/govuk_publishing_components/audit_applications.rb +105 -0
- data/app/models/govuk_publishing_components/audit_comparer.rb +185 -0
- data/app/models/govuk_publishing_components/audit_components.rb +158 -0
- data/app/views/govuk_publishing_components/audit/show.html.erb +229 -0
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +9 -4
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_list.html.erb +26 -0
- data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_radio.html.erb +13 -5
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +4 -0
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +45 -0
- data/app/views/govuk_publishing_components/components/docs/heading.yml +6 -3
- data/app/views/govuk_publishing_components/components/docs/list.yml +64 -0
- data/app/views/govuk_publishing_components/components/docs/radio.yml +4 -0
- data/config/routes.rb +1 -0
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +15 -7
- data/lib/govuk_publishing_components/presenters/heading_helper.rb +21 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/package.json +145 -220
- data/node_modules/govuk-frontend/govuk/all.js +160 -57
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +16 -8
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +6 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -5
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +68 -21
- data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +0 -27
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +2 -2
- data/node_modules/govuk-frontend/govuk/components/hint/template.njk +2 -2
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +6 -0
- data/node_modules/govuk-frontend/govuk/components/input/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +76 -28
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +0 -3
- data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +6 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +1 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +4 -2
- data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +2 -2
- data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +1 -1
- data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +4 -1
- data/node_modules/govuk-frontend/package.json +14 -81
- data/node_modules/jquery/package.json +44 -116
- metadata +46 -66
- data/Rakefile +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e9b30172e3f16dbfec024528c8e5b771e652000272cca8db4de6e3d5259a6e7
|
4
|
+
data.tar.gz: 1e0a1c48adc79cdcfe372368223bf39153ccdfd39ec3288692ab2614b4b9560c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a7f16065f473c0dfb009f2a5e19edce7467017beb7ae953fd046adace5afd82ba90d34f24ef4bf01e5f6d68dc1a16b965aa2802399e8695e3f3d7d4e526e322
|
7
|
+
data.tar.gz: 83774a0b06a6092303a514ace31c7cc37ac10726f6d769b88d57419867b114960aaf1ee9f7109fdb60448661fd71a2884cdb524a6e93c78bb7d2901bd5a06367
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ There are 2 types of helper classes in this app:
|
|
35
35
|
|
36
36
|
## Relationship with GOV.UK Design System
|
37
37
|
|
38
|
-
GOV.UK Publishing Components also makes [GOV.UK Design System](https://design-system.service.gov.uk/) styles and components available to GOV.UK's frontend applications. This gem consumes [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) via [
|
38
|
+
GOV.UK Publishing Components also makes [GOV.UK Design System](https://design-system.service.gov.uk/) styles and components available to GOV.UK's frontend applications. This gem consumes [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) via [Yarn](https://classic.yarnpkg.com/).
|
39
39
|
|
40
40
|
## Browser and assistive technology support
|
41
41
|
GOV.UK Publishing Components shares the same standards in terms of browser and assistive technology support with [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend#browser-and-assistive-technology-support).
|
@@ -44,20 +44,27 @@ GOV.UK Publishing Components shares the same standards in terms of browser and a
|
|
44
44
|
|
45
45
|
[See the rubydoc.info documentation](http://www.rubydoc.info/gems/govuk_publishing_components)
|
46
46
|
|
47
|
-
|
47
|
+
|
48
|
+
## Working locally
|
49
|
+
|
50
|
+
### Install dependencies
|
51
|
+
|
52
|
+
As well as the Ruby, you will also need the [Yarn package manager](https://classic.yarnpkg.com/en/docs/install/) to allow installing [npm](https://npmjs.com) dependencies.
|
53
|
+
|
54
|
+
Install the application's dependencies with:
|
48
55
|
|
49
56
|
```sh
|
50
|
-
bundle
|
57
|
+
bundle install
|
58
|
+
yarn install
|
51
59
|
```
|
52
60
|
|
53
|
-
|
61
|
+
### Running tests
|
54
62
|
|
55
|
-
The default rake task runs all
|
63
|
+
The default rake task runs all the linting and test tasks:
|
56
64
|
|
57
65
|
```sh
|
58
66
|
bin/rake
|
59
67
|
```
|
60
|
-
|
61
68
|
Javascript is tested using Jasmine and the [Jasmine gem](https://github.com/pivotal/jasmine-gem). Tests can be run either in the browser or on the command line via the dummy app’s tasks:
|
62
69
|
|
63
70
|
```sh
|
@@ -68,6 +75,24 @@ bin/rake app:jasmine
|
|
68
75
|
bin/rake app:jasmine:ci
|
69
76
|
```
|
70
77
|
|
78
|
+
### Viewing the component guide
|
79
|
+
|
80
|
+
View the component guide in your browser with:
|
81
|
+
|
82
|
+
```sh
|
83
|
+
./startup.sh
|
84
|
+
```
|
85
|
+
|
86
|
+
The guide should be available at http://localhost:3212
|
87
|
+
|
88
|
+
### View documentation
|
89
|
+
|
90
|
+
Preview documentation in your browser with:
|
91
|
+
|
92
|
+
```sh
|
93
|
+
bundle exec yard server --reload
|
94
|
+
```
|
95
|
+
|
71
96
|
## Licence
|
72
97
|
|
73
98
|
[MIT Licence](LICENCE.md)
|
@@ -31,23 +31,23 @@
|
|
31
31
|
|
32
32
|
axe.run(selector, axeOptions, function (err, results) {
|
33
33
|
if (err) {
|
34
|
-
return callback('aXe Error: ' + err)
|
34
|
+
return callback(new Error('aXe Error: ' + err))
|
35
35
|
}
|
36
36
|
|
37
|
-
if (typeof results ===
|
38
|
-
return callback('aXe Error: Expected results but none returned')
|
37
|
+
if (typeof results === 'undefined') {
|
38
|
+
return callback(new Error('aXe Error: Expected results but none returned'))
|
39
39
|
}
|
40
40
|
|
41
41
|
var consoleErrorText = _consoleErrorText(results.violations, results.url)
|
42
|
-
var bodyClass = results.violations.length === 0 ?
|
43
|
-
document.body.classList.add(bodyClass)
|
44
|
-
document.body.classList.add(
|
42
|
+
var bodyClass = results.violations.length === 0 ? 'js-test-a11y-success' : 'js-test-a11y-failed'
|
43
|
+
document.body.classList.add(bodyClass)
|
44
|
+
document.body.classList.add('js-test-a11y-finished')
|
45
45
|
|
46
46
|
callback(undefined, consoleErrorText, _processAxeResultsForPage(results))
|
47
47
|
})
|
48
48
|
}
|
49
49
|
|
50
|
-
var _consoleErrorText = function(violations, url) {
|
50
|
+
var _consoleErrorText = function (violations, url) {
|
51
51
|
if (violations.length !== 0) {
|
52
52
|
return (
|
53
53
|
'\n' + 'Accessibility issues at ' +
|
@@ -69,28 +69,28 @@
|
|
69
69
|
}
|
70
70
|
}
|
71
71
|
|
72
|
-
var _processAxeResultsForPage = function(results) {
|
72
|
+
var _processAxeResultsForPage = function (results) {
|
73
73
|
return {
|
74
74
|
violations: _mapSummaryAndCause(results.violations),
|
75
75
|
incompleteWarnings: _mapSummaryAndCause(results.incomplete)
|
76
76
|
}
|
77
77
|
}
|
78
78
|
|
79
|
-
var _mapSummaryAndCause = function(resultsArray) {
|
79
|
+
var _mapSummaryAndCause = function (resultsArray) {
|
80
80
|
return resultsArray.map(function (result) {
|
81
81
|
var cssSelector = result.nodes.map(function (node) {
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
82
|
+
return {
|
83
|
+
selector: node.target,
|
84
|
+
reasons: node.any.map(function (item) {
|
85
|
+
return item.message
|
86
|
+
})
|
87
|
+
}
|
88
|
+
})
|
89
89
|
return {
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
id: result.id,
|
91
|
+
summary: result.help,
|
92
|
+
selectors: cssSelector,
|
93
|
+
url: result.helpUrl
|
94
94
|
}
|
95
95
|
})
|
96
96
|
}
|
@@ -127,7 +127,7 @@
|
|
127
127
|
// Section to announce the overall problem.
|
128
128
|
var headerNodeLink = document.createElement('a')
|
129
129
|
headerNodeLink.href = result.url
|
130
|
-
headerNodeLink.textContent =
|
130
|
+
headerNodeLink.textContent = '(see guidance)'
|
131
131
|
|
132
132
|
var headerNode = document.createElement('h3')
|
133
133
|
headerNode.textContent = result.summary + ' (' + result.id + ') '
|
@@ -1,35 +1,35 @@
|
|
1
|
-
(function() {
|
2
|
-
window.GOVUK = window.GOVUK || {}
|
1
|
+
(function () {
|
2
|
+
window.GOVUK = window.GOVUK || {}
|
3
3
|
|
4
|
-
window.GOVUK.FilterComponents = function filterList(searchTerm) {
|
5
|
-
var itemsToFilter = document.querySelectorAll('.component-list li')
|
4
|
+
window.GOVUK.FilterComponents = function filterList (searchTerm) {
|
5
|
+
var itemsToFilter = document.querySelectorAll('.component-list li')
|
6
6
|
|
7
|
-
for (var i = 0; i < itemsToFilter.length; i++
|
8
|
-
var currentComponent = itemsToFilter[i]
|
9
|
-
var componentText = currentComponent.innerText.toLowerCase()
|
7
|
+
for (var i = 0; i < itemsToFilter.length; i++) {
|
8
|
+
var currentComponent = itemsToFilter[i]
|
9
|
+
var componentText = currentComponent.innerText.toLowerCase()
|
10
10
|
|
11
11
|
if (componentText.includes(searchTerm.toLowerCase())) {
|
12
|
-
currentComponent.classList.remove('component-guide-hidden')
|
12
|
+
currentComponent.classList.remove('component-guide-hidden')
|
13
13
|
} else {
|
14
|
-
currentComponent.classList.add('component-guide-hidden')
|
14
|
+
currentComponent.classList.add('component-guide-hidden')
|
15
15
|
}
|
16
16
|
}
|
17
|
-
}
|
17
|
+
}
|
18
18
|
|
19
|
-
var formElement = document.querySelector('[data-module=filter-components]')
|
19
|
+
var formElement = document.querySelector('[data-module=filter-components]')
|
20
20
|
|
21
21
|
if (formElement) {
|
22
|
-
var searchField = formElement.querySelector('input')
|
22
|
+
var searchField = formElement.querySelector('input')
|
23
23
|
|
24
24
|
// We don't want the form to submit/refresh the page on enter key
|
25
|
-
formElement.addEventListener('submit', function(e) { e.preventDefault()
|
25
|
+
formElement.addEventListener('submit', function (e) { e.preventDefault() })
|
26
26
|
|
27
|
-
searchField.addEventListener('input', function(e) {
|
28
|
-
var searchTerm = searchField.value
|
29
|
-
window.GOVUK.FilterComponents(searchTerm)
|
30
|
-
})
|
27
|
+
searchField.addEventListener('input', function (e) {
|
28
|
+
var searchTerm = searchField.value
|
29
|
+
window.GOVUK.FilterComponents(searchTerm)
|
30
|
+
})
|
31
31
|
|
32
32
|
// trigger search if search query exists in query string on page load
|
33
|
-
window.GOVUK.FilterComponents(searchField.value)
|
33
|
+
window.GOVUK.FilterComponents(searchField.value)
|
34
34
|
}
|
35
|
-
})()
|
35
|
+
})()
|
@@ -2,69 +2,70 @@
|
|
2
2
|
window.GOVUK = window.GOVUK || {}
|
3
3
|
|
4
4
|
window.GOVUK.VisualDiffTool = function (currentWindowLocation) {
|
5
|
-
var visualDiffSelector = 'visual-diff'
|
6
|
-
var existingIframe = document.getElementById(visualDiffSelector)
|
7
|
-
var windowLocation = currentWindowLocation || window.location
|
5
|
+
var visualDiffSelector = 'visual-diff'
|
6
|
+
var existingIframe = document.getElementById(visualDiffSelector)
|
7
|
+
var windowLocation = currentWindowLocation || window.location
|
8
8
|
|
9
9
|
if (existingIframe) {
|
10
|
-
existingIframe.parentNode.removeChild(existingIframe)
|
11
|
-
document.body.style.filter = null
|
10
|
+
existingIframe.parentNode.removeChild(existingIframe)
|
11
|
+
document.body.style.filter = null
|
12
12
|
} else {
|
13
|
-
var iframe = document.createElement('iframe')
|
14
|
-
iframe.id =
|
15
|
-
iframe.setAttribute('scrolling', 'no')
|
13
|
+
var iframe = document.createElement('iframe')
|
14
|
+
iframe.id = visualDiffSelector
|
15
|
+
iframe.setAttribute('scrolling', 'no')
|
16
16
|
_setElementStyles(iframe, {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
width: '100%',
|
18
|
+
height: document.body.scrollHeight + 'px',
|
19
|
+
position: 'absolute',
|
20
|
+
top: '0',
|
21
21
|
'pointer-events': 'none',
|
22
|
-
|
23
|
-
})
|
24
|
-
iframe.style.setProperty('z-index', '999','important')
|
22
|
+
border: '0'
|
23
|
+
})
|
24
|
+
iframe.style.setProperty('z-index', '999', 'important')
|
25
25
|
|
26
26
|
// For browsers that support it, do mix-blend-mode diff
|
27
27
|
if ('mix-blend-mode' in document.body.style) {
|
28
|
-
_setElementStyles(iframe, {'mix-blend-mode': 'difference'})
|
29
|
-
document.body.style.filter = 'invert(100%)'
|
28
|
+
_setElementStyles(iframe, { 'mix-blend-mode': 'difference' })
|
29
|
+
document.body.style.filter = 'invert(100%)'
|
30
30
|
} else {
|
31
31
|
// Else do a simple overlay of the live page for comparison (IE and Edge)
|
32
|
-
_setElementStyles(iframe, {
|
32
|
+
_setElementStyles(iframe, { opacity: '0.7' })
|
33
33
|
}
|
34
34
|
|
35
|
-
iframe.src = _processComparisonURL(windowLocation)
|
35
|
+
iframe.src = _processComparisonURL(windowLocation)
|
36
36
|
|
37
37
|
if (iframe.src) {
|
38
|
-
document.body.appendChild(iframe)
|
39
|
-
console.log(
|
38
|
+
document.body.appendChild(iframe)
|
39
|
+
console.log('comparing to ' + iframe.src)
|
40
40
|
}
|
41
41
|
}
|
42
|
-
}
|
42
|
+
}
|
43
43
|
|
44
44
|
var _processComparisonURL = function (url) {
|
45
|
-
var
|
46
|
-
var
|
45
|
+
var appName
|
46
|
+
var href = url.href
|
47
|
+
var host = url.host
|
47
48
|
|
48
49
|
if (href.includes('dev.gov.uk/component-guide')) {
|
49
|
-
|
50
|
-
return _forceHTTPS(href.replace(host, appName + '.herokuapp.com'))
|
50
|
+
appName = host.split('.')[0]
|
51
|
+
return _forceHTTPS(href.replace(host, appName + '.herokuapp.com'))
|
51
52
|
} else if (href.includes('dev.gov.uk')) {
|
52
|
-
return _forceHTTPS(href.replace(host, 'www.gov.uk'))
|
53
|
+
return _forceHTTPS(href.replace(host, 'www.gov.uk'))
|
53
54
|
} else if (href.includes('-pr-')) {
|
54
|
-
|
55
|
-
return _forceHTTPS(href.replace(host, appName + '.herokuapp.com'))
|
55
|
+
appName = host.split('-pr')[0]
|
56
|
+
return _forceHTTPS(href.replace(host, appName + '.herokuapp.com'))
|
56
57
|
} else {
|
57
|
-
throw new Error('Visual Diff Tool: You need to run this tool against a page running on your local dev environment')
|
58
|
+
throw new Error('Visual Diff Tool: You need to run this tool against a page running on your local dev environment')
|
58
59
|
}
|
59
|
-
}
|
60
|
+
}
|
60
61
|
|
61
|
-
var _forceHTTPS = function(href) {
|
62
|
-
return href.replace('http://', 'https://')
|
62
|
+
var _forceHTTPS = function (href) {
|
63
|
+
return href.replace('http://', 'https://')
|
63
64
|
}
|
64
65
|
|
65
|
-
var _setElementStyles = function(element, styles) {
|
66
|
+
var _setElementStyles = function (element, styles) {
|
66
67
|
for (var style in styles) {
|
67
|
-
element.style[style] = styles[style]
|
68
|
+
element.style[style] = styles[style]
|
68
69
|
}
|
69
|
-
}
|
70
|
-
})(window, document)
|
70
|
+
}
|
71
|
+
})(window, document)
|
@@ -42,8 +42,8 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
|
|
42
42
|
if (typeof options !== 'object' || options === null) {
|
43
43
|
options = {}
|
44
44
|
}
|
45
|
-
options
|
46
|
-
options
|
45
|
+
options.value = $checkbox.data('track-value')
|
46
|
+
options.label = $checkbox.data('track-label')
|
47
47
|
window.GOVUK.analytics.trackEvent(category, action, options)
|
48
48
|
}
|
49
49
|
}
|
@@ -20,9 +20,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
20
20
|
var detailsClick = detailsComponent.querySelector('[data-details-track-click]')
|
21
21
|
var that = this
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
if (detailsClick) {
|
24
|
+
detailsClick.addEventListener('click', function (event) {
|
25
|
+
that.trackDefault(detailsComponent)
|
26
|
+
})
|
27
|
+
}
|
26
28
|
}
|
27
29
|
}
|
28
30
|
|
@@ -37,7 +39,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
37
39
|
trackOptions = {}
|
38
40
|
}
|
39
41
|
|
40
|
-
trackOptions
|
42
|
+
trackOptions.label = componentStatus
|
41
43
|
|
42
44
|
if (trackAction && trackCategory) {
|
43
45
|
window.GOVUK.analytics.trackEvent(trackCategory, trackAction, trackOptions)
|
@@ -405,7 +405,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
405
405
|
var dimension28 = $(event.target).closest('.gem-c-step-nav__list').attr('data-length')
|
406
406
|
|
407
407
|
if (dimension28) {
|
408
|
-
trackingOptions
|
408
|
+
trackingOptions.dimension28 = dimension28
|
409
409
|
}
|
410
410
|
|
411
411
|
stepNavTracker.track('stepNavLinkClicked', linkPosition, trackingOptions)
|
@@ -421,9 +421,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
421
421
|
// dimension28 records the number of links in the step that was shown/hidden (handled in click event)
|
422
422
|
if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
|
423
423
|
options = options || {}
|
424
|
-
options
|
425
|
-
options
|
426
|
-
options
|
424
|
+
options.dimension26 = options.dimension26 || totalSteps.toString()
|
425
|
+
options.dimension27 = options.dimension27 || totalLinks.toString()
|
426
|
+
options.dimension96 = options.dimension96 || uniqueId
|
427
427
|
window.GOVUK.analytics.trackEvent(category, action, options)
|
428
428
|
}
|
429
429
|
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// migrated from govuk_frontend_toolkit
|
2
|
+
;(function (global) {
|
3
|
+
'use strict'
|
4
|
+
|
5
|
+
var GOVUK = global.GOVUK || {}
|
6
|
+
GOVUK.Modules = GOVUK.Modules || {}
|
7
|
+
|
8
|
+
GOVUK.Modules.AutoTrackEvent = function () {
|
9
|
+
this.start = function (element) {
|
10
|
+
var options = { nonInteraction: 1 } // automatic events shouldn't affect bounce rate
|
11
|
+
var category = element.data('track-category')
|
12
|
+
var action = element.data('track-action')
|
13
|
+
var label = element.data('track-label')
|
14
|
+
var value = element.data('track-value')
|
15
|
+
|
16
|
+
if (typeof label === 'string') {
|
17
|
+
options.label = label
|
18
|
+
}
|
19
|
+
|
20
|
+
if (value || value === 0) {
|
21
|
+
options.value = value
|
22
|
+
}
|
23
|
+
|
24
|
+
if (GOVUK.analytics && GOVUK.analytics.trackEvent) {
|
25
|
+
GOVUK.analytics.trackEvent(category, action, options)
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
global.GOVUK = GOVUK
|
31
|
+
})(window)
|
@@ -5,31 +5,31 @@
|
|
5
5
|
window.GOVUK = window.GOVUK || {}
|
6
6
|
|
7
7
|
var DEFAULT_COOKIE_CONSENT = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
essential: true,
|
9
|
+
settings: false,
|
10
|
+
usage: false,
|
11
|
+
campaigns: false
|
12
12
|
}
|
13
13
|
|
14
14
|
var COOKIE_CATEGORIES = {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
cookies_policy: 'essential',
|
16
|
+
seen_cookie_message: 'essential',
|
17
|
+
cookie_preferences_set: 'essential',
|
18
|
+
cookies_preferences_set: 'essential',
|
19
19
|
'_email-alert-frontend_session': 'essential',
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
20
|
+
licensing_session: 'essential',
|
21
|
+
govuk_contact_referrer: 'essential',
|
22
|
+
multivariatetest_cohort_coronavirus_extremely_vulnerable_rate_limit: 'essential',
|
23
|
+
dgu_beta_banner_dismissed: 'settings',
|
24
|
+
global_bar_seen: 'settings',
|
25
|
+
govuk_browser_upgrade_dismisssed: 'settings',
|
26
|
+
govuk_not_first_visit: 'settings',
|
27
|
+
analytics_next_page_call: 'usage',
|
28
|
+
_ga: 'usage',
|
29
|
+
_gid: 'usage',
|
30
|
+
_gat: 'usage',
|
31
31
|
'JS-Detection': 'usage',
|
32
|
-
|
32
|
+
TLSversion: 'usage'
|
33
33
|
}
|
34
34
|
|
35
35
|
/*
|
@@ -69,10 +69,10 @@
|
|
69
69
|
|
70
70
|
window.GOVUK.approveAllCookieTypes = function () {
|
71
71
|
var approvedConsent = {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
essential: true,
|
73
|
+
settings: true,
|
74
|
+
usage: true,
|
75
|
+
campaigns: true
|
76
76
|
}
|
77
77
|
|
78
78
|
window.GOVUK.setCookie('cookies_policy', JSON.stringify(approvedConsent), { days: 365 })
|