govuk_publishing_components 21.56.2 → 21.60.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -6
  3. data/app/assets/javascripts/component_guide/accessibility-test.js +21 -21
  4. data/app/assets/javascripts/component_guide/filter-components.js +19 -19
  5. data/app/assets/javascripts/component_guide/visual-regression.js +38 -37
  6. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +2 -2
  7. data/app/assets/javascripts/govuk_publishing_components/components/details.js +6 -4
  8. data/app/assets/javascripts/govuk_publishing_components/components/print-link.js +14 -0
  9. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +4 -4
  10. data/app/assets/javascripts/govuk_publishing_components/lib/auto-track-event.js +31 -0
  11. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +24 -24
  12. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +17 -17
  13. data/app/assets/stylesheets/component_guide/application.scss +15 -15
  14. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +9 -11
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -1
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +4 -0
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +5 -8
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +0 -1
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +4 -5
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +3 -8
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +1 -1
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +1 -1
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +5 -8
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_list.scss +1 -0
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +52 -0
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +4 -0
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -2
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +7 -3
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +0 -5
  31. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +1 -4
  32. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +8 -12
  33. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +21 -24
  34. data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +4 -8
  35. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +2 -0
  36. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -4
  37. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +2 -4
  38. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +2 -0
  39. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +2 -0
  40. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -0
  41. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +1 -1
  42. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +2 -0
  43. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -1
  44. data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +7 -1
  45. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +0 -4
  46. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss +2 -10
  47. data/app/controllers/govuk_publishing_components/audit_controller.rb +52 -0
  48. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +2 -1
  49. data/app/models/govuk_publishing_components/audit_applications.rb +105 -0
  50. data/app/models/govuk_publishing_components/audit_comparer.rb +185 -0
  51. data/app/models/govuk_publishing_components/audit_components.rb +158 -0
  52. data/app/views/govuk_publishing_components/audit/show.html.erb +229 -0
  53. data/app/views/govuk_publishing_components/component_guide/index.html.erb +9 -4
  54. data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -0
  55. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  56. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +3 -1
  57. data/app/views/govuk_publishing_components/components/_list.html.erb +26 -0
  58. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
  59. data/app/views/govuk_publishing_components/components/_print_link.html.erb +27 -0
  60. data/app/views/govuk_publishing_components/components/_radio.html.erb +13 -5
  61. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +2 -2
  62. data/app/views/govuk_publishing_components/components/docs/action_link.yml +5 -0
  63. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +4 -0
  64. data/app/views/govuk_publishing_components/components/docs/heading.yml +6 -3
  65. data/app/views/govuk_publishing_components/components/docs/list.yml +64 -0
  66. data/app/views/govuk_publishing_components/components/docs/print_link.yml +24 -0
  67. data/app/views/govuk_publishing_components/components/docs/radio.yml +4 -0
  68. data/config/locales/en.yml +2 -0
  69. data/config/routes.rb +1 -0
  70. data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +15 -7
  71. data/lib/govuk_publishing_components/presenters/heading_helper.rb +21 -1
  72. data/lib/govuk_publishing_components/version.rb +1 -1
  73. data/node_modules/axe-core/package.json +145 -220
  74. data/node_modules/govuk-frontend/package.json +14 -81
  75. data/node_modules/jquery/package.json +44 -116
  76. metadata +50 -66
  77. data/Rakefile +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4c762079459f5284a3c2d8077bb92136586f9a3fb1bd41f38b5a37b8c557b04
4
- data.tar.gz: 9a458d78da7c878aa9f1863e485b4b59bce139f5d4295d76df88a5da2144ede0
3
+ metadata.gz: 6b8116f535e5bc9da283f603082fc02523e8676608726754358886cdb2567016
4
+ data.tar.gz: 6f9d0752fe36925881d43c0d97738a987ea8196371f1830fbab336ef00c0f37a
5
5
  SHA512:
