govuk_publishing_components 34.2.0 → 34.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/youtube-play-icon.png +0 -0
  3. data/app/assets/images/govuk_publishing_components/youtube-play-icon.svg +4 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +135 -0
  5. data/app/assets/javascripts/govuk_publishing_components/components/image-card.js +19 -0
  6. data/app/assets/javascripts/govuk_publishing_components/dependencies.js +9 -0
  7. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +3 -2
  8. data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +113 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +15 -19
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +81 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +0 -1
  12. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +26 -9
  13. data/app/controllers/govuk_publishing_components/application_controller.rb +0 -13
  14. data/app/views/govuk_publishing_components/components/_accordion.html.erb +2 -2
  15. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +2 -0
  16. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +7 -3
  17. data/app/views/govuk_publishing_components/components/_error_message.html.erb +2 -1
  18. data/app/views/govuk_publishing_components/components/_google_tag_manager_script.html.erb +2 -2
  19. data/app/views/govuk_publishing_components/components/_hint.html.erb +2 -1
  20. data/app/views/govuk_publishing_components/components/_image_card.html.erb +12 -9
  21. data/app/views/govuk_publishing_components/components/_input.html.erb +8 -2
  22. data/app/views/govuk_publishing_components/components/_label.html.erb +4 -3
  23. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +2 -2
  24. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +6 -2
  25. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +12 -6
  26. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -1
  27. data/app/views/govuk_publishing_components/components/_textarea.html.erb +10 -2
  28. data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +43 -0
  29. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +58 -0
  30. data/app/views/govuk_publishing_components/components/docs/emergency_banner.yml +3 -1
  31. data/app/views/govuk_publishing_components/components/docs/error_message.yml +13 -0
  32. data/app/views/govuk_publishing_components/components/docs/hint.yml +6 -0
  33. data/app/views/govuk_publishing_components/components/docs/image_card.yml +24 -1
  34. data/app/views/govuk_publishing_components/components/docs/input.yml +32 -0
  35. data/app/views/govuk_publishing_components/components/docs/intervention.yml +2 -1
  36. data/app/views/govuk_publishing_components/components/docs/label.yml +11 -0
  37. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +1 -0
  38. data/app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml +2 -0
  39. data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +27 -0
  40. data/app/views/govuk_publishing_components/components/docs/textarea.yml +31 -0
  41. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +2 -0
  42. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +2 -2
  43. data/app/views/govuk_publishing_components/components/metadata/_sentence.html.erb +4 -2
  44. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +18 -8
  45. data/app/views/layouts/govuk_publishing_components/application.html.erb +2 -2
  46. data/config/locales/ar.yml +4 -4
  47. data/config/locales/az.yml +4 -4
  48. data/config/locales/be.yml +4 -4
  49. data/config/locales/bg.yml +4 -4
  50. data/config/locales/bn.yml +4 -4
  51. data/config/locales/cs.yml +4 -4
  52. data/config/locales/cy.yml +4 -4
  53. data/config/locales/da.yml +4 -4
  54. data/config/locales/de.yml +4 -4
  55. data/config/locales/dr.yml +4 -4
  56. data/config/locales/el.yml +4 -4
  57. data/config/locales/en.yml +4 -4
  58. data/config/locales/es-419.yml +4 -4
  59. data/config/locales/es.yml +4 -4
  60. data/config/locales/et.yml +4 -4
  61. data/config/locales/fa.yml +4 -4
  62. data/config/locales/fi.yml +4 -4
  63. data/config/locales/fr.yml +4 -4
  64. data/config/locales/gd.yml +4 -4
  65. data/config/locales/gu.yml +4 -4
  66. data/config/locales/he.yml +4 -4
  67. data/config/locales/hi.yml +4 -4
  68. data/config/locales/hr.yml +4 -4
  69. data/config/locales/hu.yml +4 -4
  70. data/config/locales/hy.yml +4 -4
  71. data/config/locales/id.yml +4 -4
  72. data/config/locales/is.yml +4 -4
  73. data/config/locales/it.yml +4 -4
  74. data/config/locales/ja.yml +4 -4
  75. data/config/locales/ka.yml +4 -4
  76. data/config/locales/kk.yml +4 -4
  77. data/config/locales/ko.yml +4 -4
  78. data/config/locales/lt.yml +4 -4
  79. data/config/locales/lv.yml +4 -4
  80. data/config/locales/ms.yml +4 -4
  81. data/config/locales/mt.yml +4 -4
  82. data/config/locales/nl.yml +4 -4
  83. data/config/locales/no.yml +4 -4
  84. data/config/locales/pa-pk.yml +4 -4
  85. data/config/locales/pa.yml +4 -4
  86. data/config/locales/pl.yml +4 -4
  87. data/config/locales/ps.yml +4 -4
  88. data/config/locales/pt.yml +4 -4
  89. data/config/locales/ro.yml +4 -4
  90. data/config/locales/ru.yml +4 -4
  91. data/config/locales/si.yml +4 -4
  92. data/config/locales/sk.yml +4 -4
  93. data/config/locales/sl.yml +4 -4
  94. data/config/locales/so.yml +4 -4
  95. data/config/locales/sq.yml +4 -4
  96. data/config/locales/sr.yml +4 -4
  97. data/config/locales/sv.yml +4 -4
  98. data/config/locales/sw.yml +4 -4
  99. data/config/locales/ta.yml +4 -4
  100. data/config/locales/th.yml +4 -4
  101. data/config/locales/tk.yml +4 -4
  102. data/config/locales/tr.yml +4 -4
  103. data/config/locales/uk.yml +4 -4
  104. data/config/locales/ur.yml +4 -4
  105. data/config/locales/uz.yml +4 -4
  106. data/config/locales/vi.yml +4 -4
  107. data/config/locales/zh-hk.yml +4 -4
  108. data/config/locales/zh-tw.yml +4 -4
  109. data/config/locales/zh.yml +4 -4
  110. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +65 -2
  111. data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +1 -1
  112. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +4 -0
  113. data/lib/govuk_publishing_components/version.rb +1 -1
  114. data/node_modules/axe-core/axe.js +7 -8
  115. data/node_modules/axe-core/axe.min.js +3 -3
  116. data/node_modules/axe-core/package.json +1 -1
  117. data/node_modules/axe-core/sri-history.json +4 -0
  118. metadata +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04ff78073c27727492f6e443164f9d15d35abdc2e22ac407693c2de1150fac51
