govuk_publishing_components 27.18.0 → 28.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-170.jpg +0 -0
  3. data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-240.jpg +0 -0
  4. data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-320.jpg +0 -0
  5. data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26-480.jpg +0 -0
  6. data/app/assets/images/govuk_publishing_components/image-card-srcset/cop26.jpg +0 -0
  7. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +2 -20
  8. data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +21 -16
  9. data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +46 -32
  10. data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +20 -7
  11. data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +22 -17
  12. data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +4 -4
  13. data/app/assets/javascripts/govuk_publishing_components/analytics.js +1 -1
  14. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +18 -18
  15. data/app/assets/javascripts/govuk_publishing_components/components/metadata.js +27 -0
  16. data/app/assets/javascripts/govuk_publishing_components/lib/extend-object.js +22 -0
  17. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -2
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +19 -14
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +6 -35
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +17 -7
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_signup-link.scss +34 -0
  22. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +7 -0
  23. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +6 -0
  24. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -1
  25. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -0
  26. data/app/views/govuk_publishing_components/components/_intervention.html.erb +10 -1
  27. data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -2
  28. data/app/views/govuk_publishing_components/components/_signup_link.html.erb +30 -0
  29. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +3 -3
  30. data/app/views/govuk_publishing_components/components/contextual_sidebar/_covid_cta.html.erb +27 -0
  31. data/app/views/govuk_publishing_components/components/docs/accordion.yml +31 -25
  32. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +15 -87
  33. data/app/views/govuk_publishing_components/components/docs/feedback.yml +5 -0
  34. data/app/views/govuk_publishing_components/components/docs/image_card.yml +29 -0
  35. data/app/views/govuk_publishing_components/components/docs/input.yml +1 -1
  36. data/app/views/govuk_publishing_components/components/docs/intervention.yml +9 -0
  37. data/app/views/govuk_publishing_components/components/docs/signup_link.yml +39 -0
  38. data/app/views/govuk_publishing_components/components/docs/success_alert.yml +1 -1
  39. data/app/views/govuk_publishing_components/components/docs/tabs.yml +2 -2
  40. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +9 -6
  41. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +4 -3
  42. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +4 -4
  43. data/config/locales/ar.yml +0 -8
  44. data/config/locales/az.yml +0 -8
  45. data/config/locales/be.yml +0 -8
  46. data/config/locales/bg.yml +0 -8
  47. data/config/locales/bn.yml +0 -8
  48. data/config/locales/cs.yml +0 -8
  49. data/config/locales/cy.yml +0 -8
  50. data/config/locales/da.yml +0 -8
  51. data/config/locales/de.yml +0 -8
  52. data/config/locales/dr.yml +0 -8
  53. data/config/locales/el.yml +0 -8
  54. data/config/locales/en.yml +4 -10
  55. data/config/locales/es-419.yml +0 -8
  56. data/config/locales/es.yml +0 -8
  57. data/config/locales/et.yml +0 -8
  58. data/config/locales/fa.yml +0 -8
  59. data/config/locales/fi.yml +0 -8
  60. data/config/locales/fr.yml +0 -8
  61. data/config/locales/gd.yml +0 -8
  62. data/config/locales/gu.yml +0 -8
  63. data/config/locales/he.yml +0 -8
  64. data/config/locales/hi.yml +0 -8
  65. data/config/locales/hr.yml +0 -8
  66. data/config/locales/hu.yml +0 -8
  67. data/config/locales/hy.yml +0 -8
  68. data/config/locales/id.yml +0 -8
  69. data/config/locales/is.yml +0 -8
  70. data/config/locales/it.yml +0 -8
  71. data/config/locales/ja.yml +0 -8
  72. data/config/locales/ka.yml +0 -8
  73. data/config/locales/kk.yml +0 -8
  74. data/config/locales/ko.yml +0 -8
  75. data/config/locales/lt.yml +0 -8
  76. data/config/locales/lv.yml +0 -8
  77. data/config/locales/ms.yml +0 -8
  78. data/config/locales/mt.yml +0 -8
  79. data/config/locales/nl.yml +0 -8
  80. data/config/locales/no.yml +0 -8
  81. data/config/locales/pa-pk.yml +0 -8
  82. data/config/locales/pa.yml +0 -8
  83. data/config/locales/pl.yml +0 -8
  84. data/config/locales/ps.yml +0 -8
  85. data/config/locales/pt.yml +0 -8
  86. data/config/locales/ro.yml +0 -8
  87. data/config/locales/ru.yml +0 -8
  88. data/config/locales/si.yml +0 -8
  89. data/config/locales/sk.yml +0 -8
  90. data/config/locales/sl.yml +0 -8
  91. data/config/locales/so.yml +0 -8
  92. data/config/locales/sq.yml +0 -8
  93. data/config/locales/sr.yml +0 -8
  94. data/config/locales/sv.yml +0 -8
  95. data/config/locales/sw.yml +0 -8
  96. data/config/locales/ta.yml +0 -8
  97. data/config/locales/th.yml +0 -8
  98. data/config/locales/tk.yml +0 -8
  99. data/config/locales/tr.yml +0 -8
  100. data/config/locales/uk.yml +0 -8
  101. data/config/locales/ur.yml +0 -8
  102. data/config/locales/uz.yml +0 -8
  103. data/config/locales/vi.yml +0 -8
  104. data/config/locales/zh-hk.yml +0 -8
  105. data/config/locales/zh-tw.yml +0 -8
  106. data/config/locales/zh.yml +0 -8
  107. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +42 -170
  108. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +11 -1
  109. data/lib/govuk_publishing_components/version.rb +1 -1
  110. data/lib/govuk_publishing_components.rb +0 -2
  111. metadata +13 -15
  112. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +0 -237
  113. data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +0 -84
  114. data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss +0 -21
  115. data/app/views/govuk_publishing_components/components/_admin_analytics.html.erb +0 -20
  116. data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +0 -86
  117. data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +0 -47
  118. data/app/views/govuk_publishing_components/components/_taxonomy_list.html.erb +0 -30
  119. data/app/views/govuk_publishing_components/components/docs/admin_analytics.yml +0 -10
  120. data/app/views/govuk_publishing_components/components/docs/government_navigation.yml +0 -20
  121. data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +0 -171
  122. data/app/views/govuk_publishing_components/components/docs/taxonomy_list.yml +0 -112
  123. data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +0 -13
  124. data/lib/govuk_publishing_components/presenters/taxonomy_list_helper.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49373bd0b9e370b948f7c91c83647ca22f7f2e112bb0d12dee4686c980f831f4
