govuk_publishing_components 29.9.0 → 29.12.0

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 (179) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -5
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +4 -4
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-click-tracking.js +46 -24
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-page-views.js +98 -0
  6. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +3 -0
  7. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +28 -1
  8. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-measurer.js +2 -2
  9. data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +1 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +20 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +3 -8
  12. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +7 -1
  13. data/app/assets/stylesheets/govuk_publishing_components/components/print/_organisation-logo.scss +4 -0
  14. data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -3
  15. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +0 -9
  16. data/app/models/govuk_publishing_components/audit_comparer.rb +91 -34
  17. data/app/views/govuk_publishing_components/audit/_applications.html.erb +20 -9
  18. data/app/views/govuk_publishing_components/component_guide/index.html.erb +1 -19
  19. data/app/views/govuk_publishing_components/components/_accordion.html.erb +7 -5
  20. data/app/views/govuk_publishing_components/components/_attachment.html.erb +1 -3
  21. data/app/views/govuk_publishing_components/components/_character_count.html.erb +1 -1
  22. data/app/views/govuk_publishing_components/components/_date_input.html.erb +0 -1
  23. data/app/views/govuk_publishing_components/components/_error_alert.html.erb +6 -3
  24. data/app/views/govuk_publishing_components/components/_input.html.erb +0 -2
  25. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +23 -5
  26. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +3 -8
  27. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +18 -19
  28. data/app/views/govuk_publishing_components/components/docs/accordion.yml +22 -13
  29. data/app/views/govuk_publishing_components/components/docs/attachment.yml +0 -11
  30. data/app/views/govuk_publishing_components/components/docs/error_alert.yml +4 -0
  31. data/config/locales/ar.yml +1 -2
  32. data/config/locales/az.yml +1 -2
  33. data/config/locales/be.yml +1 -2
  34. data/config/locales/bg.yml +1 -2
  35. data/config/locales/bn.yml +1 -2
  36. data/config/locales/cs.yml +1 -2
  37. data/config/locales/cy.yml +1 -2
  38. data/config/locales/da.yml +1 -2
  39. data/config/locales/de.yml +1 -2
  40. data/config/locales/dr.yml +1 -2
  41. data/config/locales/el.yml +1 -2
  42. data/config/locales/en.yml +9 -2
  43. data/config/locales/es-419.yml +1 -2
  44. data/config/locales/es.yml +1 -2
  45. data/config/locales/et.yml +1 -2
  46. data/config/locales/fa.yml +1 -2
  47. data/config/locales/fi.yml +1 -2
  48. data/config/locales/fr.yml +1 -2
  49. data/config/locales/gd.yml +1 -2
  50. data/config/locales/gu.yml +1 -2
  51. data/config/locales/he.yml +1 -2
  52. data/config/locales/hi.yml +1 -2
  53. data/config/locales/hr.yml +1 -2
  54. data/config/locales/hu.yml +1 -2
  55. data/config/locales/hy.yml +1 -2
  56. data/config/locales/id.yml +1 -2
  57. data/config/locales/is.yml +1 -2
  58. data/config/locales/it.yml +1 -2
  59. data/config/locales/ja.yml +1 -2
  60. data/config/locales/ka.yml +1 -2
  61. data/config/locales/kk.yml +1 -2
  62. data/config/locales/ko.yml +1 -2
  63. data/config/locales/lt.yml +1 -2
  64. data/config/locales/lv.yml +1 -2
  65. data/config/locales/ms.yml +1 -2
  66. data/config/locales/mt.yml +1 -2
  67. data/config/locales/nl.yml +1 -2
  68. data/config/locales/no.yml +1 -2
  69. data/config/locales/pa-pk.yml +1 -2
  70. data/config/locales/pa.yml +1 -2
  71. data/config/locales/pl.yml +1 -2
  72. data/config/locales/ps.yml +1 -2
  73. data/config/locales/pt.yml +1 -2
  74. data/config/locales/ro.yml +1 -2
  75. data/config/locales/ru.yml +1 -2
  76. data/config/locales/si.yml +1 -2
  77. data/config/locales/sk.yml +1 -2
  78. data/config/locales/sl.yml +1 -2
  79. data/config/locales/so.yml +1 -2
  80. data/config/locales/sq.yml +1 -2
  81. data/config/locales/sr.yml +1 -2
  82. data/config/locales/sv.yml +1 -2
  83. data/config/locales/sw.yml +1 -2
  84. data/config/locales/ta.yml +1 -2
  85. data/config/locales/th.yml +1 -2
  86. data/config/locales/tk.yml +1 -2
  87. data/config/locales/tr.yml +1 -2
  88. data/config/locales/uk.yml +1 -2
  89. data/config/locales/ur.yml +1 -2
  90. data/config/locales/uz.yml +1 -2
  91. data/config/locales/vi.yml +1 -2
  92. data/config/locales/zh-hk.yml +1 -2
  93. data/config/locales/zh-tw.yml +1 -2
  94. data/config/locales/zh.yml +1 -2
  95. data/lib/govuk_publishing_components/presenters/attachment_helper.rb +0 -21
  96. data/lib/govuk_publishing_components/presenters/meta_tags.rb +6 -0
  97. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +35 -16
  98. data/lib/govuk_publishing_components/version.rb +1 -1
  99. data/node_modules/govuk-frontend/govuk/all.js +120 -49
  100. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +2 -2
  101. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +0 -2
  102. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +2 -2
  103. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +6 -16
  104. data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +2 -2
  105. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +120 -49
  106. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +33 -17
  107. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +2 -2
  108. data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -4
  109. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +3 -2
  110. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +22 -10
  111. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +2 -2
  112. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +23 -23
  113. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  114. data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +4 -4
  115. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +2 -2
  116. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +3 -3
  117. data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +2 -2
  118. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +12 -22
  119. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +13 -3
  120. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +2 -2
  121. data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +2 -2
  122. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +4 -13
  123. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +5 -5
  124. data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +2 -2
  125. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +2 -2
  126. data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +1 -1
  127. data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +4 -4
  128. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +2 -2
  129. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -4
  130. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +17 -12
  131. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +2 -2
  132. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -3
  133. data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +2 -2
  134. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +5 -5
  135. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +4 -4
  136. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +2 -2
  137. data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +2 -2
  138. data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +2 -2
  139. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +3 -3
  140. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +7 -5
  141. data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +2 -2
  142. data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
  143. data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +3 -3
  144. data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +2 -2
  145. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +10 -26
  146. data/node_modules/govuk-frontend/govuk/objects/_template.scss +1 -1
  147. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +0 -4
  148. data/node_modules/govuk-frontend/govuk/tools/_exports.scss +1 -1
  149. data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -1
  150. data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -1
  151. data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +2 -2
  152. data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
  153. data/node_modules/govuk-frontend/govuk-esm/all.mjs +88 -0
  154. data/node_modules/govuk-frontend/govuk-esm/common.mjs +28 -0
  155. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +374 -0
  156. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +64 -0
  157. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +251 -0
  158. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +164 -0
  159. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +147 -0
  160. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +168 -0
  161. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +52 -0
  162. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +55 -0
  163. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +122 -0
  164. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +94 -0
  165. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +282 -0
  166. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.js +264 -0
  167. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.js +26 -0
  168. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.js +93 -0
  169. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.js +24 -0
  170. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.js +23 -0
  171. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.js +22 -0
  172. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.js +22 -0
  173. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.js +114 -0
  174. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.js +252 -0
  175. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.js +159 -0
  176. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.js +86 -0
  177. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.js +20 -0
  178. data/node_modules/govuk-frontend/package.json +8 -1
  179. metadata +29 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0d30bd1a2b86ab711560f26438e2ba7907402831cc617b752d3e1fb05c2e6cc