4
- data.tar.gz: 22829eace73fc47e3d43e5848e4f8c8ddb8588562787e600c408ae6dc5d67a15
3
+ metadata.gz: 2f2ee7abdd80e27a4dde6873f8242bc48780430becffdc8f34a57b90746807ea
4
+ data.tar.gz: 78ea4284a765350807dfa91da53a52f8a28a7d81ec348877d9efec97f5cb4588
5
5
  SHA512:
6
- metadata.gz: d47fbb815b2d0538852f85e51d847d2fde2f93d88c043ced2209bcf186618e057423adf39742f204170464b76423321e571be23b94105ffab5eba1bc9824c935
7
- data.tar.gz: a61767144465f49e6668ec69ed7b0b705685295930e19205ddd0e134f7cbd34e1e29460c8c4528df78206afb6ef3d63ee71a6911d1d55a07d81f24e6dca9e7f6
6
+ metadata.gz: 201e4229a22f1717f9d84a8049f90a734d083ccc8cc306474495bc2983818cad0baff6fc45ac20469d0e6ef1b486f9b9b901ca2d618e65270d24a885aabef4e4
7
+ data.tar.gz: aa1b6e36f56bc1f34d56e1631d2b2c9a63c88d8b50b5a6ee457098b09015996a67a48684a58c6b569157dc5dbb460160c2274f068cd844948d98931fbd043f5e
@@ -0,0 +1,4 @@
1
+ <svg width="79" height="55" viewBox="0 0 79 55" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M39.7503 0H40.1861C44.2104 0.014681 64.6016 0.161492 70.0996 1.63938C71.7617 2.09042 73.2763 2.96959 74.492 4.18902C75.7076 5.40846 76.5818 6.92545 77.0272 8.5884C77.5217 10.448 77.8693 12.9095 78.1043 15.4493L78.1533 15.9583L78.261 17.2306L78.3001 17.7396C78.6184 22.2124 78.6575 26.4014 78.6624 27.3165V27.6835C78.6575 28.6329 78.6135 33.1057 78.261 37.7645L78.2218 38.2783L78.1777 38.7873C77.9329 41.5864 77.5706 44.366 77.0272 46.4116C76.5832 48.0752 75.7094 49.5929 74.4936 50.8126C73.2777 52.0322 71.7624 52.9109 70.0996 53.3606C64.4204 54.8874 42.8347 54.9951 39.8434 55H39.1481C37.6353 55 31.3785 54.9706 24.818 54.7455L23.9858 54.7162L23.5598 54.6966L22.7226 54.6623L21.8854 54.6281C16.4511 54.3883 11.2762 54.0017 8.8919 53.3557C7.22972 52.9065 5.71482 52.0285 4.49899 50.8097C3.28315 49.591 2.40907 48.0743 1.9643 46.4116C1.42086 44.3709 1.05857 41.5864 0.813776 38.7873L0.774609 38.2734L0.735443 37.7645C0.493822 34.4485 0.359932 31.1256 0.333984 27.801L0.333984 27.199C0.343776 26.1469 0.382943 22.5109 0.647318 18.4981L0.681589 17.994L0.696276 17.7396L0.735443 17.2306L0.843151 15.9583L0.892109 15.4493C1.12711 12.9095 1.47471 10.4431 1.96919 8.5884C2.41321 6.92478 3.28697 5.40707 4.50285 4.18743C5.71874 2.96779 7.23402 2.08907 8.8968 1.63938C11.2811 1.0032 16.456 0.611709 21.8903 0.367025L22.7226 0.33277L23.5647 0.303409L23.9858 0.288727L24.8229 0.254472C29.4823 0.104601 34.1437 0.0213994 38.8054 0.0048939H39.7503V0ZM31.6673 15.7087V39.2864L52.0193 27.5024L31.6673 15.7087Z" fill="#EA3323"/>
3
+ <path d="M31.668 15.7087V39.2865L52.0199 27.5025L31.668 15.7087Z" fill="white"/>
4
+ </svg>
@@ -0,0 +1,135 @@
1
+ // For Universal Analytics' cross domain tracking.
2
+ window.GOVUK.analytics = window.GOVUK.analytics || {}
3
+ window.GOVUK.analytics.linkedDomains = [
4
+ 'access.service.gov.uk',
5
+ 'access.tax.service.gov.uk',
6
+ 'account.companieshouse.gov.uk',
7
+ 'accounts.manage-apprenticeships.service.gov.uk',
8
+ 'account.publishing.service.gov.uk',
9
+ 'add-driving-licence-check-code.service.gov.uk',
10
+ 'analyse-school-performance.service.gov.uk',
11
+ 'appeal-tax-tribunal.service.gov.uk',
12
+ 'apply-basic-criminal-record-check.service.gov.uk',
13
+ 'apply-blue-badge.service.gov.uk',
14
+ 'apply-company-tachograph-card.service.gov.uk',
15
+ 'apply-for-bankruptcy.service.gov.uk',
16
+ 'apply-for-debt-relief-order.service.gov.uk',
17
+ 'apply-for-environmental-permit.service.gov.uk',
18
+ 'apply-for-eu-settled-status.homeoffice.gov.uk',
19
+ 'apply-for-innovation-funding.service.gov.uk',
20
+ 'apply-for-refugee-integration-loan.service.gov.uk',
21
+ 'apply-licence.ozone-depleting-substances.service.gov.uk',
22
+ 'apply-quota.fluorinated-gas.service.gov.uk',
23
+ 'apply-quota.ozone-depleting-substances.service.gov.uk',
24
+ 'apprenticeships.gov.uk',
25
+ 'beta.companieshouse.gov.uk',
26
+ 'biometric-residence-permit.service.gov.uk',
27
+ 'businessreadinessfund.beis.gov.uk',
28
+ 'catchreturn.service.gov.uk',
29
+ 'checklegalaid.service.gov.uk',
30
+ 'check-mot.service.gov.uk',
31
+ 'check-payment-practices.service.gov.uk',
32
+ 'check-vehicle-recalls.service.gov.uk',
33
+ 'civil-service-careers.gov.uk',
34
+ 'civilservicejobs.service.gov.uk',
35
+ 'claim.redundancy-payments.service.gov.uk',
36
+ 'claim-power-of-attorney-refund.service.gov.uk',
37
+ 'compare-school-performance.service.gov.uk',
38
+ 'complete-deputy-report.service.gov.uk',
39
+ 'contractsfinder.service.gov.uk',
40
+ 'coronavirus.data.gov.uk',
41
+ 'coronavirus-business-volunteers.service.gov.uk',
42
+ 'coronavirus-shielding-support.service.gov.uk',
43
+ 'coronavirus-vulnerable-people.service.gov.uk',
44
+ 'courttribunalfinder.service.gov.uk',
45
+ 'create-energy-label.service.gov.uk',
46
+ 'create-qr-code-poster.service.gov.uk',
47
+ 'cymraeg.registertovote.service.gov.uk',
48
+ 'dartford-crossing-charge.service.gov.uk',
49
+ 'design-system.service.gov.uk',
50
+ 'devtracker.dfid.gov.uk',
51
+ 'digitalmarketplace.service.gov.uk',
52
+ 'eforms.homeoffice.gov.uk',
53
+ 'electronic-visa-waiver.service.gov.uk',
54
+ 'employmenttribunals.service.gov.uk',
55
+ 'eu-settled-status-enquiries.service.gov.uk',
56
+ 'faster-uk-entry.service.gov.uk',
57
+ 'finance.manage-apprenticeships.service.gov.uk',
58
+ 'find-and-update.company-information.service.gov.uk',
59
+ 'findapprenticeship.service.gov.uk',
60
+ 'find-coronavirus-support.service.gov.uk',
61
+ 'find-employer-schemes.education.gov.uk',
62
+ 'flood-map-for-planning.service.gov.uk',
63
+ 'flood-warning-information.service.gov.uk',
64
+ 'follow.company-information.service.gov.uk',
65
+ 'gender-pay-gap.service.gov.uk',
66
+ 'get-fishing-licence.service.gov.uk',
67
+ 'get-information-schools.service.gov.uk',
68
+ 'gro.gov.uk',
69
+ 'helpforhouseholds.campaign.gov.uk',
70
+ 'helpwithcourtfees.service.gov.uk',
71
+ 'help-with-prison-visits.service.gov.uk',
72
+ 'identity.company-information.service.gov.uk',
73
+ 'identity-sandbox.company-information.service.gov.uk',
74
+ 'import-products-animals-food-feed.service.gov.uk',
75
+ 'lastingpowerofattorney.service.gov.uk',
76
+ 'live.email-dvla.service.gov.uk',
77
+ 'live.dvla-web-chat.service.gov.uk',
78
+ 'loststolenpassport.service.gov.uk',
79
+ 'makeaplea.service.gov.uk',
80
+ 'managefleetvehicles.service.gov.uk',
81
+ 'manage-apprenticeships.service.gov.uk',
82
+ 'manage-fish-exports.service.gov.uk',
83
+ 'manage-quota.fluorinated-gas.service.gov.uk',
84
+ 'manage-water-abstraction-impoundment-licence.service.gov.uk',
85
+ 'match.redundancy-payments.service.gov.uk',
86
+ 'mot-testing.service.gov.uk',
87
+ 'nominate-uk-honour.service.gov.uk',
88
+ 'notice.redundancy-payments.service.gov.uk',
89
+ 'passport.service.gov.uk',
90
+ 'paydvlafine.service.gov.uk',
91
+ 'payments.service.gov.uk',
92
+ 'publish-payment-practices.service.gov.uk',
93
+ 'queens-awards-enterprise.service.gov.uk',
94
+ 'recruit.manage-apprenticeships.service.gov.uk',
95
+ 'register.fluorinated-gas.service.gov.uk',
96
+ 'register-trailer.service.gov.uk',
97
+ 'register.ozone-depleting-substances.service.gov.uk',
98
+ 'registertovote.service.gov.uk',
99
+ 'register-vehicle.service.gov.uk',
100
+ 'registers.service.gov.uk',
101
+ 'reminders.mot-testing.service.gov.uk',
102
+ 'renewable-heat-calculator.service.gov.uk',
103
+ 'reply-jury-summons.service.gov.uk',
104
+ 'report-director-conduct.service.gov.uk',
105
+ 'report.fluorinated-gas.service.gov.uk',
106
+ 'report.ozone-depleting-substances.service.gov.uk',
107
+ 'right-to-rent.homeoffice.gov.uk',
108
+ 'right-to-work.service.gov.uk',
109
+ 'ruralpayments.service.gov.uk',
110
+ 'schools-financial-benchmarking.service.gov.uk',
111
+ 'secured.studentfinanceni.co.uk',
112
+ 'secured.studentfinancewales.co.uk',
113
+ 'selfservice.payments.service.gov.uk',
114
+ 'send-money-to-prisoner.service.gov.uk',
115
+ 'signin.service.gov.uk',
116
+ 'sorn.service.gov.uk',
117
+ 'staff.helpwithcourtfees.service.gov.uk',
118
+ 'student-finance.service.gov.uk',
119
+ 'tax.service.gov.uk',
120
+ 'teacherservices.education.gov.uk',
121
+ 'teaching-vacancies.service.gov.uk',
122
+ 'to-visit-or-stay-in-the-uk.homeoffice.gov.uk',
123
+ 'trade-tariff.service.gov.uk',
124
+ 'tribunal-response.employmenttribunals.service.gov.uk',
125
+ 'ukri.org',
126
+ 'update-student-loan-employment-details.service.gov.uk',
127
+ 'vehicle-operator-licensing.service.gov.uk',
128
+ 'vehicleenquiry.service.gov.uk',
129
+ 'viewdrivingrecord.service.gov.uk',
130
+ 'view-and-prove-your-rights.homeoffice.gov.uk',
131
+ 'view-immigration-status.service.gov.uk',
132
+ 'visa-address-update.service.gov.uk',
133
+ 'visas-immigration.service.gov.uk',
134
+ 'your-defra-account.defra.gov.uk'
135
+ ]
@@ -0,0 +1,19 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.Modules = window.GOVUK.Modules || {};
3
+
4
+ (function (Modules) {
5
+ function ImageCard ($module) {
6
+ this.$module = $module
7
+ this.$module.youtubeLink = this.$module.querySelector('.gem-c-image-card__image-wrapper div')
8
+ }
9
+
10
+ ImageCard.prototype.init = function () {
11
+ var ytLink = new window.GOVUK.GovspeakYoutubeLinkEnhancement(
12
+ this.$module.youtubeLink,
13
+ 'gem-c-govspeak__youtube-video gem-c-image-card__youtube-video-embed'
14
+ )
15
+ ytLink.init()
16
+ }
17
+
18
+ Modules.ImageCard = ImageCard
19
+ })(window.GOVUK.Modules)
@@ -6,4 +6,13 @@
6
6
 