4
- data.tar.gz: 4868f4234fcf242d553c90ab60f35e2354480c30f6c44f3066b5fc60079175b7
3
+ metadata.gz: 2a90a944a517c66a97121936cc0fee97cf36ba037cbefc30579881313d0f9418
4
+ data.tar.gz: 526baf44347165d08e819351c05660ebb3cb7e54267ce1ae5c220898158d2660
5
5
  SHA512:
6
- metadata.gz: 7e68c23966e5498ca1ae0c386d2a91703b94bac02808fbae86755ca35b12d3fdd45859a2d3eaa6f052912890296554c0478c717354bd29fb1dd5336a8a3bad5e
7
- data.tar.gz: ada5d7c714155391431943c17850d379e4bc9fce3e20fa35bff736b21b60b13d92140dbd7102237f2c64b9c0a948723954e677ef5935b4d91b7bc6a4014bfbd9
6
+ metadata.gz: a23d9dac1fbfa5880ae7e7011f53f1f636a2cfbc1cd09820644a21dff75722846165dcb2774fdedfd652f5292280059fe186be788094ed34cd218ed989644bc9
7
+ data.tar.gz: 2c4508df86a087ba7c07e041cbcda0bd6119ea9585e3db24a31a0f6de152ad753ad99bb0e418498903eef6948d220d0d2fba40981ca1b78a66d46d65b3b3865c
@@ -7,11 +7,11 @@
7
7
 
8
8
  CustomDimensions.getAndExtendDefaultTrackingOptions = function (extraOptions) {
9
9
  var trackingOptions = this.customDimensions()
10
- return this.extend(trackingOptions, extraOptions)
10
+ return GOVUK.extendObject(trackingOptions, extraOptions)
11
11
  }
