govuk_publishing_components 66.0.1 → 66.2.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 (20) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +13 -16
  3. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +0 -12
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_details.scss +5 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +9 -0
  6. data/app/views/govuk_publishing_components/components/_accordion.html.erb +0 -1
  7. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +0 -1
  8. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +0 -1
  9. data/app/views/govuk_publishing_components/components/_document_list.html.erb +0 -1
  10. data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +0 -1
  11. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +0 -1
  12. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +2 -0
  13. data/app/views/govuk_publishing_components/components/_metadata.html.erb +0 -1
  14. data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +0 -1
  15. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +0 -1
  16. data/app/views/govuk_publishing_components/components/_summary_banner.html.erb +0 -1
  17. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +11 -0
  18. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +9 -0
  19. data/lib/govuk_publishing_components/version.rb +1 -1
  20. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3ebe9a45283274b6292dd6d30412bec57eee0ef735fa61884ba91851b829eca
4
- data.tar.gz: 5930712affd37165c147d4cd471c30ce1cf00124f74372d32bc648766d90d1a9
3
+ metadata.gz: 86e6747e7ac2fbe09ae4b993c0220e43a0b95c72cb1916254bc26301fedf68ba
4
+ data.tar.gz: e70984d80ef1fb018177f52f10683b535af24665990ceb8c421802c23915afad
5
5
  SHA512:
6
- metadata.gz: 55442932e49ee57b46b34a5969feccb32fc41e9089925921acf75031db0a1258a44831c33346a47978fcd95857f5b087c4ebbb9f6c1065411eb479347d9467b2
7
- data.tar.gz: 8c61ae0535f3f89745a3dd52ffcb09a6f95316b1314f4487c78e39e6931d15f84ecdb1e0c9a877cc9e554287014d57cb0f42166a7d6732dc54d3643035ef7ff6
6
+ metadata.gz: c0393a75efbc028df6501454f07a78aa1b7f9a8cf029becea313a3881c05d0fd57f5d566551fcb631687de92dbcc379943ca846d97929bef8dd7623892006916
7
+ data.tar.gz: 19a5dfc0d677181f71c3d47553c9f0a5f05a1feef93fded11ba4b0f39151ae397d47e240d646f7423f3affb5a448805423b2838f04822cdabdccd1e0c3e0650f
@@ -4,7 +4,6 @@
4
4
  function Ga4LinkTracker (module) {
5
5
  this.module = module
6
6
  this.trackingTrigger = 'data-ga4-link' // elements with this attribute get tracked
7
- this.trackLinksOnly = this.module.hasAttribute('data-ga4-track-links-only')
8
7
  this.limitToElementClass = this.module.getAttribute('data-ga4-limit-to-element-class')
9
8
  this.PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()
10
9
  }
@@ -39,24 +38,22 @@
39
38
 
