govuk_publishing_components 37.9.1 → 37.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5dd2b5e600cf344b23c52992b273a3af2ea102506584e06dfb001aa810e0491
4
- data.tar.gz: 459ba0f50e42851c6ea04b0490aba7714cb221fb6b97e735cb48f4548f1e8237
3
+ metadata.gz: 88e7235efad66b3b4e58b76104ee17ffd0df45709e3a0ead2d21b3349af45514
4
+ data.tar.gz: 70a11adff6bea43df88c5b10bf9d0ab0934510d8a57ec7f621c50e0006e689a6
5
5
  SHA512:
6
- metadata.gz: 0dd79b5496db1fe55d085e18476983bcaf5abefa630e44544acfe795f40c68c3529556a8dcb02d8f0b25695bb4c0db223fb0e0038cfc6cdc1389db5fe48c86a2
7
- data.tar.gz: e54878f904583f718889acc341ea00f8a7281f82783bb8141e358c29068c63c67f3c96dbd04820c5d09562cfe2aa31cb6b3008f3897ef7e113cefd792675ae62
6
+ metadata.gz: 750feab9da7c02d5fd72d55e9b40a027d02000656a987316974a282dc4357832a3600670826b9a80dac4c64a087f18acc97eacab3573879e3ba46148f5b5bf08
7
+ data.tar.gz: db8c5538ef83cb50bcf37e11e6e5693a8995da9a2deda172dfc9591eb10a1d77c5ed54b65ecf62fab5d4233146a201556f1eb9280a37a9be693e30a94ca44297
@@ -62,7 +62,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
62
62
  intervention: this.getBannerPresence('[data-ga4-intervention-banner]'),
63
63
  query_string: this.getQueryString(),
64
64
  search_term: this.getSearchTerm(),
65
- spelling_suggestion: this.getMetaContent('spelling-suggestion')
65
+ spelling_suggestion: this.getMetaContent('spelling-suggestion'),
66
+ discovery_engine_attribution_token: this.getMetaContent('discovery-engine-attribution-token')
66
67
  }
67
68
  }
68
69
  window.GOVUK.analyticsGa4.core.sendData(data)
@@ -134,8 +134,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
134
134
  var $navMenuLinks = this.$navMenu.querySelectorAll('li a')
135
135
  var $firstNavLink = $navMenuLinks[0]
136
136
  var $lastNavLink = $navMenuLinks[$navMenuLinks.length - 1]
137
- var $searchMenuLinks = this.$searchMenu.querySelectorAll('li a')
138
- var $lastSearchLink = $searchMenuLinks[$searchMenuLinks.length - 1]
137
+ var $searchMenuTabbable = this.$searchMenu.querySelectorAll('li a, input, button')
138
+ var $lastSearchMenuTabbable = $searchMenuTabbable[$searchMenuTabbable.length - 1]
139
139
 