12
12
 
13
13
  CustomDimensions.customDimensions = function () {
14
- var dimensions = this.extend(
14
+ var dimensions = GOVUK.extendObject(
15
15
  {},
16
16
  customDimensionsFromBrowser(),
17
17
  customDimensionsFromMetaTags(),
@@ -25,24 +25,6 @@
25
25
  return dimensions
26
26
  }
27
27
 
28
- CustomDimensions.extend = function (out) {
29
- out = out || {}
30
-
31
- for (var i = 1; i < arguments.length; i++) {
32
- if (!arguments[i]) {
33
- continue
34
- }
35
-
36
- for (var key in arguments[i]) {
37
- if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
38
- out[key] = arguments[i][key]
39
- }
40
- }
41
- }
42
-
43
- return out
44
- }
45
-
46
28
  function customDimensionsFromBrowser () {
47
29
  var customDimensions = {
48
30
  dimension15: window.httpStatusCode || 200,
@@ -1,23 +1,38 @@
1
1
  ;(function (global) {
2
2
  'use strict'
3
3
 
4
- var $ = global.jQuery
5
4
  var GOVUK = global.GOVUK || {}
6
5
 
7
6
  GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
8
7
  GOVUK.analyticsPlugins.downloadLinkTracker = function (options) {
9
8
  options = options || {}
10
9
  var downloadLinkSelector = options.selector
10
+ var selectors = downloadLinkSelector.split(',')
11
11
 
12
12
  if (downloadLinkSelector) {
13
- $('body').on('click', downloadLinkSelector, trackDownload)
13
+ document.querySelector('body').addEventListener('click', function (event) {
14
+ var element = event.target
15
+ if (element.tagName !== 'A') {
16
+ element = element.closest('a')
17
+ }
18
+
19
+ if (!element) {
20
+ return
21
+ }
22
+
23
+ for (var i = 0; i < selectors.length; i++) {
24
+ if (element.matches(selectors[i].trim())) {
25
+ trackDownload(element)
26
+ break
27
+ }
28
+ }
29
+ })
14
30
  }
15
31
 
16
- function trackDownload (evt) {
17
- var $link = getLinkFromEvent(evt)
18
- var href = $link.attr('href')
32
+ function trackDownload (element) {
33
+ var href = element.getAttribute('href')
19
34
  var evtOptions = { transport: 'beacon' }
20
- var linkText = $.trim($link.text())
35
+ var linkText = element.textContent.trim()
21
36
 
22
37
  if (linkText) {
23
38
  evtOptions.label = linkText
@@ -25,16 +40,6 @@
25
40
 
26
41
  GOVUK.analytics.trackEvent('Download Link Clicked', href, evtOptions)
27
42
  }
28
-
29
- function getLinkFromEvent (evt) {
30
- var $target = $(evt.target)
31
-
32
- if (!$target.is('a')) {
33
- $target = $target.parents('a')
34
- }
35
-
36
- return $target
37
- }
38
43
  }
39
44
 
40
45
  global.GOVUK = GOVUK
@@ -1,49 +1,63 @@
1
+ // = require govuk/vendor/polyfills/Element/prototype/closest.js
1
2
  ;(function (global) {
2
3
  'use strict'
3
4
 
4
- var $ = global.jQuery
5
5
  var GOVUK = global.GOVUK || {}
6
6
 
7
7
  GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
8
8
  GOVUK.analyticsPlugins.externalLinkTracker = function (options) {
9
9
  options = options || {}
10
- var externalLinkUploadCustomDimension = options.externalLinkUploadCustomDimension
10
+ GOVUK.analyticsPlugins.externalLinkTracker.options = options
11
+ document.querySelector('body').addEventListener('click', GOVUK.analyticsPlugins.externalLinkTracker.handleClick)
12
+ }
13
+
14
+ GOVUK.analyticsPlugins.externalLinkTracker.handleClick = function (event) {
15
+ var element = event.target
16
+ if (element.tagName !== 'A') {
17
+ element = element.closest('a')
18
+ }
19
+
20
+ if (!element) {
21
+ return
22
+ }
23
+
24
+ if (GOVUK.analyticsPlugins.externalLinkTracker.isExternalLink(element.getAttribute('href'))) {
25
+ GOVUK.analyticsPlugins.externalLinkTracker.trackClickEvent(element)
26
+ }
27
+ }
28
+
29
+ GOVUK.analyticsPlugins.externalLinkTracker.isExternalLink = function (href) {
30
+ if (!href) {
31
+ return false
32
+ }
33
+
11
34
  var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname()
12
- var externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])'
13
- $('body').on('click', externalLinkSelector, trackClickEvent)
14
-
15
- function trackClickEvent (evt) {
16
- var $link = getLinkFromEvent(evt)
17
- var options = { transport: 'beacon' }
18
- var href = $link.attr('href')
19
- var linkText = $.trim($link.text())
20
-
21
- if (linkText) {
22
- options.label = linkText
23
- }
24
-
25
- if (externalLinkUploadCustomDimension !== undefined) {
26
- // This custom dimension will be used to duplicate the url information
27
- // that we normally send in an "event action". This will be used to join
28
- // up with a scheduled custom upload called "External Link Status".
29
- // We can only join uploads on custom dimensions, not on `event actions`
30
- // where we normally add the url info.
31
- var externalLinkToJoinUploadOn = href
32
-
33
- GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn)
34
- }
35
- GOVUK.analytics.trackEvent('External Link Clicked', href, options)
35
+ if (href.substring(0, 4) === 'http' && href.indexOf(currentHost) === -1) {
36
+ return true
36
37
  }
38
+ }
39
+
40
+ GOVUK.analyticsPlugins.externalLinkTracker.trackClickEvent = function (element) {
41
+ var options = { transport: 'beacon' }
42
+ var href = element.getAttribute('href')
43
+ var linkText = element.textContent.trim()
37
44
 
38
- function getLinkFromEvent (evt) {
39
- var $target = $(evt.target)
45
+ if (linkText) {
46
+ options.label = linkText
47
+ }
40
48
 
41
- if (!$target.is('a')) {
42
- $target = $target.parents('a')
43
- }
49
+ var externalLinkUploadCustomDimension = GOVUK.analyticsPlugins.externalLinkTracker.options.externalLinkUploadCustomDimension
50
+ if (externalLinkUploadCustomDimension !== undefined) {
51
+ // This custom dimension will be used to duplicate the url information
52
+ // that we normally send in an "event action". This will be used to join
53
+ // up with a scheduled custom upload called "External Link Status".
54
+ // We can only join uploads on custom dimensions, not on `event actions`
55
+ // where we normally add the url info.
56
+ var externalLinkToJoinUploadOn = href
44
57
 
45
- return $target
58
+ GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn)
46
59
  }
60
+ GOVUK.analytics.trackEvent('External Link Clicked', href, options)
47
61
  }
48
62
 
49
63
  GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function () {
@@ -1,7 +1,6 @@
1
1
  ;(function (global) {
2
2
  'use strict'
3
3
 
4
- var $ = global.jQuery
5
4
  var GOVUK = global.GOVUK || {}
6
5
  var pii
7
6
 
@@ -78,7 +77,7 @@
78
77
  // Set an options object for the pageview (e.g. transport, sessionControl)
79
78
  // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#transport
80
79
  if (typeof options === 'object') {
81
- pageviewObject = $.extend(pageviewObject || {}, options)
80
+ pageviewObject = GOVUK.extendObject(pageviewObject || {}, options)
82
81
 
83
82
  // trackerName is optional
84
83
  if (typeof options.trackerName === 'string') {
@@ -87,10 +86,24 @@
87
86
  }
88
87
  }
89
88
 
90
- if (!$.isEmptyObject(pageviewObject)) {
91
- sendToGa(trackerName + 'send', 'pageview', pageviewObject)
92
- } else {
89
+ function isEmptyObject (obj) {
90
+ if (typeof obj === 'undefined') {
91
+ return true
92
+ }
93
+
94
+ for (var prop in obj) {
95
+ if (Object.prototype.hasOwnProperty.call(obj, prop)) {
96
+ return false
97
+ }
98
+ }
99
+
100
+ return JSON.stringify(obj) === JSON.stringify({})
101
+ }
102
+
103
+ if (isEmptyObject(pageviewObject)) {
93
104
  sendToGa(trackerName + 'send', 'pageview')
105
+ } else {
106
+ sendToGa(trackerName + 'send', 'pageview', pageviewObject)
94
107
  }
95
108
  }
96
109
 
@@ -135,7 +148,7 @@
135
148
  }
136
149
 
137
150
  if (typeof options === 'object') {
138
- $.extend(evt, options)
151
+ evt = GOVUK.extendObject(evt, options)
139
152
  }
140
153
 
141
154
  sendToGa(trackerName + 'send', evt)
@@ -156,7 +169,7 @@
156
169
  socialTarget: target
157
170
  }
158
171
 
159
- $.extend(trackingOptions, options)
172
+ trackingOptions = GOVUK.extendObject(trackingOptions, options)
160
173
 
161
174
  sendToGa('send', trackingOptions)
162
175
  }
@@ -1,36 +1,41 @@
1
+ //= require ../vendor/polyfills/closest.js
1
2
  ;(function (global) {
2
3
  'use strict'
3
4
 
4
- var $ = global.jQuery
5
5
  var GOVUK = global.GOVUK || {}
6
6
 
7
7
  GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {}
8
8
  GOVUK.analyticsPlugins.mailtoLinkTracker = function () {
9
- var mailtoLinkSelector = 'a[href^="mailto:"]'
9
+ document.querySelector('body').addEventListener('click', function (event) {
10
+ var element = event.target
11
+ if (element.tagName !== 'A') {
12
+ element = element.closest('a')
13
+ }
10
14
 
11
- $('body').on('click', mailtoLinkSelector, trackClickEvent)
15
+ if (!element) {
16
+ return
17
+ }
12
18
 
13
- function trackClickEvent (evt) {
14
- var $link = getLinkFromEvent(evt)
15
- var options = { transport: 'beacon' }
16
- var href = $link.attr('href')
17
- var linkText = $.trim($link.text())
19
+ var href = element.getAttribute('href')
18
20
 
19
- if (linkText) {
20
- options.label = linkText
21
+ if (!href) {
22
+ return
21
23
  }
22
24
 
23
- GOVUK.analytics.trackEvent('Mailto Link Clicked', href, options)
24
- }
25
+ if (href.substring(0, 7) === 'mailto:') {
26
+ trackClickEvent(element, href)
27
+ }
28
+ })
25
29
 
26
- function getLinkFromEvent (evt) {
27
- var $target = $(evt.target)
30
+ function trackClickEvent (element, href) {
31
+ var options = { transport: 'beacon' }
32
+ var linkText = element.textContent
28
33
 
29
- if (!$target.is('a')) {
30
- $target = $target.parents('a')
34
+ if (linkText) {
35
+ options.label = linkText.trim()
31
36
  }
32
37
 
33
- return $target
38
+ GOVUK.analytics.trackEvent('Mailto Link Clicked', href, options)
34
39
  }
35
40
  }
36
41
 
@@ -1,4 +1,4 @@
1
- /* global GOVUK, $, ga */
1
+ /* global GOVUK, ga */
2
2
 
3
3
  (function () {
4
4
  'use strict'
@@ -20,7 +20,7 @@
20
20
  ga(function (tracker) {
21
21
  this.gaClientId = tracker.get('clientId')
22
22
 
23
- $(window).trigger('gaClientSet')
23
+ GOVUK.triggerEvent(window, 'gaClientSet')
24
24
 
25
25
  // Start up ecommerce tracking
26
26
  GOVUK.Ecommerce.start()
@@ -49,7 +49,7 @@
49
49
  // Add the cookie banner status as a custom dimension
50
50
  var cookieBannerShown = !this.getCookie('seen_cookie_message')
51
51
  var cookieBannerDimension = { dimension100: cookieBannerShown ? cookieBannerShown.toString() : 'false' }
52
- $.extend(options, cookieBannerDimension)
52
+ options = GOVUK.extendObject(options, cookieBannerDimension)
53
53
 
54
54
  var trackingOptions = GOVUK.CustomDimensions.getAndExtendDefaultTrackingOptions(options)
55
55
  this.analytics.trackPageview(path, title, trackingOptions)
@@ -83,7 +83,7 @@
83
83
 
84
84
  var cookieOptions = getOptionsFromCookie()
85
85
 
86
- $.extend(cookieOptions, options)
86
+ cookieOptions = GOVUK.extendObject(cookieOptions, options)
87
87
 
88
88
  this.setCookie('analytics_next_page_call', cookieOptions)
89
89
  }
@@ -1,4 +1,5 @@
1
1
  //= require govuk_publishing_components/lib/cookie-functions
2
+ //= require govuk_publishing_components/lib/extend-object
2
3
  //= require ./analytics/pii
3
4
  //= require ./analytics/google-analytics-universal-tracker
4
5
  //= require ./analytics/analytics
@@ -13,7 +14,6 @@
13
14
  //= require ./analytics/static-analytics
14
15
  //= require ./analytics/ecommerce
15
16
  //= require ./analytics/init
16
- //= require ./analytics/scroll-tracker
17
17
  //= require ./analytics/auto-scroll-tracker
18
18
  //= require ./analytics/explicit-cross-domain-links
19
19
  //= require ./analytics/track-click
@@ -25,10 +25,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
25
25
  this.setInitialAriaAttributes()
26
26
  this.setHiddenValues()
27
27
 
28
+ this.prompt.hidden = false
29
+ for (var k = 0; k < this.promptQuestions.length; k++) {
30
+ this.promptQuestions[k].hidden = false
31
+ }
32
+ this.surveyForm.hidden = true
33
+
28
34
  for (var j = 0; j < this.toggleForms.length; j++) {
29
35
  this.toggleForms[j].addEventListener('click', function (e) {
30
36
  e.preventDefault()
31
- var el = e.target
37
+ var el = e.target.closest('button')
32
38
  this.toggleForm(el.getAttribute('aria-controls'))
33
39
  this.trackEvent(this.getTrackEventParams(el))
34
40
  this.updateAriaAttributes(el)
@@ -36,6 +42,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
36
42
  }
37
43
 
38
44
  for (var i = 0; i < this.closeForms.length; i++) {
45
+ this.closeForms[i].hidden = false
39
46
  this.closeForms[i].addEventListener('click', function (e) {
40
47
  e.preventDefault()
41
48
  var el = e.target
@@ -89,7 +96,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
89
96
  this.showFormSuccess(xhr.message)
90
97
  this.revealInitialPrompt()
91
98
  this.setInitialAriaAttributes()
92
- this.activeForm.classList.toggle(this.jshiddenClass)
99
+ this.activeForm.hidden ? this.activeForm.hidden = false : this.activeForm.hidden = true
93
100
  } else {
94
101
  this.showError(xhr)
95
102
  this.enableSubmitFormButton($form)
@@ -114,9 +121,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
114
121
  }
115
122
 
116
123
  Feedback.prototype.setInitialAriaAttributes = function () {
117
- for (var i = 0; i < this.forms.length; i++) {
118
- this.forms[i].setAttribute('aria-hidden', true)
119
- }
120
124
  this.pageIsNotUsefulButton.setAttribute('aria-expanded', false)
121
125
  this.somethingIsWrongButton.setAttribute('aria-expanded', false)
122
126
  }
@@ -168,20 +172,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
168
172
 
169
173
  Feedback.prototype.updateAriaAttributes = function (linkClicked) {
170
174
  linkClicked.setAttribute('aria-expanded', true)
171
- var controls = linkClicked.getAttribute('aria-controls')
172
- var ariaControls = document.querySelector('#' + controls)
173
- ariaControls.setAttribute('aria-hidden', false)
174
175
  }
175
176
 
176
177
  Feedback.prototype.toggleForm = function (formId) {
177
178
  this.activeForm = this.$module.querySelector('#' + formId)
178
- this.activeForm.classList.toggle(this.jshiddenClass)
179
- this.prompt.classList.toggle(this.jshiddenClass)
180
-
181
- var formIsVisible = !this.activeForm.classList.contains(this.jshiddenClass)
179
+ this.activeForm.hidden ? this.activeForm.hidden = false : this.activeForm.hidden = true
180
+ this.prompt.hidden ? this.prompt.hidden = false : this.prompt.hidden = true
182
181
 
183
- if (formIsVisible) {
184
- this.activeForm.querySelector('.gem-c-input').focus()
182
+ if (!this.activeForm.hidden) {
183
+ this.activeForm.querySelectorAll('.gem-c-textarea .govuk-textarea, .gem-c-input.govuk-input')[0]
184
+ .focus()
185
185
  } else {
186
186
  this.activeForm = false
187
187
  }
@@ -223,20 +223,20 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
223
223
  }
224
224
  var $errors = this.activeForm.querySelector('.js-errors')
225
225
  $errors.innerHTML = error
226
- $errors.classList.remove(this.jshiddenClass)
226
+ $errors.hidden = false
227
227
  $errors.focus()
228
228
  }
229
229
 
230
230
  Feedback.prototype.showFormSuccess = function () {
231
231
  for (var i = 0; i < this.promptQuestions.length; i++) {
232
- this.promptQuestions[i].classList.add(this.jshiddenClass)
232
+ this.promptQuestions[i].hidden = true
233
233
  }
234
- this.promptSuccessMessage.classList.remove(this.jshiddenClass)
234
+ this.promptSuccessMessage.hidden = false
235
235
  this.promptSuccessMessage.focus()
236
236
  }
237
237
 
238
238
  Feedback.prototype.revealInitialPrompt = function () {
239
- this.prompt.classList.remove(this.jshiddenClass)
239
+ this.prompt.hidden = false
240
240
  this.prompt.focus()
241
241
  }
242
242
 
@@ -0,0 +1,27 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.Modules = window.GOVUK.Modules || {};
3
+
4
+ (function (Modules) {
5
+ function Metadata ($module) {
6
+ this.$module = $module
7
+ }
8
+
9
+ Metadata.prototype.init = function () {
10
+ var seeAllUpdates = this.$module.querySelector('.js-see-all-updates-link')
11
+
12
+ if (seeAllUpdates) {
13
+ var target = document.querySelector(seeAllUpdates.getAttribute('href'))
14
+
15
+ if (target) {
16
+ seeAllUpdates.addEventListener('click', function () {
17
+ var targetToggleTrigger = target.querySelector('[aria-expanded]')
18
+ if (targetToggleTrigger && targetToggleTrigger.getAttribute('aria-expanded') !== 'true') {
19
+ targetToggleTrigger.click()
20
+ }
21
+ })
22
+ }
23
+ }
24
+ }
25
+
26
+ Modules.Metadata = Metadata
27
+ })(window.GOVUK.Modules)
@@ -0,0 +1,22 @@
1
+ (function (root) {
2
+ 'use strict'
3
+ window.GOVUK = window.GOVUK || {}
4
+
5
+ window.GOVUK.extendObject = function (obj) {
6
+ obj = obj || {}
7
+
8
+ for (var i = 1; i < arguments.length; i++) {
9
+ if (!arguments[i]) {
10
+ continue
11
+ }
12
+
13
+ for (var key in arguments[i]) {
14
+ if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
15
+ obj[key] = arguments[i][key]
16
+ }
17
+ }
18
+ }
19
+
20
+ return obj
21
+ }
22
+ }(window))
@@ -39,7 +39,6 @@ $govuk-new-link-styles: true;
39
39
  @import "components/govspeak-html-publication";
40
40
  @import "components/govspeak";
41
41
  @import "components/heading";
42
- @import "components/highlight-boxes";
43
42
  @import "components/hint";
44
43
  @import "components/image-card";
45
44
  @import "components/input";
@@ -68,6 +67,7 @@ $govuk-new-link-styles: true;
68
67
  @import "components/select";
69
68
  @import "components/share-links";
70
69
  @import "components/show-password";
70
+ @import "components/signup-link";
71
71
  @import "components/single-page-notification-button";
72
72
  @import "components/skip-link";
73
73
  @import "components/step-by-step-nav-header";
@@ -78,7 +78,6 @@ $govuk-new-link-styles: true;
78
78
  @import "components/summary-list";
79
79
  @import "components/tabs";
80
80
  @import "components/table";
81
- @import "components/taxonomy-list";
82
81
  @import "components/textarea";
83
82
  @import "components/title";
84
83
  @import "components/translation-nav";
@@ -1,31 +1,36 @@
1
1
  $transition-campaign-red: #ff003b;
2
+ $covid-colour: $govuk-link-colour;
2
3
 
3
- .gem-c-contextual-sidebar__brexit-related-links {
4
+ .gem-c-contextual-sidebar__related-links {
4
5
  border-top: 2px solid $govuk-brand-colour;
5
6
  }
6
7
 
7
- .gem-c-contextual-sidebar__brexit-heading {
8
+ .gem-c-contextual-sidebar__heading {
8
9
  margin-top: govuk-spacing(3);
9
10
  margin-bottom: govuk-spacing(2);
11
+ color: $govuk-text-colour;
10
12
  }
11
13
 
12
- .gem-c-contextual-sidebar__brexit-cta {
14
+ .gem-c-contextual-sidebar__text {
15
+ @include govuk-font(16);
16
+ margin-bottom: govuk-spacing(1);
17
+ @include govuk-media-query($from: tablet) {
18
+ margin-bottom: govuk-spacing(2);
19
+ }
20
+ }
21
+
22
+ .gem-c-contextual-sidebar__cta {
13
23
  margin-bottom: govuk-spacing(6);
14
24
  background-color: govuk-colour('light-grey', $legacy: 'grey-4');
15
- border-top: 2px solid $transition-campaign-red;
16
25
  display: block;
17
26
  padding: 0 govuk-spacing(3) govuk-spacing(3);
18
27
  text-decoration: none;
28
+ }
19
29
 
20
- .gem-c-contextual-sidebar__brexit-heading {
21
- color: $govuk-text-colour;
22
- }
30
+ .gem-c-contextual-sidebar__cta--brexit {
31
+ border-top: 2px solid $transition-campaign-red;
32
+ }
23
33
 
24
- .gem-c-contextual-sidebar__brexit-text {
25
- @include govuk-font(16);
26
- margin-bottom: govuk-spacing(1);
27
- @include govuk-media-query($from: tablet) {
28
- margin-bottom: govuk-spacing(2);
29
- }
30
- }
34
+ .gem-c-contextual-sidebar__cta--covid {
35
+ border-top: 2px solid $covid-colour;
31
36
  }
@@ -6,6 +6,12 @@
6
6
  margin-top: govuk-spacing(9);
7
7
  border-bottom: 1px solid govuk-colour("white");
8
8
  }
9
+
10
+ // Scoped to the feedback component temporarily
11
+ [hidden] {
12
+ // stylelint-disable-next-line declaration-no-important
13
+ display: none !important;
14
+ }
9
15
  }
10
16
 
11
17
  .gem-c-feedback__prompt-questions {
@@ -238,38 +244,3 @@
238
244
  outline: $govuk-focus-width solid $govuk-focus-colour;
239
245
  }
240
246
  }
241
-
242
- // hide without js
243
- // show with js, unless also has the js-hidden class
244
- .gem-c-feedback__js-show,
245
- .gem-c-feedback__prompt-success,
246
- .gem-c-feedback__prompt-questions,
247
- .gem-c-feedback__error-summary {
248
- display: none;
249
-
250
- .js-enabled & {
251
- display: block;
252
-
253
- &.js-hidden {
254
- display: none;
255
- }
256
- }
257
- }
258
-
259
- // maintain table display for prompt and prompt-questions
260
- .js-enabled .gem-c-feedback__prompt {
261
- @include govuk-media-query($from: tablet) {
262
- display: table;
263
- }
264
- }
265
-
266
- .js-enabled .gem-c-feedback__prompt-questions {
267
- @include govuk-media-query($from: tablet) {
268
- display: table-cell;
269
- }
270
- }
271
-
272
- // show the default feedback form without js
273
- .js-enabled .gem-c-feedback__form.js-hidden {
274
- display: none;
275
- }