govuk_publishing_components 21.57.1 → 21.60.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) 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/step-by-step-nav.js +4 -4
  9. data/app/assets/javascripts/govuk_publishing_components/lib/auto-track-event.js +31 -0
  10. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +24 -24
  11. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +17 -17
  12. data/app/assets/stylesheets/component_guide/application.scss +15 -15
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +0 -8
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -1
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +4 -0
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +1 -8
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +0 -1
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +4 -5
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +3 -8
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +1 -1
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +1 -1
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +5 -8
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_list.scss +1 -0
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +4 -0
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -2
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +7 -3
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +0 -5
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +1 -4
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +8 -12
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +21 -24
  31. data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +4 -8
  32. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +2 -0
  33. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -4
  34. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +6 -6
  35. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +2 -0
  36. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +2 -0
  37. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -0
  38. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +1 -1
  39. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +2 -0
  40. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -1
  41. data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +2 -0
  42. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +0 -4
  43. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss +2 -10
  44. data/app/controllers/govuk_publishing_components/audit_controller.rb +52 -0
  45. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +2 -1
  46. data/app/models/govuk_publishing_components/audit_applications.rb +117 -0
  47. data/app/models/govuk_publishing_components/audit_comparer.rb +198 -0
  48. data/app/models/govuk_publishing_components/audit_components.rb +158 -0
  49. data/app/views/govuk_publishing_components/audit/show.html.erb +258 -0
  50. data/app/views/govuk_publishing_components/component_guide/index.html.erb +9 -4
  51. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  52. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
  53. data/app/views/govuk_publishing_components/components/_list.html.erb +26 -0
  54. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
  55. data/app/views/govuk_publishing_components/components/_radio.html.erb +13 -5
  56. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +2 -2
  57. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +4 -0
  58. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +45 -0
  59. data/app/views/govuk_publishing_components/components/docs/heading.yml +6 -3
  60. data/app/views/govuk_publishing_components/components/docs/image_card.yml +13 -1
  61. data/app/views/govuk_publishing_components/components/docs/list.yml +64 -0
  62. data/app/views/govuk_publishing_components/components/docs/radio.yml +4 -0
  63. data/config/routes.rb +1 -0
  64. data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +15 -7
  65. data/lib/govuk_publishing_components/presenters/heading_helper.rb +21 -1
  66. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +2 -1
  67. data/lib/govuk_publishing_components/version.rb +1 -1
  68. data/node_modules/axe-core/package.json +145 -220
  69. data/node_modules/govuk-frontend/govuk/all.js +160 -57
  70. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +16 -8
  71. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +6 -0
  72. data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -0
  73. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -5
  74. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +68 -21
  75. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  76. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +0 -27
  77. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -3
  78. data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
  79. data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
  80. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +2 -2
  81. data/node_modules/govuk-frontend/govuk/components/hint/template.njk +2 -2
  82. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +0 -3
  83. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +6 -0
  84. data/node_modules/govuk-frontend/govuk/components/input/template.njk +1 -0
  85. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +76 -28
  86. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +0 -3
  87. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -0
  88. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +0 -3
  89. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +6 -0
  90. data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +1 -0
  91. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +4 -2
  92. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +1 -1
  93. data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +2 -2
  94. data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +1 -1
  95. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +4 -1
  96. data/node_modules/govuk-frontend/package.json +14 -81
  97. data/node_modules/jquery/package.json +44 -116
  98. metadata +46 -66
  99. data/Rakefile +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5de5c1f4596f4f0f7eae60d3c76ad22f0ed61ce04619e72a7c9074ba3a31320c
4
- data.tar.gz: 8feefd4ad704ce099dca964212c995b76aeef60c628458033e1b2611aabfecaa
3
+ metadata.gz: 98fa4203e2dd5c9bbcc5ecfc9b64d18612a1434167c1ece8b4203ade58c0c45a
4
+ data.tar.gz: f24e38e566e25ad2dc6c5d6fb954cf91cc7f43a9b6f46fabd0a08b184d69bb21
5
5
  SHA512:
6
- metadata.gz: d396d8049e9a935808e3b3468b6a623a7d2d5093433037381278e2b907a664547007a124b34f1e91a5394a3bad076ad45f89fc1ba49a70505ea7b29e21ef9ff3
7
- data.tar.gz: 7d4295428f49d6d1e7db3c3f1894aa48ddcb32a39ba5cd95c169ae725cd86869f0257d4ae94da27265e2614ebe949c948f3feb28bd42fa266d2feb8a8e3e50b7
6
+ metadata.gz: 3c9342c8d542a1a703f5700ffa6fa87d0fa253641a45d549176b8f6d0b4b6a8cefb73602cc4351afdd3ce35f307380a599e95fd1df2c14301acc55c9542f5987
7
+ data.tar.gz: 1179277ccaaa0b9758c4f0dfe723472a852525a2dbd9607f2a6d52033307232f53383e17812237975a0df232cd0e3c04ea31363ae1f85c5e6b81938579932006
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)
@@ -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 })