4
- data.tar.gz: e13d38616b71e39a1e3e23df2999eb88f9824a668dc8347a4b914a58e86bf2bb
3
+ metadata.gz: 3dd3c468990ad57344b60f3268db6600fc77389ec57fa53688699284bef86502
4
+ data.tar.gz: 2dc30bfb1f489e894134032e8d055e694b4ac45e5eb49e3055ceae8ac0f2b0b7
5
5
  SHA512:
6
- metadata.gz: d91d69b91a14c9f6acaf230a32c9c75385f54cd7c2ff924860f87e3578ea32f58726d16e0de1d5ccbfbeb808da0ceba804adc9827cd5ae2370dae3b6b478090b
7
- data.tar.gz: 036b79310b2cef0189a2536eab0d70bdf0d293cd079533da198f666c00ee04ddc7f34a22468ad4b853d2875fe1d44ec8ec305157c115ea19e0b2760e21ccd401
6
+ metadata.gz: 1d147c794de4cd0cb8210584db07fe0e32a3036d68bded430d2c8d9b45a00b50f78a931d21b48be269f971099f8b054881f3b707694b4f52c3dfa7d00aef7ea2
7
+ data.tar.gz: 786de6478e56d31089cb7745914bc5e38e5e8e63043d2b862777a69a5622b19f7f678c2d43559e179eb1701b3222fd1f384d05530c7f403abcccf1f025a005ef
data/README.md CHANGED
@@ -35,19 +35,30 @@ yarn run jasmine:browser
35
35
  yarn run jasmine:ci
