govuk_publishing_components 27.19.0 → 28.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +2 -20
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +21 -16
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +46 -32
  5. data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +20 -7
  6. data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +22 -17
  7. data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +4 -4
  8. data/app/assets/javascripts/govuk_publishing_components/analytics.js +1 -1
  9. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +18 -18
  10. data/app/assets/javascripts/govuk_publishing_components/components/metadata.js +27 -0
  11. data/app/assets/javascripts/govuk_publishing_components/lib/extend-object.js +22 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -2
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +8 -37
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_signup-link.scss +34 -0
  15. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +6 -0
  16. data/app/views/govuk_publishing_components/components/_big_number.html.erb +10 -4
  17. data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -2
  18. data/app/views/govuk_publishing_components/components/_signup_link.html.erb +30 -0
  19. data/app/views/govuk_publishing_components/components/docs/accordion.yml +31 -25
  20. data/app/views/govuk_publishing_components/components/docs/big_number.yml +6 -0
  21. data/app/views/govuk_publishing_components/components/docs/feedback.yml +5 -0
  22. data/app/views/govuk_publishing_components/components/docs/input.yml +1 -1
  23. data/app/views/govuk_publishing_components/components/docs/signup_link.yml +39 -0
  24. data/app/views/govuk_publishing_components/components/docs/success_alert.yml +1 -1
  25. data/app/views/govuk_publishing_components/components/docs/tabs.yml +2 -2
  26. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +9 -6
  27. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +4 -3
  28. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +9 -7
  29. data/config/locales/ar.yml +0 -8
  30. data/config/locales/az.yml +0 -8
  31. data/config/locales/be.yml +0 -8
  32. data/config/locales/bg.yml +0 -8
  33. data/config/locales/bn.yml +0 -8
  34. data/config/locales/cs.yml +0 -8
  35. data/config/locales/cy.yml +0 -8
  36. data/config/locales/da.yml +0 -8
  37. data/config/locales/de.yml +0 -8
  38. data/config/locales/dr.yml +0 -8
  39. data/config/locales/el.yml +0 -8
  40. data/config/locales/en.yml +0 -10
  41. data/config/locales/es-419.yml +0 -8
  42. data/config/locales/es.yml +0 -8
  43. data/config/locales/et.yml +0 -8
  44. data/config/locales/fa.yml +0 -8
  45. data/config/locales/fi.yml +0 -8
  46. data/config/locales/fr.yml +0 -8
  47. data/config/locales/gd.yml +0 -8
  48. data/config/locales/gu.yml +0 -8
  49. data/config/locales/he.yml +0 -8
  50. data/config/locales/hi.yml +0 -8
  51. data/config/locales/hr.yml +0 -8
  52. data/config/locales/hu.yml +0 -8
  53. data/config/locales/hy.yml +0 -8
  54. data/config/locales/id.yml +0 -8
  55. data/config/locales/is.yml +0 -8
  56. data/config/locales/it.yml +0 -8
  57. data/config/locales/ja.yml +0 -8
  58. data/config/locales/ka.yml +0 -8
  59. data/config/locales/kk.yml +0 -8
  60. data/config/locales/ko.yml +0 -8
  61. data/config/locales/lt.yml +0 -8
  62. data/config/locales/lv.yml +0 -8
  63. data/config/locales/ms.yml +0 -8
  64. data/config/locales/mt.yml +0 -8
  65. data/config/locales/nl.yml +0 -8
  66. data/config/locales/no.yml +0 -8
  67. data/config/locales/pa-pk.yml +0 -8
  68. data/config/locales/pa.yml +0 -8
  69. data/config/locales/pl.yml +0 -8
  70. data/config/locales/ps.yml +0 -8
  71. data/config/locales/pt.yml +0 -8
  72. data/config/locales/ro.yml +0 -8
  73. data/config/locales/ru.yml +0 -8
  74. data/config/locales/si.yml +0 -8
  75. data/config/locales/sk.yml +0 -8
  76. data/config/locales/sl.yml +0 -8
  77. data/config/locales/so.yml +0 -8
  78. data/config/locales/sq.yml +0 -8
  79. data/config/locales/sr.yml +0 -8
  80. data/config/locales/sv.yml +0 -8
  81. data/config/locales/sw.yml +0 -8
  82. data/config/locales/ta.yml +0 -8
  83. data/config/locales/th.yml +0 -8
  84. data/config/locales/tk.yml +0 -8
  85. data/config/locales/tr.yml +0 -8
  86. data/config/locales/uk.yml +0 -8
  87. data/config/locales/ur.yml +0 -8
  88. data/config/locales/uz.yml +0 -8
  89. data/config/locales/vi.yml +0 -8
  90. data/config/locales/zh-hk.yml +0 -8
  91. data/config/locales/zh-tw.yml +0 -8
  92. data/config/locales/zh.yml +0 -8
  93. data/lib/govuk_publishing_components/version.rb +1 -1
  94. data/lib/govuk_publishing_components.rb +0 -2
  95. metadata +7 -15
  96. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +0 -237
  97. data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +0 -84
  98. data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss +0 -21
  99. data/app/views/govuk_publishing_components/components/_admin_analytics.html.erb +0 -20
  100. data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +0 -86
  101. data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +0 -47
  102. data/app/views/govuk_publishing_components/components/_taxonomy_list.html.erb +0 -30
  103. data/app/views/govuk_publishing_components/components/docs/admin_analytics.yml +0 -10
  104. data/app/views/govuk_publishing_components/components/docs/government_navigation.yml +0 -20
  105. data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +0 -171
  106. data/app/views/govuk_publishing_components/components/docs/taxonomy_list.yml +0 -112
  107. data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +0 -13
  108. 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: 5fe93045cd00a9b553478260bc30d9f793d60d32ddeb91b65adbd1b2571465e1