7
7
  document.addEventListener('DOMContentLoaded', function () {
8
8
  window.GOVUK.modules.start()
9
+
10
+ // if statements ensure these functions don't execute during testing
11
+ if (typeof window.GOVUK.analyticsGa4.vars === 'undefined') {
12
+ window.GOVUK.loadAnalytics.loadGa4()
13
+ }
14
+
15
+ if (typeof window.GOVUK.analyticsInit === 'undefined') {
16
+ window.GOVUK.loadAnalytics.loadUa()
17
+ }
9
18
  })
@@ -3,8 +3,9 @@
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  var GOVUK = window.GOVUK || {}
5
5
 
6
- var YoutubeLinkEnhancement = function ($element) {
6
+ var YoutubeLinkEnhancement = function ($element, $classOverride) {
7
7
  this.$element = $element
8
+ this.$classOverride = typeof $classOverride !== 'undefined' ? $classOverride : 'gem-c-govspeak__youtube-video'
8
9
  }
9
10
 
10
11
  YoutubeLinkEnhancement.prototype.init = function () {
@@ -70,7 +71,7 @@
70
71
  var parentContainer = parentPara.parentNode
71
72
 
72
73
  var youtubeVideoContainer = document.createElement('div')
73
- youtubeVideoContainer.className += 'gem-c-govspeak__youtube-video'
74
+ youtubeVideoContainer.className += this.$classOverride
74
75
  youtubeVideoContainer.innerHTML = '<span id="' + elementId + '" data-video-id="' + id + '"></span>'
75
76
 
76
77
  options.title = $link.textContent
@@ -0,0 +1,113 @@
1
+ //= require govuk_publishing_components/analytics
2
+ //= require govuk_publishing_components/analytics-ga4
3
+ //= require govuk_publishing_components/analytics/linked-domains
4
+
5
+ window.GOVUK.loadAnalytics = {
6
+ productionDomains: [
7
+ 'www.gov.uk',
8
+ 'www-origin.publishing.service.gov.uk'
9
+ ],
10
+ stagingDomains: [
11
+ 'www.staging.publishing.service.gov.uk',
12
+ 'www-origin.staging.publishing.service.gov.uk'
13
+ ],
14
+ integrationDomains: [
15
+ 'www.integration.publishing.service.gov.uk',
16
+ 'www-origin.integration.publishing.service.gov.uk'
17
+ ],
18
+ developmentDomains: [
19
+ 'localhost', '127.0.0.1', '0.0.0.0'
20
+ ],
21
+
22
+ // For Universal Analytics' cross domain tracking. linkedDomains is defined by the require statement at the top of the file.
23
+ linkedDomains: window.GOVUK.analytics.linkedDomains,
24
+
25
+ ga4EnvironmentVariables: {
26
+ // initialiseGA4 is used to enable/disable GA4 on specific environments
27
+ production: {
28
+ initialiseGA4: true
29
+ },
30
+ staging: {
31
+ initialiseGA4: true,
32
+ auth: 'oJWs562CxSIjZKn_GlB5Bw',
33
+ preview: 'env-5'
34
+ },
35
+ integration: {
36
+ initialiseGA4: true,
37
+ auth: 'C7iYdcsOlYgGmiUJjZKrHQ',
38
+ preview: 'env-4'
39
+ },
40
+ development: {
41
+ initialiseGA4: true,
42
+ auth: 'bRiZ-jiEHtw6hHpGd6dF9w',
43
+ preview: 'env-3'
44
+ }
45
+ },
46
+
47
+ loadUa: function (currentDomain) {
48
+ currentDomain = currentDomain || window.location.hostname
49
+
50
+ // Universal Analytics variables
51
+ window.GOVUK.analyticsVars = window.GOVUK.analyticsVars || {}
52
+ window.GOVUK.analyticsVars.primaryLinkedDomains = ['account.gov.uk']
53
+ window.GOVUK.analyticsVars.linkedDomains = this.linkedDomains
54
+ window.GOVUK.analyticsVars.gaProperty = 'UA-UNSET'
55
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-UNSET'
56
+
57
+ if (this.arrayContains(currentDomain, this.productionDomains)) {
58
+ window.GOVUK.analyticsVars.gaProperty = 'UA-26179049-1'
59
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-145652997-1'
60
+ } else if (this.arrayContains(currentDomain, this.stagingDomains)) {
61
+ window.GOVUK.analyticsVars.gaProperty = 'UA-26179049-20'
62
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-145652997-1'
63
+ } else if (this.arrayContains(currentDomain, this.integrationDomains)) {
64
+ window.GOVUK.analyticsVars.gaProperty = 'UA-26179049-22'
65
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-145652997-1'
66
+ }
67
+
68
+ // Load universal analytics
69
+ if (typeof window.GOVUK.analyticsInit !== 'undefined') {
70
+ window.GOVUK.analyticsInit()
71
+ }
72
+ },
73
+
74
+ loadGa4: function (currentDomain) {
75
+ currentDomain = currentDomain || window.location.hostname
76
+ var environment = ''
77
+
78
+ // Categorise current environment
79
+ if (this.arrayContains(currentDomain, this.productionDomains)) {
80
+ environment = 'production'
81
+ } else if (this.arrayContains(currentDomain, this.stagingDomains)) {
82
+ environment = 'staging'
83
+ } else if (this.arrayContains(currentDomain, this.integrationDomains)) {
84
+ environment = 'integration'
85
+ } else if (this.arrayContains(currentDomain, this.developmentDomains) || currentDomain.indexOf('.dev.gov.uk') !== -1) {
86
+ environment = 'development'
87
+ }
88
+
89
+ // If we recognise the environment (i.e. the string isn't empty), load in GA4
90
+ if (environment) {
91
+ // If analytics-ga4.js exists and our detected environment has 'initialiseGA4' set to true, load GA4.
92
+ if (typeof window.GOVUK.analyticsGa4.init !== 'undefined' && this.ga4EnvironmentVariables[environment].initialiseGA4) {
93
+ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {}
94
+ window.GOVUK.analyticsGa4.vars = window.GOVUK.analyticsGa4.vars || {}
95
+ window.GOVUK.analyticsGa4.vars.id = 'GTM-MG7HG5W'
96
+ window.GOVUK.analyticsGa4.vars.auth = this.ga4EnvironmentVariables[environment].auth
97
+ window.GOVUK.analyticsGa4.vars.preview = this.ga4EnvironmentVariables[environment].preview
98
+ window.GOVUK.analyticsGa4.vars.environment = environment // Used for testing and debugging
99
+
100
+ window.GOVUK.analyticsGa4.vars.gem_version = 'not found'
101
+ var gemMeta = document.querySelector('meta[name="govuk:components_gem_version"]')
102
+ if (gemMeta) {
103
+ window.GOVUK.analyticsGa4.vars.gem_version = gemMeta.getAttribute('content')
104
+ }
105
+ window.GOVUK.analyticsGa4.init()
106
+ }
107
+ }
108
+ },
109
+
110
+ arrayContains: function (valueToFind, array) {
111
+ return array.indexOf(valueToFind) !== -1
112
+ }
113
+ }
@@ -95,32 +95,24 @@
95
95
  margin-bottom: 0;
96
96
  width: 100%;
97
97
 
98
- &:hover {
99
- // backup style for browsers that don't support rgba
100
- background: govuk-colour("mid-grey");
101
- background: rgba(govuk-colour("black"), .2);
102
- color: govuk-colour("black");
103
- }
104
-
105
- &:active:focus:not(:hover) {
106
- background: govuk-colour("yellow");
107
- }
108
98
  @include govuk-media-query($from: tablet) {
109
99
  @include govuk-font(16);
110
100
  }
111
- }
112
-
113
- .gem-c-feedback__email-link,
114
- .gem-c-feedback__prompt-link {
115
- position: relative;
116
101
 
102
+ &:focus,
117
103
  &:focus:not(:active):not(:hover) {
104
+ background: govuk-colour("yellow");
118
105
  border-color: govuk-colour("black");
106
+ box-shadow: 0 5px 0 govuk-colour("black");
119
107
  }
120
108
 
121
- &:focus,
122
109
  &:active {
123
- color: $govuk-focus-text-colour;
110
+ color: govuk-colour("black");
111
+ }
112
+
113
+ &:hover {
114
+ background: govuk-colour("mid-grey");
115
+ color: govuk-colour("black");
124
116
  }
125
117
  }
126
118
 
@@ -231,13 +223,17 @@
231
223
  }