36
36
  ```
37
37
 
38
- ### Further documentation
38
+ ### Using the gem
39
39
 
40
40
  - [Install and use this gem](docs/install-and-use.md)
41
41
  - [Use a component in your application](docs/use-components.md)
42
- - [Generate a new component](docs/generate-a-new-component.md)
43
- - [Testing a component](docs/testing-components.md)
44
- - [Move a component from an application to the gem](docs/moving-components-upstream-into-this-gem.md)
42
+
43
+ ### Managing the gem
44
+
45
45
  - [Publish/release a new version of the gem](docs/publishing-to-rubygems.md)
46
46
  - [Keep this gem in sync with the Design System](docs/upgrade-govuk-frontend.md)
47
- - [Code documentation on rubydoc.info](http://www.rubydoc.info/gems/govuk_publishing_components)
47
+ - [Move a component from an application to the gem](docs/moving-components-upstream-into-this-gem.md)
48
+
49
+ ### Making components
50
+
51
+ - [Generate a new component](docs/generate-a-new-component.md)
48
52
  - [Component conventions](docs/component_conventions.md)
49
53
  - [Component principles](docs/component_principles.md)
54
+
55
+ ### Further documentation
56
+
57
+ - [Testing a component](docs/testing-components.md)
50
58
  - [Component auditing](docs/auditing.md)
59
+ - [Code documentation on rubydoc.info](http://www.rubydoc.info/gems/govuk_publishing_components)
60
+
61
+ More documentation can be found in the [docs directory](docs/).
51
62
 
52
63
  ## Licence
53
64
 
@@ -15,8 +15,8 @@
15
15
  return document.querySelectorAll('.document-collection .group-title').length
16
16
  case isNewBrowsePageLevelTwo():
17
17
  // if there are no accordion sections on the browse level 2 page
18
- // then it is a default page with only one section
19
- return document.querySelectorAll('[data-track-count="accordionSection"]').length || 1
18
+ // then it is a default page with one or two lists
19
+ return document.querySelectorAll('[data-track-count="accordionSection"]').length || document.querySelectorAll('main .govuk-list').length
20
20
  case isNewBrowsePage():
21
21
  return document.querySelectorAll('[data-track-count="cardList"]').length
22
22
  case isMainstreamBrowsePage():
@@ -77,7 +77,6 @@
77
77
  var metaApplicationSelector = 'meta[name="govuk:rendering-application"]'
78
78
  var metaFormatSelector = 'meta[name="govuk:format"]'
79
79
  var metaNavigationTypeSelector = 'meta[name="govuk:navigation-page-type"]'
80
- var metaSectionSelector = 'meta[name="govuk:section"]'
81
80
 
82
81
  function getMetaAttribute (selector) {
83
82
  var element = document.querySelector(selector)
@@ -111,7 +110,8 @@
111
110
 
112
111
  function isNewBrowsePage () {
113
112
  return getMetaAttribute(metaApplicationSelector) === 'collections' &&
114
- getMetaAttribute(metaSectionSelector) === 'new_browse_page' &&
113
+ (getMetaAttribute(metaNavigationTypeSelector) === 'browse level 0' ||
114
+ getMetaAttribute(metaNavigationTypeSelector) === 'browse level 1') &&
115
115
  getMetaAttribute(metaFormatSelector) === 'mainstream_browse_page'
116
116
  }
117
117
 
@@ -1,3 +1,4 @@
1
+ // = require govuk/vendor/polyfills/Element/prototype/closest.js
1
2
  window.GOVUK = window.GOVUK || {}
2
3
  window.GOVUK.Modules = window.GOVUK.Modules || {};
3
4
 
@@ -10,38 +11,59 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
10
11
  }
11
12
 
12
13
  GtmClickTracking.prototype.init = function () {
13
- var trackClicksOn = [this.module]
14
- if (!this.module.getAttribute(this.trackingTrigger)) {
15
- trackClicksOn = this.module.querySelectorAll('[' + this.trackingTrigger + ']')
16
- }
17
-
18
- for (var i = 0; i < trackClicksOn.length; i++) {
19
- trackClicksOn[i].addEventListener('click', this.trackClick.bind(this))
20
- }
14
+ this.module.addEventListener('click', this.trackClick.bind(this), true) // useCapture must be true
21
15
  }
22
16
 
23
17
  GtmClickTracking.prototype.trackClick = function (event) {
24
18
  if (window.dataLayer) {
25
- var target = event.currentTarget
26
- var data = {
27
- event: 'analytics',
28
- event_name: target.getAttribute('data-gtm-event-name'),
29
- // get entire URL apart from domain
30
- link_url: window.location.href.substring(window.location.origin.length),
31
- ui: JSON.parse(target.getAttribute('data-gtm-attributes'))
32
- }
33
- var ariaExpanded = this.checkExpandedState(target)
34
- if (ariaExpanded) {
35
- data.ui.state = ariaExpanded === 'false' ? 'opened' : 'closed'
19
+ var target = this.findTrackingAttributes(event.target)
20
+ if (target) {
21
+ var data = {
22
+ event: 'analytics',
23
+ event_name: target.getAttribute('data-gtm-event-name'),
24
+ // get entire URL apart from domain
25
+ link_url: window.location.href.substring(window.location.origin.length),
26
+ ui: JSON.parse(target.getAttribute('data-gtm-attributes')) || {}
27
+ }
28
+ var ariaExpanded = this.getClosestAttribute(target, 'aria-expanded')
29
+ /*
30
+ the details component uses an 'open' attribute instead of aria-expanded, so we need to check if we're on a details component.
31
+ since details deletes the 'open' attribute when closed, we need this boolean, otherwise every element which
32
+ doesn't contain an 'open' attr would be pushed to gtm as a closed element.
33
+ */
34
+ var detailsElement = target.closest('details')
35
+
36
+ if (ariaExpanded) {
37
+ data.ui.text = data.ui.text || target.innerText
38
+ data.ui.state = (ariaExpanded === 'false') ? 'opened' : 'closed'
39
+ } else if (detailsElement) {
40
+ data.ui.text = data.ui.text || detailsElement.textContent
41
+ var openAttribute = detailsElement.getAttribute('open')
42
+ data.ui.state = (openAttribute == null) ? 'opened' : 'closed'
43
+ }
44
+
45
+ window.dataLayer.push(data)
36
46
  }
37
- window.dataLayer.push(data)
38
47
  }
39
48
  }
40
49
 
41
- GtmClickTracking.prototype.checkExpandedState = function (clicked) {
42
- var expanded = clicked.querySelector('[aria-expanded]')
43
- if (expanded) {
44
- return expanded.getAttribute('aria-expanded')
50
+ GtmClickTracking.prototype.findTrackingAttributes = function (clicked) {
51
+ if (clicked.hasAttribute('[' + this.trackingTrigger + ']')) {
52
+ return clicked
53
+ } else {
54
+ return clicked.closest('[' + this.trackingTrigger + ']')
55
+ }
56
+ }
57
+
58
+ // check if an attribute exists or contains the attribute
59
+ GtmClickTracking.prototype.getClosestAttribute = function (clicked, attribute) {
60
+ var isAttributeOnElement = clicked.getAttribute(attribute)
61
+ var containsAttribute = clicked.querySelector('[' + attribute + ']')
62
+
63
+ if (isAttributeOnElement || isAttributeOnElement === '') { // checks for "" as some attribute names can contain no value making them falsy
64
+ return isAttributeOnElement
65
+ } else if (containsAttribute) {
66
+ return containsAttribute.getAttribute(attribute)
45
67
  }
46
68
  }
47
69
 
@@ -0,0 +1,98 @@
1
+ ;(function (global) {
2
+ 'use strict'
3
+
4
+ var GOVUK = global.GOVUK || {}
5
+
6
+ GOVUK.Gtm = {
7
+ sendPageView: function () {
8
+ if (window.dataLayer) {
9
+ var data = {
10
+ event: 'config_ready',
11
+ page: {
12
+ location: this.getLocation(),
13
+ referrer: this.getReferrer(),
14
+ title: this.getTitle(),
15
+ status_code: this.getStatusCode()
16
+ },
17
+ publishing: {
18
+ document_type: this.getMetaContent('format'),
19
+ publishing_application: this.getMetaContent('publishing-application'),
20
+ rendering_application: this.getMetaContent('rendering-application'),
21
+ schema_name: this.getMetaContent('schema-name'),
22
+ content_id: this.getMetaContent('content-id')
23
+ },
24
+ taxonomy: {
25
+ section: this.getMetaContent('section'),
26
+ taxon_slug: this.getMetaContent('taxon-slug'),
27
+ taxon_id: this.getMetaContent('taxon-id'),
28
+ themes: this.getMetaContent('themes'),
29
+ taxon_slugs: this.getMetaContent('taxon-slugs'),
30
+ taxon_ids: this.getMetaContent('taxon-ids')
31
+ },
32
+ content: {
33
+ language: this.getLanguage(),
34
+ history: this.getHistory(),
35
+ withdrawn: this.getWithDrawn(),
36
+ first_published_at: this.getMetaContent('first-published-at'),
37
+ updated_at: this.getMetaContent('updated-at'),
38
+ public_updated_at: this.getMetaContent('public-updated-at'),
39
+ publishing_government: this.getMetaContent('publishing-government'),
40
+ political_status: this.getMetaContent('political-status'),
41
+ primary_publishing_organisation: this.getMetaContent('primary-publishing-organisation'),
42
+ organisations: this.getMetaContent('analytics:organisations'),
43
+ world_locations: this.getMetaContent('analytics:world-locations')
44
+ }
45
+ }
46
+ window.dataLayer.push(data)
47
+ }
48
+ },
49
+
50
+ getLocation: function () {
51
+ return document.location.href
52
+ },
53
+
54
+ getReferrer: function () {
55
+ return document.referrer
56
+ },
57
+
58
+ getTitle: function () {
59
+ return document.title
60
+ },
61
+
62
+ // window.httpStatusCode is set in the source of the error page in static
63
+ // https://github.com/alphagov/static/blob/main/app/views/root/_error_page.html.erb#L32
64
+ getStatusCode: function () {
65
+ if (window.httpStatusCode) {
66
+ return window.httpStatusCode
67
+ } else {
68
+ return 200
69
+ }
70
+ },
71
+
72
+ getMetaContent: function (name) {
73
+ var tag = document.querySelector('meta[name="govuk:' + name + '"]')
74
+ if (tag) {
75
+ return tag.getAttribute('content')
76
+ } else {
77
+ return 'n/a'
78
+ }
79
+ },
80
+
81
+ getLanguage: function () {
82
+ var html = document.querySelector('html')
83
+ return html.getAttribute('lang') || 'n/a'
84
+ },
85
+
86
+ getHistory: function () {
87
+ var history = this.getMetaContent('content-has-history')
88
+ return (history === 'true') ? 'true' : 'false'
89
+ },
90
+
91
+ getWithDrawn: function () {
92
+ var withdrawn = this.getMetaContent('withdrawn')
93
+ return (withdrawn === 'withdrawn') ? 'true' : 'false'
94
+ }
95
+ }
96
+
97
+ global.GOVUK = GOVUK
98
+ })(window)
@@ -1 +1,4 @@
1
+ //= require ./analytics-ga4/gtm-page-views
1
2
  //= require ./analytics-ga4/gtm-click-tracking
3
+
4
+ window.GOVUK.Gtm.sendPageView() // this will need integrating with cookie consent before production
@@ -45,6 +45,21 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
45
45
  if (this.$module.getAttribute('data-track-sections') === 'true') {
46
46
  this.addEventListenerSections()
47
47
  }
48
+
49
+ // look for data attributes to put onto the 'show/hide all' link
50
+ var showAllAttributes = this.$module.getAttribute('data-show-all-attributes')
51
+ if (showAllAttributes) {
52
+ try {
53
+ var showAll = this.$module.querySelector('.' + this.showAllControls)
54
+ var values = JSON.parse(showAllAttributes)
55
+ var keys = Object.keys(values)
56
+ for (var i = 0; i < keys.length; i++) {
57
+ showAll.setAttribute('data-' + keys[i], values[keys[i]])
58
+ }
59
+ } catch (e) {
60
+ console.error('Could not read accordion data attributes error: ' + e.message, window.location)
61
+ }
62
+ }
48
63
  }
49
64
 
50
65
  // Navigate to and open accordions with anchored content on page load if a hash is present
@@ -76,7 +91,7 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
76
91
  var $expanded = this.getContainingSection($section)
77
92
  var $parent = $header.parentElement
78
93
 
79
- // manuals-frontend features:
94
+ // government-frontend features (inherited from manuals-frontend):
80
95
  // Should the target anchor link be within the same page, open section - navigate normally
81
96
  // Should the target anchor link be within a different, closed section, open this section
82
97
  // Should the target anchor link be within a different page and different, closed section open this section
@@ -129,6 +144,18 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
129
144
  var action = expanded ? 'accordionOpened' : 'accordionClosed'
130
145
  var options = { transport: 'beacon', label: label }
131
146
 
147
+ // optional parameters are added to the parent
148
+ // heading not the button that is clicked
149
+ var extraOptions = section.parentElement && section.parentElement.getAttribute('data-track-options')
150
+
151
+ // this uses the same logic as track-click.js handleClick
152
+ // means we can add a custom dimensions on click
153
+ // (such as the index of the accordion on the page)
154
+ if (extraOptions) {
155
+ extraOptions = JSON.parse(extraOptions)
156
+ for (var k in extraOptions) options[k] = extraOptions[k]
157
+ }
158
+
132
159
  if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
133
160
  window.GOVUK.analytics.trackEvent('pageElementInteraction', action, options)
134
161
  }
@@ -175,8 +175,8 @@ if (
175
175
  var measureHTTPProtocol = function () {
176
176
  var getEntriesByType = performance.getEntriesByType('navigation')
177
177
 
178
- if (getEntriesByType.length > 0) {
179
- var httpProtocol = JSON.parse(JSON.stringify(performance.getEntriesByType('navigation')[0].nextHopProtocol))
178
+ if (typeof getEntriesByType !== 'undefined' && getEntriesByType.length > 0) {
179
+ var httpProtocol = getEntriesByType[0].nextHopProtocol
180
180
  LUX.addData("http-protocol", httpProtocol)
181
181
  }
182
182
  }
@@ -10,6 +10,7 @@
10
10
  @import "components/print/govspeak-html-publication";
11
11
  @import "components/print/govspeak";
12
12
  @import "components/print/layout-super-navigation-header";
13
+ @import "components/print/organisation-logo";
13
14
  @import "components/print/step-by-step-nav-header";
14
15
  @import "components/print/step-by-step-nav";
15
16
  @import "components/print/textarea";
@@ -8,6 +8,12 @@
8
8
  color: $govuk-text-colour;
9
9
  }
10
10
 
11
+ .gem-c-contextual-sidebar__list {
12
+ margin: 0;
13
+ padding: 0;
14
+ list-style: none;
15
+ }
16
+
11
17
  .gem-c-contextual-sidebar__text {
12
18
  @include govuk-font(16);
13
19
  margin-bottom: govuk-spacing(1);
@@ -24,3 +30,17 @@
24
30
  padding: 0 govuk-spacing(3) govuk-spacing(3);
25
31
  text-decoration: none;
26
32
  }
33
+
34
+ .gem-c-contextual-sidebar__cta--ukraine {
35
+ border-top: 7px solid #fed700;
36
+ position: relative;
37
+
38
+ &:before {
39
+ content: "";
40
+ position: absolute;
41
+ left: 0;
42
+ right: 0;
43
+ top: -14px;
44
+ border-top: 7px solid #4b7ec1;
45
+ }
46
+ }
@@ -382,10 +382,8 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
382
382
  }
383
383
 
384
384
  .gem-c-layout-super-navigation-header__navigation-second-toggle-button-inner {
385
- border-color: $button-pipe-colour;
386
-
387
385
  &:before {
388
- @include chevron($button-pipe-colour, true);
386
+ @include chevron(govuk-colour("mid-grey"), true);
389
387
  }
390
388
  }
391
389
  }
@@ -464,7 +462,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
464
462
  .gem-c-layout-super-navigation-header__navigation-second-toggle-button-inner {
465
463
  @include govuk-media-query($from: "desktop") {
466
464
  display: inline-block;
467
- padding: govuk-spacing(2) govuk-spacing(6) govuk-spacing(2) govuk-spacing(5);
465
+ padding: govuk-spacing(1) govuk-spacing(6) govuk-spacing(1) govuk-spacing(5);
468
466
  }
469
467
  }
470
468
 
@@ -608,10 +606,6 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
608
606
  }
609
607
  }
610
608
 
611
- &:after {
612
- @include pseudo-underline;
613
- }
614
-
615
609
  // Open button modifier
616
610
  &.gem-c-layout-super-navigation-header__open-button {
617
611
  // stylelint-disable max-nesting-depth
@@ -771,6 +765,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
771
765
  background: govuk-colour("light-grey");
772
766
 
773
767
  @include govuk-media-query($from: "desktop") {
768
+ border-bottom: 1px govuk-colour("mid-grey") solid;
774
769
  left: 0;
775
770
  position: absolute;
776
771
  right: 0;
@@ -37,7 +37,8 @@
37
37
  margin-left: -($thumbnail-width + govuk-spacing(6) - $govuk-border-width);
38
38
  padding-bottom: govuk-spacing(3);
39
39
 
40
- img {
40
+ img,
41
+ svg {
41
42
  display: block;
42
43
  width: $thumbnail-width;
43
44
  height: 140px;
@@ -56,6 +57,11 @@
56
57
 
57
58
  box-shadow: 0 2px 2px rgba(govuk-colour("black"), .4);
58
59
  }
60
+
61
+ svg {
62
+ fill: govuk-colour("mid-grey", $legacy: "grey-3");
63
+ stroke: govuk-colour("mid-grey", $legacy: "grey-3");
64
+ }
59
65
  }
60
66
 
61
67
  .attachment-details {
@@ -1,3 +1,7 @@
1
+ .gem-c-organisation-logo {
2
+ width: 25%;
3
+ }
4
+
1
5
  .gem-c-organisation-logo__image {
2
6
  max-width: 100%;
3
7
  }
@@ -15,7 +15,6 @@ module GovukPublishingComponents
15
15
  govspeak-preview
16
16
  info-frontend
17
17
  licence-finder
18
- manuals-frontend
19
18
  release
20
19
  search-admin
21
20
  service-manual-frontend
@@ -24,7 +23,8 @@ module GovukPublishingComponents
24
23
  static
25
24
  travel-advice-publisher
26
25
  whitehall
27
- ].sort
26
+ ]
27
+
28
28
  application_dirs = [GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(Rails.root)] unless ENV["MAIN_COMPONENT_GUIDE"]
29
29
 
30
30
  gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
@@ -36,7 +36,7 @@ module GovukPublishingComponents
36
36
 
37
37
  components = AuditComponents.new(gem_path, false)
38
38
  applications = analyse_applications(host_dir, application_dirs)
39
- compared_data = AuditComparer.new(components.data, applications, false)
39
+ compared_data = AuditComparer.new(components.data, applications)
40
40
 
41
41
  @applications = compared_data.applications_data || []
42
42
  @components = compared_data.gem_data || []
@@ -13,7 +13,6 @@ module GovukPublishingComponents
13
13
  @components_in_use_sass = components_in_use_sass(false)
14
14
  @components_in_use_print_sass = components_in_use_sass(true)
15
15
  @components_in_use_js = components_in_use_js
16
- @index_audit_summary = index_audit_summary
17
16
  end
18
17
 
19
18
  def show
@@ -162,13 +161,5 @@ module GovukPublishingComponents
162
161
  h[:url] = component_doc_path(component_doc.id) if component_example
163
162
  end
164
163
  end
165
-
166
- def index_audit_summary
167
- components_gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
168
- components = AuditComponents.new(components_gem_path, true)
169
- application = AuditApplications.new(@application_path, GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(@application_path))
170
- compared_data = AuditComparer.new(components.data, [application.data], true)
171
- compared_data.applications_data[0]
172
- end
173
164
  end
174
165
  end