4
- data.tar.gz: f732e4835b31cc71f667fbf68db58cd413d7eaebf26871bc410a5707618f7ed8
3
+ metadata.gz: '0989b4b0c9bafbc71f0347de67fb337acee0cfb13da092fae2be8c6c35122d32'
4
+ data.tar.gz: e56b816c73f788ca8bfd9383fe39db912a84f5a14b141bb258cd7e7fcc526919
5
5
  SHA512:
6
- metadata.gz: f558e8a2f476bd8c8e5282ff3bde74ec1d2c07923d953c88ca507d1efe3efb197f46748559849153c08af5295bc7f2f4c5e227b3ba3c1592f5f7d8b2705cb8e3
7
- data.tar.gz: 460a222515c556721269935be2f702cec9fa2f33bf27afef7dc39dd50d22d7dce7e5db9369f4959834663e2cf176dd05a131a15bed886bdce41f252f74805243
6
+ metadata.gz: 384f96c451155a016bbfea69596892e4ed287afa095a0780570d07842c62498f3de4890819e1d87e173a856178e74d34e3f6561562aa8b5e9e2fe7a5974a2380
7
+ data.tar.gz: b8e6166d94e9536640edca9e877f8bec63429596dfe7c563f2521b2254b4acbcadd7decf26ffbc64ca28b14a8a5bd2b02d8fb7ceba35a2d523c3c65641b8d3fb
@@ -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";
@@ -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 {
@@ -135,9 +141,9 @@
135
141
  }
136
142
  }
137
143
 
138
- .gem-c-feedback__option-list-item:first-child {
144
+ .gem-c-feedback__option-list-item:last-child {
139
145
  @include govuk-media-query($from: mobile) {
140
- margin-right: govuk-spacing(4);
146
+ margin-left: govuk-spacing(4);
141
147
  }
142
148
  }
143
149
 
@@ -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
- }
@@ -0,0 +1,34 @@
1
+ .gem-c-signup-link__link {
2
+ @include govuk-font($size: 19);
3
+ }
4
+
5
+ .gem-c-signup-link__inner {
6
+ position: relative;
7
+ }
8
+
9
+ .gem-c-signup-link__icon {
10
+ position: absolute;
11
+
12
+ @include govuk-media-query($from: tablet) {
13
+ top: 2px;
14
+ }
15
+ }
16
+
17
+ .gem-c-signup-link__title {
18
+ margin-bottom: govuk-spacing(2);
19
+ margin-left: govuk-spacing(5);
20
+ }
21
+
22
+ .gem-c-signup-link--with-background-and-border {
23
+ padding: govuk-spacing(6);
24
+ background-color: govuk-colour("light-grey");
25
+ border: 1px solid $govuk-border-colour;
26
+ }
27
+
28
+ .gem-c-signup-link--link-only .gem-c-signup-link__link {
29
+ display: inline-block;
30
+ vertical-align: top;
31
+ font-weight: bold;
32
+ margin-left: govuk-spacing(5);
33
+ margin-bottom: 0;
34
+ }
@@ -145,4 +145,10 @@
145
145
  margin-bottom: $govuk-gutter;
146
146
  border-top: 1px solid $govuk-border-colour;
147
147
  }
148
+
149
+ code {
150
+ padding: 0 5px;
151
+ color: govuk-colour("red");
152
+ background-color: govuk-colour("light-grey");
153
+ }
148
154
  }