6
- metadata.gz: '0879f5adc27997f08246bc8b8fc17a3538c1892fb90cfea51354aa2414d8b353fc5bc74287cb76299ecaf2f09c1f59f6306f7b7bff6362b4f22c21392ed79aaa'
7
- data.tar.gz: 1cc60f11f0acfb2132922599454a1888663e4b5c864c092a77f84e44bea82559322812c6154d830db7163d3dc6aff8f1e1165e4576b4d96ce028ba7cf56cf69e
6
+ metadata.gz: d439c10348f41bafc7a1d84b42c1d3b662fd1b227ca4575ef649df0b41b22f58291318874eb018443b14d5bb5c2ecc9dd235e2399b28eb0cb1749003a9c1a4fb
7
+ data.tar.gz: 37af2ed2a8fa27fb8b515fb05947f987d686cce61a18a249e284d8879ef5b5d62086b2ba1d051236e537686ed50fc636de75f711d1410585a611dc586fbafad9
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 [NPM](https://www.npmjs.com/).
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
- Run the documentation locally with:
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 exec yard server --reload
57
+ bundle install
58
+ yarn install
51
59
  ```
52
60
 
53
- ## Running tests
61
+ ### Running tests
54
62
 
55
- The default rake task runs all tests:
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 === "undefined") {
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 ? "js-test-a11y-success" : "js-test-a11y-failed"
43
- document.body.classList.add(bodyClass);
44
- document.body.classList.add("js-test-a11y-finished");
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
- return {
83
- 'selector': node.target,
84
- 'reasons': node.any.map(function(item) {
85
- return item.message
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
- 'id': result.id,
91
- 'summary': result.help,
92
- 'selectors': cssSelector,
93
- 'url': result.helpUrl
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 = "(see guidance)"
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 = visualDiffSelector;
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
- 'width': '100%',
18
- 'height': document.body.scrollHeight + 'px',
19
- 'position': 'absolute',
20
- 'top': '0',
17
+ width: '100%',
18
+ height: document.body.scrollHeight + 'px',
19
+ position: 'absolute',
20
+ top: '0',
21
21
  'pointer-events': 'none',
22
- 'border': '0'
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, {'opacity': '0.7'});
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("comparing to " + iframe.src);
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 href = url.href;
46
- var host = url.host;
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
- var appName = host.split('.')[0];
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
- var appName = host.split('-pr')[0];
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['value'] = $checkbox.data('track-value')
46
- options['label'] = $checkbox.data('track-label')
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
- $(detailsClick).click(function (e) {
24
- that.trackDefault(detailsComponent)
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['label'] = componentStatus
42
+ trackOptions.label = componentStatus
41
43
 
42
44
  if (trackAction && trackCategory) {
43
45
  window.GOVUK.analytics.trackEvent(trackCategory, trackAction, trackOptions)
@@ -0,0 +1,14 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.Modules = window.GOVUK.Modules || {};
3
+
4
+ (function (Modules) {
5
+ 'use strict'
6
+
7
+ Modules.PrintLink = function () {
8
+ this.start = function (element) {
9
+ element[0].addEventListener('click', function () {
10
+ window.print()
11
+ })
12
+ }
13
+ }
14
+ })(window.GOVUK.Modules)
@@ -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['dimension28'] = dimension28
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['dimension26'] = options['dimension26'] || totalSteps.toString()
425
- options['dimension27'] = options['dimension27'] || totalLinks.toString()
426
- options['dimension96'] = options['dimension96'] || uniqueId
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
- 'essential': true,
9
- 'settings': false,
10
- 'usage': false,
11
- 'campaigns': false
8
+ essential: true,
9
+ settings: false,
10
+ usage: false,
11
+ campaigns: false
12
12
  }
13
13
 
14
14
  var COOKIE_CATEGORIES = {
15
- 'cookies_policy': 'essential',
16
- 'seen_cookie_message': 'essential',
17
- 'cookie_preferences_set': 'essential',
18
- 'cookies_preferences_set': 'essential',
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
- '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',
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
- 'TLSversion': 'usage'
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
- 'essential': true,
73
- 'settings': true,
74
- 'usage': true,
75
- 'campaigns': true
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 })