140
140
  if (event.keyCode === KEY_TAB) {
141
141
  if (!this.$navMenu.hasAttribute('hidden')) {
@@ -169,7 +169,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
169
169
  break
170
170
  }
171
171
  } else if (!this.$searchMenu.hasAttribute('hidden')) {
172
- if (document.activeElement === $lastSearchLink) {
172
+ if (document.activeElement === $lastSearchMenuTabbable) {
173
173
  if (!event.shiftKey) {
174
174
  hide(this.$searchToggle, this.$searchMenu)
175
175
  }
@@ -10,20 +10,9 @@
10
10
  classes << "disable-youtube" if disable_youtube_expansions
11
11
  classes << "gem-c-govspeak--inverse" if inverse
12
12
 
13
- disable_ga4 ||= false
14
-
15
13
  data_modules = "govspeak"
16
- data_modules << " ga4-link-tracker" unless disable_ga4
17
14
  data_attributes = { module: data_modules }
18
15
 
19
- unless disable_ga4
20
- data_attributes.merge!({
21
- ga4_track_links_only: "",
22
- ga4_limit_to_element_class: "call-to-action, info-notice, help-notice, advisory",
23
- ga4_link: { "event_name": "navigation", "type": "callout" }.to_json,
24
- })
25
- end
26
-
27
16
  %>
28
17
 
29
18
  <%= tag.div(class: "gem-c-govspeak govuk-govspeak " + classes.join(" "), data: data_attributes) do %>
@@ -25,28 +25,15 @@
25
25
  aria_attributes[:labelledby] = banner_title_id if show_banner_title
26
26
 
27
27
  description_present = description.present? || description_text.present? || description_govspeak.present?
28
- disable_ga4 ||= false
29
28
 
30
29
  if description_govspeak
31
30
  govspeak_data_attributes = {
32
31
  content: description_govspeak,
33
- disable_ga4: true # Keep the govspeak component GA4 tracking disabled, otherwise tracking will be duplicated when tracking is enabled on this component.
34
- }
35
- end
36
-
37
- unless disable_ga4
38
- section_data_attributes = {
39
- module: "ga4-link-tracker",
40
- ga4_track_links_only: "",
41
- ga4_link: {
42
- event_name: "navigation",
43
- type: "callout"
44
- }.to_json
45
32
  }
46
33
  end
47
34
  %>
48
35
  <% if title || description_present %>
49
- <%= tag.section class: css_classes, aria: aria_attributes, lang: lang, role: "region", data: section_data_attributes do %>
36
+ <%= tag.section class: css_classes, aria: aria_attributes, lang: lang, role: "region" do %>
50
37
  <%= tag.div class: "govuk-notification-banner__header" do %>
51
38
  <%= tag.h2 banner_title, class: "govuk-notification-banner__title", id: banner_title_id %>
52
39
  <% end if show_banner_title %>
@@ -14,18 +14,9 @@
14
14
  text_classes << "gem-c-warning-text__text--no-indent" if text_icon.empty?
15
15
  text_classes << "gem-c-warning-text__text--large" if large_font
16
16
  text_classes << "gem-c-warning-text__text--highlight" if highlight_text
17
-
18
- disable_ga4 ||= false
19
-
20
- ga4_data_attributes = {
21
- "module": "ga4-link-tracker",
22
- "ga4-track-links-only": "",
23
- "ga4-link": { "event_name": "navigation", "type": "callout" }.to_json
24
- } unless disable_ga4
25
-
26
17
  %>
27
18
 
28
- <%= tag.div id: id, class: "gem-c-warning-text govuk-warning-text", data: ga4_data_attributes do %>
19
+ <%= tag.div id: id, class: "gem-c-warning-text govuk-warning-text" do %>
29
20
  <% unless text_icon.empty? %>
30
21
  <%= tag.span text_icon, class: "govuk-warning-text__icon", "aria-hidden": "true" %>
31
22
  <% end %>
@@ -914,12 +914,3 @@ examples:
914
914
  <p>Deforested area. Credit: Blue Ventures-Garth Cripps</p>
915
915
  </figcaption>
916
916
  </figure>
917
- without_ga4_tracking:
918
- description: |
919
- Disables GA4 tracking on the component. Tracking is enabled by default. This adds a data module and data-attributes with JSON data. See the [ga4-link-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
920
- data:
921
- block: |
922
- <p>
923
- <a href='https://www.gov.uk'>Hello World</a>
924
- </p>
925
- disable_ga4: true
@@ -65,13 +65,3 @@ examples:
65
65
  description_govspeak: <p>This document is no longer current. We published a new version on 30 September 2015.</p>
66
66
  show_banner_title: true
67
67
  banner_title: "Information"
68
- with_ga4_tracking_disabled:
69
- description: |
70
- Disables GA4 tracking on the component. Tracking on the component is enabled by default. Tracking on the nested govspeak component is always disabled to prevent duplication. When tracking is enabled on this component, a data module and data attributes are added to the parent element. See the [ga4-link-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
71
- data:
72
- disable_ga4: true
73
- title: 'This publication was withdrawn on 30 September 2015'
74
- description_govspeak: <p>This document is no longer current. We published a new version on 30 September 2015.</p>
75
- show_banner_title: true
76
- banner_title: "Information"
77
-
@@ -33,10 +33,3 @@ examples:
33
33
  data:
34
34
  text: "This is a heading 3"
35
35
  heading_level: 3
36
- without_ga4_tracking:
37
- description: |
38
- Disables GA4 tracking on warning text links. Tracking is enabled by default, which adds a data module and data attributes to the component. See the [ga4-link-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
39
- data:
40
- disable_ga4: true
41
- text: "This is a heading 3"
42
- heading_level: 3
@@ -55,11 +55,6 @@ module GovukPublishingComponents
55
55
  step_by_step: false,
56
56
  breadcrumbs: navigation.breadcrumbs,
57
57
  }
58
- elsif navigation.content_has_a_topic?
59
- {
60
- step_by_step: false,
61
- breadcrumbs: navigation.topic_breadcrumbs,
62
- }
63
58
  elsif navigation.use_taxon_breadcrumbs?
64
59
  {
65
60
  step_by_step: false,
@@ -33,10 +33,6 @@ module GovukPublishingComponents
33
33
  @taxon_breadcrumbs ||= ContentBreadcrumbsBasedOnTaxons.call(content_item)
34
34
  end
35
35
 
36
- def topic_breadcrumbs
37
- @topic_breadcrumbs ||= ContentBreadcrumbsBasedOnTopic.call(content_item)
38
- end
39
-
40
36
  def breadcrumbs
41
37
  breadcrumbs_based_on_ancestors
42
38
  end
@@ -88,10 +84,6 @@ module GovukPublishingComponents
88
84
  content_item["document_type"] == "html_publication"
89
85
  end
90
86
 
91
- def content_has_a_topic?
92
- content_item.dig("links", "topics").present?
93
- end
94
-
95
87
  def content_tagged_to_current_step_by_step?
96
88
  # TODO: remove indirection here
97
89
  step_nav_helper.show_header?
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "37.9.1".freeze
2
+ VERSION = "37.10.0".freeze
3
3
  end
@@ -24,7 +24,6 @@ require "govuk_publishing_components/presenters/page_with_step_by_step_navigatio
24
24
  require "govuk_publishing_components/presenters/public_layout_helper"
25
25
  require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_ancestors"
26
26
  require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons"
27
- require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic"
28
27
  require "govuk_publishing_components/presenters/checkboxes_helper"
29
28
  require "govuk_publishing_components/presenters/select_helper"
30
29
  require "govuk_publishing_components/presenters/meta_tags"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 37.9.1
4
+ version: 37.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-21 00:00:00.000000000 Z
11
+ date: 2024-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -957,7 +957,6 @@ files:
957
957
  - lib/govuk_publishing_components/presenters/component_wrapper_helper.rb
958
958
  - lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_ancestors.rb
959
959
  - lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons.rb
960
- - lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic.rb
961
960
  - lib/govuk_publishing_components/presenters/content_item.rb
962
961
  - lib/govuk_publishing_components/presenters/contents_list_helper.rb
963
962
  - lib/govuk_publishing_components/presenters/contextual_navigation.rb
@@ -1640,7 +1639,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1640
1639
  - !ruby/object:Gem::Version
1641
1640
  version: '0'
1642
1641
  requirements: []
1643
- rubygems_version: 3.5.6
1642
+ rubygems_version: 3.5.7
1644
1643
  signing_key:
1645
1644
  specification_version: 4
1646
1645
  summary: A gem to document components in GOV.UK frontend applications
@@ -1,38 +0,0 @@
1
- module GovukPublishingComponents
2
- module Presenters
3
- class ContentBreadcrumbsBasedOnTopic
4
- def self.call(content_item)
5
- new(content_item).breadcrumbs
6
- end
7
-
8
- attr_reader :content_item
9
-
10
- def initialize(content_item)
11
- @content_item = content_item
12
- end
13
-
14
- def breadcrumbs
15
- breadcrumbs = [{ title: "Home", url: "/" }]
16
- return breadcrumbs unless topics.present?
17
-
18
- breadcrumbs << topic_breadcrumb
19
- breadcrumbs
20
- end
21
-
22
- def topic_breadcrumb
23
- {
24
- title: first_topic["title"],
25
- url: first_topic["base_path"],
26
- }
27
- end
28
-
29
- def first_topic
30
- topics.first
31
- end
32
-
33
- def topics
34
- @topics ||= content_item.dig("links", "topics")
35
- end
36
- end
37
- end
38
- end