232
224
 
233
225
  .gem-c-feedback__email-link {
234
- display: block;
226
+ display: inline-block;
235
227
  margin-top: govuk-spacing(4);
236
228
 
237
229
  @include govuk-media-query($from: desktop) {
238
- display: inline-block;
239
230
  margin-top: govuk-spacing(2);
240
231
  }
232
+
233
+ &:focus,
234
+ &:active {
235
+ color: $govuk-focus-text-colour;
236
+ }
241
237
  }
242
238
 
243
239
  // static.css on GOV.UK overwrites the component styles using input[type="text"]
@@ -208,6 +208,87 @@
208
208
  }
209
209
  }
210
210
 
211
+ // The following two rules are used to 'trick' the
212
+ // Youtube embed into using the desktop styles. Without
213
+ // this, the Youtube embed will use mobile styles in
214
+ // desktop viewports. The Youtube mobile styles are more
215
+ // challenging to use with a keyboard as they are designed
216
+ // for a touch screen interface. There is seemingly no way
217
+ // to make an iframe request the desktop version of a site
218
+ // and there is no parameter in the Youtube embed that would
219
+ // force the desktop styles. Hence this workaround.
220
+
221
+ // In the first rule, we are adding an arbitrarly large
222
+ // enough px to the width of the Youtube iframe so that
223
+ // it will use the desktop styling. Unfortunately, this width
224
+ // would result in the Youtube embed overlapping into the
225
+ // text content. To stop this happening, we scale the size of
226
+ // the embed down.
227
+
228
+ .gem-c-image-card__youtube-video-embed iframe {
229
+ @include govuk-media-query($from: tablet) {
230
+ transform: scale(.7);
231
+ width: calc(100% + 45px);
232
+ }
233
+ z-index: 1;
234
+ }
235
+
236
+ // In the second rule, we scale the container of the embed
237
+ // up by the amount that we scaled the Youtube embed down.
238
+ // This results in the embed being the correct size and the
239
+ // desktop styles being used.
240
+
241
+ .gem-c-image-card__youtube-video-embed {
242
+ @include govuk-media-query($from: tablet) {
243
+ transform: scale(1.3);
244
+ }
245
+ margin: 0;
246
+ padding-bottom: 68%;
247
+ }
248
+
249
+ // This rule is to reposition the embed to the correct
250
+ // place in the image card. As the embed has been scaled
251
+ // down and then scaled up again, it is misaligned and
252
+ // here we correct that misalignment.
253
+
254
+ .gem-c-image-card__youtube-video-embed.gem-c-govspeak__youtube-video iframe {
255
+ @include govuk-media-query($from: tablet) {
256
+ left: -22px;
257
+ top: -10px;
258
+ }
259
+ }
260
+
261
+ .gem-c-image-card__youtube-thumbnail-image-container {
262
+ position: relative;
263
+
264
+ &:before {
265
+ background: url("govuk_publishing_components/youtube-play-icon.png");
266
+ background: url("govuk_publishing_components/youtube-play-icon.svg"), linear-gradient(transparent, transparent);
267
+ background-repeat: no-repeat;
268
+ background-position: 50%;
269
+ background-size: 75px auto;
270
+ content: "";
271
+ height: 100%;
272
+ left: 0;
273
+ position: absolute;
274
+ top: 0;
275
+ width: 100%;
276
+ z-index: 1;
277
+ }
278
+ }
279
+
280
+ .gem-c-image-card__youtube-thumbnail-image {
281
+ filter: brightness(.9);
282
+ }
283
+
284
+ .gem-c-image-card__youtube-thumbnail-container-text {
285
+ margin-top: 10px;
286
+ }
287
+
288
+ .gem-c-image-card__youtube-thumbnail-container:focus .gem-c-image-card__youtube-thumbnail-container-text {
289
+ @include govuk-focused-text;
290
+ }
291
+
211
292
  .gem-c-image-card--no-image {
212
293
  .gem-c-image-card__text-wrapper {
213
294
  @include govuk-media-query($from: mobile, $until: tablet) {
@@ -123,7 +123,6 @@
123
123
  .gem-c-subscription-links__item--link {
124
124
  padding: govuk-spacing(2) govuk-spacing(2) govuk-spacing(2) 0;
125
125
  border: 1px solid transparent;
126
- border-bottom: 1px solid govuk-colour("dark-grey", $legacy: "grey-1");
127
126
 
128
127
  &:focus {
129
128
  border-bottom-color: transparent;
@@ -3,21 +3,38 @@
3
3
  .steps {
4
4
  padding-left: 0;
5
5
  margin-left: 0;
6
- overflow: hidden;
7
6
 
8
7
  > li {
9
- background-position: 0 .87em;
10
- background-repeat: no-repeat;
11
- list-style-type: decimal;
8
+ list-style-type: none;
12
9
  margin-left: 0;
13
10
  padding: .75em 0 .75em 2.5em;
11
+ position: relative;
12
+
13
+ // IE doesn't render this correctly with this element as display:block
14
+ // (it leaves a space for the :before pseudo element) by setting to
15
+ // display inline block and a width of 100% it works correctly.
16
+ display: inline-block;
17
+ width: 100%;
18
+ box-sizing: border-box;
19
+
20
+ &:before {
21
+ background-color: govuk-colour("black");
22
+ border-radius: 50%;
23
+ color: govuk-colour("white");
24
+ float: left;
25
+ font-size: 80%;
26
+ height: 1.75em;
27
+ left: .3em;
28
+ line-height: 1.75em;
29
+ position: absolute;
30
+ text-align: center;
31
+ top: .9em;
32
+ width: 1.75em;
33
+ }
14
34
 
15
35
  @for $i from 1 through 30 {
16
- &:nth-child(#{$i}) {
17
- background-image: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 250 250' preserveAspectRatio='xMinYMin meet'%3E%3Cg%3E%3Ccircle r='50%25' cx='50%25' cy='50%25' class='circle-back'%3E%3C/circle%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dy='0.3em' font-family='nta,arial,sans-serif' font-size='8rem' fill='%23ffffff'%3E#{$i}%3C/text%3E%3C/g%3E%3C/svg%3E ");
18
- background-repeat: no-repeat;
19
- background-position: .2em .7em;
20
- background-size: 1.4em 1.4em;
36
+ &:nth-child(#{$i}):before {
37
+ content: "#{$i}";
21
38
  }
22
39
  }
23
40
  }
@@ -5,19 +5,6 @@ module GovukPublishingComponents
5
5
  before_action :set_x_frame_options_header
6
6
  before_action :set_disable_slimmer_header
7
7
 
8
- if defined? content_security_policy
9
- content_security_policy do |p|
10
- # don't do anything if the app doesn't have a content security policy
11
- next unless p.directives.any?
12
-
13
- # Unfortunately the axe core script uses a dependency that uses eval
14
- # see: https://github.com/dequelabs/axe-core/issues/1175
15
- # Thus all components shown by govuk_publishing_components need this
16
- # enabled
17
- p.script_src(*p.script_src, :unsafe_eval)
18
- end
19
- end
20
-
21
8
  private
22
9
 
23
10
  def set_x_frame_options_header
@@ -12,8 +12,8 @@
12
12
  accordion_classes << (shared_helper.get_margin_bottom)
13
13
 
14
14
  translations = {
15
- show_text: "components.accordion.show",
16
- hide_text: "components.accordion.hide",
15
+ show_text: "common.show",
16
+ hide_text: "common.hide",
17
17
  show_all_text: "components.accordion.show_all",
18
18
  hide_all_text: "components.accordion.hide_all",
19
19
  this_section_visually_hidden: "components.accordion.this_section_visually_hidden",
@@ -1,10 +1,12 @@
1
1
  <% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
2
+ <% ga4_tracking ||= false %>
2
3
 
3
4
  <% unless navigation.content_tagged_to_current_step_by_step? %>
4
5
  <div class="gem-c-contextual-footer">
5
6
  <%# Rendering related navigation because no step by step list %>
6
7
  <%= render 'govuk_publishing_components/components/related_navigation',
7
8
  content_item: content_item,
9
+ ga4_tracking: ga4_tracking,
8
10
  context: :footer %>
9
11
  </div>
10
12
  <% end %>
@@ -1,5 +1,9 @@
1
- <% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
2
- <% shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %>
1
+ <%
2
+ ga4_tracking ||= false
3
+ request.query_parameters[:ga4_tracking] = ga4_tracking
4
+ navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request)
5
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
6
+ %>
3
7
 
4
8
  <div class="gem-c-contextual-sidebar">
5
9
  <% if navigation.content_tagged_to_a_reasonable_number_of_step_by_steps? %>
@@ -12,7 +16,7 @@
12
16
  <%= render 'govuk_publishing_components/components/step_by_step_nav', navigation.step_nav_helper.sidebar %>
13
17
  <% else %>
14
18
  <%# Rendering related navigation sidebar because no step by step list %>
15
- <%= render 'govuk_publishing_components/components/related_navigation', content_item: content_item, context: :sidebar %>
19
+ <%= render 'govuk_publishing_components/components/related_navigation', content_item: content_item, context: :sidebar, ga4_tracking: ga4_tracking %>
16
20
  <% end %>
17
21
 
18
22
  <% if navigation.content_tagged_to_other_step_by_steps? %>
@@ -4,12 +4,13 @@
4
4
  css_classes = %w( gem-c-error-message govuk-error-message )
5
5
  css_classes << classes if classes
6
6
  items ||= []
7
+ right_to_left ||= false
7
8
 
8
9
  if items.any?
9
10
  errors = items.map { |item| capture { item[:text] } }
10
11
  text = raw(errors.join("<br />"))
11
12
  end
12
13
  %>
13
- <%= tag.p id: id, class: css_classes do %>
14
+ <%= tag.p id: id, class: css_classes, dir: right_to_left ? "rtl" : nil do %>
14
15
  <span class="govuk-visually-hidden">Error:</span> <%= text %>
15
16
  <% end %>
@@ -7,7 +7,7 @@
7
7
  gtm_attributes << "gtm_preview=" + gtm_preview if gtm_preview
8
8
  gtm_attributes = gtm_attributes.join('&')
9
9
  %>
10
- <script>
10
+ <%= javascript_tag nonce: true do -%>
11
11
  var doNotTrack = ( navigator.doNotTrack === '1' || navigator.doNotTrack === 'yes' || navigator.msDoNotTrack === '1' || window.doNotTrack === '1' )
12
12
  if (!doNotTrack) {
13
13
  (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
@@ -16,4 +16,4 @@ if (!doNotTrack) {
16
16
  'https://www.googletagmanager.com/gtm.js?id='+i+dl+'&<%= raw gtm_attributes %>';f.parentNode.insertBefore(j,f);
17
17
  })(window,document,'script','dataLayer','<%= gtm_id %>');
18
18
  }
19
- </script>
19
+ <% end -%>
@@ -1,11 +1,12 @@
1
1
  <%
2
2
  id ||= "hint-#{SecureRandom.hex(4)}"
3
+ right_to_left ||= false
3
4
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
4
5
 
5
6
  css_classes = %w( gem-c-hint govuk-hint )
6
7
  css_classes << shared_helper.get_margin_bottom
7
8
  %>
8
9
 
9
- <%= tag.div id: id, class: css_classes do %>
10
+ <%= tag.div id: id, class: css_classes, dir: right_to_left ? "rtl" : nil do %>
10
11
  <%= text %>
11
12
  <% end %>