govuk_publishing_components 21.58.0 → 21.60.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) 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 +5 -3
  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/_radio.scss +4 -0
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -2
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +0 -1
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +0 -5
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +1 -4
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +8 -12
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +21 -24
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +4 -8
  31. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +2 -0
  32. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -4
  33. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +6 -6
  34. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +2 -0
  35. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +2 -0
  36. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -0
  37. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +1 -1
  38. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +2 -0
  39. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -1
  40. data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +2 -0
  41. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +0 -4
  42. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss +2 -10
  43. data/app/controllers/govuk_publishing_components/audit_controller.rb +52 -0
  44. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +2 -2
  45. data/app/models/govuk_publishing_components/audit_applications.rb +117 -0
  46. data/app/models/govuk_publishing_components/audit_comparer.rb +198 -0
  47. data/app/models/govuk_publishing_components/audit_components.rb +158 -0
  48. data/app/views/govuk_publishing_components/audit/show.html.erb +258 -0
  49. data/app/views/govuk_publishing_components/component_guide/index.html.erb +7 -1
  50. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  51. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
  52. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
  53. data/app/views/govuk_publishing_components/components/_radio.html.erb +13 -5
  54. data/app/views/govuk_publishing_components/components/_share_links.html.erb +9 -9
  55. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +2 -2
  56. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +4 -0
  57. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +45 -0
  58. data/app/views/govuk_publishing_components/components/docs/heading.yml +6 -3
  59. data/app/views/govuk_publishing_components/components/docs/image_card.yml +13 -1
  60. data/app/views/govuk_publishing_components/components/docs/radio.yml +4 -0
  61. data/config/routes.rb +1 -0
  62. data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +15 -7
  63. data/lib/govuk_publishing_components/presenters/heading_helper.rb +21 -1
  64. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +2 -1
  65. data/lib/govuk_publishing_components/version.rb +1 -1
  66. data/node_modules/axe-core/package.json +145 -220
  67. data/node_modules/govuk-frontend/govuk/all.js +160 -57
  68. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +16 -8
  69. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +6 -0
  70. data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -0
  71. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -5
  72. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +68 -21
  73. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  74. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +0 -27
  75. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -3
  76. data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
  77. data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
  78. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +2 -2
  79. data/node_modules/govuk-frontend/govuk/components/hint/template.njk +2 -2
  80. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +0 -3
  81. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +6 -0
  82. data/node_modules/govuk-frontend/govuk/components/input/template.njk +1 -0
  83. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +76 -28
  84. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +0 -3
  85. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -0
  86. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +0 -3
  87. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +6 -0
  88. data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +1 -0
  89. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +4 -2
  90. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +1 -1
  91. data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +2 -2
  92. data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +1 -1
  93. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +4 -1
  94. data/node_modules/govuk-frontend/package.json +14 -81
  95. data/node_modules/jquery/package.json +44 -116
  96. metadata +29 -66
  97. data/Rakefile +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e165b9cdf4f92f02644b2e82c82c8c6b116379b86d5d4508437dc8ccfd25bd81
4
- data.tar.gz: 2be44d5b0942debce73048f3bec3786cc9398ae37de322016b253ccfe220442a
3
+ metadata.gz: bd3245e0cdf7e3e67b6d52bb1dd412499ac608766900b4ebed6dea1813233900
4
+ data.tar.gz: ee70139d40fc9ae93bddcb4c689fe8450d6dbb160ae90896d59da917a7488f39
5
5
  SHA512:
6
- metadata.gz: 9a3a06af1b35ecdc351c4d1da7b65ac95bd601a9b2f6f0049e17a84b15768872e478b44c170d2e9579992fd0ca092d60c4c91c049ed2edf48c0e0a1e9f9e7b44
7
- data.tar.gz: 457fceebbb07d07f8afa3c0ab11c7057659a7df2e6d7a409a472ecfdb5a821147cd6918c4568ded4a063a9c53ef5a9764543c0de507085f62b33f1f0aca91df1
6
+ metadata.gz: 85f5de1b7a4c78fc4cb88a35a001fe907e4ed00a9979f2aec8fdb52e6eb1f57c3b8bbaa3ff536f50c288f30e8a985cd8ae1200ddf4eb736fe36949516284f082
7
+ data.tar.gz: bcc63f4a0c79860a328443f2561ecd1ba0c53cfde5ccd37682c2799748a36570a5830a3769cb221c406723e4947b9d45803c55c13f9e0d415556d1e134b11f9c
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.addEventListener('click', function (event) {
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
 
@@ -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 })