40
39
  Ga4LinkTracker.prototype.handleClick = function (event) {
41
40
  var target = event.target
42
- if (!this.trackLinksOnly) {
43
- this.trackClick(event)
44
- } else if (this.trackLinksOnly && target.closest('a')) {
45
- if (!this.limitToElementClass) {
46
- this.trackClick(event)
47
- } else {
48
- var classes = this.limitToElementClass.split(',')
49
-
50
- for (var i = 0; i < classes.length; i++) {
51
- if (target.closest('.' + classes[i].trim())) {
52
- // Stops the link tracker firing twice if the link itself has data-ga4-link, and the parent element does as well.
53
- if (target.closest('[data-ga4-link]') !== target.closest('[data-ga4-limit-to-element-class]')) {
54
- return
55
- }
56
- this.trackClick(event)
41
+
42
+ if (this.limitToElementClass) {
43
+ var classes = this.limitToElementClass.split(',')
44
+ for (var i = 0; i < classes.length; i++) {
45
+ if (target.closest('.' + classes[i].trim())) {
46
+ // Stops the link tracker firing twice if the link itself has data-ga4-link, and the parent element does as well.
47
+ if (target.closest('[data-ga4-link]') !== target.closest('[data-ga4-limit-to-element-class]')) {
48
+ return
57
49
  }
50
+ this.trackClick(event)
58
51
  }
59
52
  }
53
+ } else if (target.closest('a') || target.closest('button')) {
54
+ if (target.closest('[data-ga4-link]')) {
55
+ this.trackClick(event)
56
+ }
60
57
  }
61
58
  }
62
59
 
@@ -12,21 +12,14 @@
12
12
 
13
13
  var COOKIE_CATEGORIES = {
14
14
  cookies_policy: 'essential',
15
- seen_cookie_message: 'essential',
16
- cookie_preferences_set: 'essential',
17
15
  cookies_preferences_set: 'essential',
18
16
  '_email-alert-frontend_session': 'essential',
19
17
  intervention_campaign: 'essential',
20
18
  licensing_session: 'essential',
21
19
  govuk_contact_referrer: 'essential',
22
- multivariatetest_cohort_coronavirus_extremely_vulnerable_rate_limit: 'essential',
23
20
  app_promo_banner: 'settings',
24
- dgu_beta_banner_dismissed: 'settings',
25
21
  global_banner_seen: 'settings',
26
- user_nation: 'settings',
27
22
  govuk_chat_onboarding_complete: 'settings', // cookie details page to be updated when this is in use
28
- 'JS-Detection': 'usage',
29
- TLSversion: 'usage',
30
23
  _ga_VBLT2V3FZR: 'usage', // gtag cookie used to persist the session state, integration
31
24
  _ga_P1DGM6TVYF: 'usage', // staging
32
25
  _ga_S5RQ7FTGVR: 'usage' // production
@@ -147,11 +140,6 @@
147
140
  return true
148
141
  }
149
142
 
150
- // Survey cookies are dynamically generated, so we need to check for these separately
151
- if (cookieName.match('^govuk_surveySeen') || cookieName.match('^govuk_taken')) {
152
- return window.GOVUK.checkConsentCookieCategory(cookieName, 'settings')
153
- }
154
-
155
143
  if (COOKIE_CATEGORIES[cookieName]) {
156
144
  var cookieCategory = COOKIE_CATEGORIES[cookieName]
157
145
 
@@ -33,3 +33,8 @@
33
33
  @include govuk-link-style-inverse;
34
34
  }
35
35
  }
36
+
37
+ // fix for issue https://github.com/alphagov/govuk_publishing_components/issues/5436
38
+ .govuk-details__summary {
39
+ box-shadow: 0 4px transparent;
40
+ }
@@ -59,11 +59,20 @@
59
59
  display: flex;
60
60
  flex-wrap: wrap;
61
61
  row-gap: govuk-spacing(2);
62
+
63
+ &:has(+ .gem-c-header__content) {
64
+ @include govuk-grid-column(three-quarters);
65
+ padding: govuk-spacing(3) 0 govuk-spacing(2);
66
+ }
62
67
  }
63
68
 
64
69
  .gem-c-header__content.govuk-header__content {
65
70
  width: auto;
66
71
 
72
+ @include govuk-media-query($from: mobile) {
73
+ @include govuk-responsive-padding(3, "bottom");
74
+ }
75
+
67
76
  @include govuk-media-query($from: desktop) {
68
77
  float: right;
69
78
  }
@@ -44,7 +44,6 @@
44
44
  # object in order to keep them from colliding with GA4 event tracking attributes
45
45
  ga4_link_data_attributes = {}
46
46
  ga4_link_data_attributes[:module] = "ga4-link-tracker"
47
- ga4_link_data_attributes[:ga4_track_links_only] = ""
48
47
  ga4_link_data_attributes[:ga4_set_indexes] = ""
49
48
  ga4_link_data_attributes[:ga4_link] = {
50
49
  event_name: "navigation",
@@ -46,7 +46,6 @@
46
46
  <% unless disable_ga4 %>
47
47
  data-ga4-cookie-banner <%# GA4 pageview JS looks for data-ga4-cookie-banner %>
48
48
  data-module="ga4-link-tracker"
49
- data-ga4-track-links-only
50
49
  data-ga4-set-indexes
51
50
  data-ga4-link="<%= { event_name: "navigation", type: "cookie banner", section: t("components.cookie_banner.confirmation_message.accepted", locale: :en) }.to_json %>"
52
51
  <% end %>><%= t("components.cookie_banner.confirmation_message.accepted") %>. <span class="gem-c-cookie-banner__confirmation-message"><%= confirmation_message %></span></p>
@@ -14,7 +14,6 @@
14
14
  component_helper.add_data_attribute({
15
15
  ga4_devolved_nations_banner: devolved_nations_helper.ga4_applicable_nations_title_text(true),
16
16
  module: "ga4-link-tracker",
17
- ga4_track_links_only: "",
18
17
  ga4_set_indexes: "",
19
18
  ga4_link: {
20
19
  event_name: "navigation",
@@ -19,7 +19,6 @@
19
19
  ga4_extra_data ||= {}
20
20
  component_helper.add_data_attribute({
21
21
  module: "ga4-link-tracker",
22
- ga4_track_links_only: "",
23
22
  ga4_link: {
24
23
  "event_name": "navigation",
25
24
  "type": "document list",
@@ -33,7 +33,6 @@
33
33
  component_helper.add_data_attribute({
34
34
  ga4_emergency_banner: "",
35
35
  module: "ga4-link-tracker",
36
- ga4_track_links_only: "",
37
36
  ga4_set_indexes: "",
38
37
  ga4_link: {
39
38
  event_name: "navigation",
@@ -116,7 +116,6 @@
116
116
  <%# this is to avoid having hardcoded data attributes in locale files %>
117
117
  <span
118
118
  class="govuk-footer__licence-description"
119
- data-ga4-track-links-only
120
119
  data-ga4-link="<%= {
121
120
  "event_name": "navigation",
122
121
  "section": "Licence",
@@ -1,6 +1,7 @@
1
1
  <%
2
2
  environment ||= nil
3
3
  full_width ||= false
4
+ signout_link ||= false
4
5
  navigation_aria_label ||= t("components.layout_header.top_level")
5
6
  navigation_items ||= []
6
7
  product_name ||= nil
@@ -22,6 +23,7 @@
22
23
  environment:,
23
24
  logo_link:,
24
25
  product_name:,
26
+ signout_link:,
25
27
  } %>
26
28
  </div>
27
29
  <% if navigation_items.any? %>
@@ -84,7 +84,6 @@
84
84
  data-module="gem-toggle"
85
85
  <% else %>
86
86
  data-module="gem-toggle ga4-link-tracker"
87
- data-ga4-track-links-only
88
87
  data-ga4-link="<%= ga4_object %>"
89
88
  <% end %>>
90
89
  <%= render "govuk_publishing_components/components/metadata/sentence", items: definition, toggle_id: "#{index}-#{SecureRandom.hex(4)}" %>
@@ -21,7 +21,6 @@ unless disable_ga4
21
21
  component_helper.add_data_attribute({
22
22
  ga4_phase_banner: phase,
23
23
  module: "ga4-link-tracker",
24
- ga4_track_links_only: "",
25
24
  ga4_set_indexes: "",
26
25
  ga4_link: {
27
26
  event_name: "navigation",
@@ -81,7 +81,6 @@
81
81
  unless disable_ga4
82
82
  ga4_link_data = {
83
83
  "module": "ga4-link-tracker",
84
- "ga4-track-links-only": "",
85
84
  "ga4-set-indexes": "",
86
85
  "ga4-link": {
87
86
  "event_name": "navigation",
@@ -10,7 +10,6 @@
10
10
  component_helper.add_aria_attribute({ labelledby: title_id })
11
11
  component_helper.set_lang("en")
12
12
  component_helper.add_data_attribute({ module: "ga4-link-tracker" })
13
- component_helper.add_data_attribute({ ga4_track_links_only: "" })
14
13
  component_helper.add_data_attribute({ ga4_link: { event_name: "navigation", type: "callout" } })
15
14
  %>
16
15
  <% if title.present? && text.present? %>
@@ -31,6 +31,17 @@ examples:
31
31
  data:
32
32
  environment: production
33
33
  product_name: Product
34
+ with_signout_link:
35
+ description: Adds a "signout" link. For use across publishing apps.
36
+ data:
37
+ environment: production
38
+ signout_link: true
39
+ with_signout_link and product name:
40
+ description: Adds a "signout" link for use across publishing apps and a product name
41
+ data:
42
+ environment: production
43
+ signout_link: true
44
+ product_name: Component Guide 999.9.9
34
45
  with_navigation:
35
46
  description: Note that [remove_bottom_border](#no_bottom_border) automatically gets set to true on the header when navigation items are added.
36
47
  data:
@@ -9,6 +9,7 @@
9
9
 
10
10
  environment_exists = environment.present?
11
11
  deprecated_navigation ||= false
12
+ signout_link ||= false
12
13
  %>
13
14
 
14
15
  <% if environment_exists && deprecated_navigation %>
@@ -32,3 +33,11 @@
32
33
  </div>
33
34
  <% end %>
34
35
  </div>
36
+
37
+ <% if signout_link %>
38
+ <div class="govuk-header__content gem-c-header__content">
39
+ <nav class="gem-c-header__nav govuk-header__navigation">
40
+ <a class="govuk-header__link govuk-!-font-weight-bold" href="/auth/gds/sign_out">Sign out</a>
41
+ </nav>
42
+ </div>
43
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "66.0.1".freeze
2
+ VERSION = "66.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 66.0.1
4
+ version: 66.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -2124,7 +2124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2124
2124
  - !ruby/object:Gem::Version
2125
2125
  version: '0'
2126
2126
  requirements: []
2127
- rubygems_version: 4.0.10
2127
+ rubygems_version: 4.0.11
2128
2128
  specification_version: 4
2129
2129
  summary: A gem to document components in GOV.UK frontend applications
2130
2130
  test_files: []