govuk_publishing_components 24.13.3 → 24.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +3 -1
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +2 -0
  4. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +6 -5
  5. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +9 -7
  6. data/app/assets/javascripts/govuk_publishing_components/components/contextual-guidance.js +6 -7
  7. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +7 -7
  8. data/app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js +13 -12
  9. data/app/assets/javascripts/govuk_publishing_components/components/details.js +12 -18
  10. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +213 -215
  11. data/app/assets/javascripts/govuk_publishing_components/components/govspeak.js +4 -4
  12. data/app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js +6 -4
  13. data/app/assets/javascripts/govuk_publishing_components/components/print-link.js +4 -3
  14. data/app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js +13 -13
  15. data/app/assets/javascripts/govuk_publishing_components/components/show-password.js +5 -4
  16. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +4 -4
  17. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +3 -3
  18. data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +2 -2
  19. data/app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js +5 -3
  20. data/app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb +36 -0
  21. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-polyfill.js +159 -0
  22. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux.js +868 -0
  23. data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +50 -8
  24. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -0
  25. data/config/initializers/assets.rb +3 -0
  26. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +32 -3
  27. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -0
  28. data/lib/govuk_publishing_components/version.rb +1 -1
  29. metadata +5 -2
@@ -3,39 +3,81 @@
3
3
  %>
4
4
 
5
5
  <nav id="proposition-menu" class="no-proposition-name gem-c-government-navigation" aria-label="Departments and policy navigation">
6
- <ul id="proposition-links">
6
+ <ul id="proposition-links" data-module="gem-track-click">
7
7
  <li>
8
- <a class="<%= 'active' if active == 'departments' %> govuk-link govuk-link--no-underline govuk-link--inverse" href="/government/organisations">
8
+ <a class="<%= 'active' if active == 'departments' %> govuk-link govuk-link--no-underline govuk-link--inverse"
9
+ data-track-category="headerClicked"
10
+ data-track-action="departmentsLink"
11
+ data-track-label="/government/organisations"
12
+ data-track-dimension="<%= t("components.government_navigation.departments") %>"
13
+ data-track-dimension-index="29"
14
+ href="/government/organisations">
9
15
  <%= t("components.government_navigation.departments") %>
10
16
  </a>
11
17
  </li>
12
18
  <li>
13
- <a class="<%= 'active' if active == 'worldwide' %> govuk-link govuk-link--no-underline govuk-link--inverse" href="/government/world">
19
+ <a class="<%= 'active' if active == 'worldwide' %> govuk-link govuk-link--no-underline govuk-link--inverse"
20
+ data-track-category="headerClicked"
21
+ data-track-action="worldwideLink"
22
+ data-track-label="/world"
23
+ data-track-dimension="<%= t("components.government_navigation.worldwide") %>"
24
+ data-track-dimension-index="29"
25
+ href="/world">
14
26
  <%= t("components.government_navigation.worldwide") %>
15
27
  </a>
16
28
  </li>
17
29
  <li>
18
- <a class="<%= 'active' if active == 'how-government-works' %> govuk-link govuk-link--no-underline govuk-link--inverse" href="/government/how-government-works">
30
+ <a class="<%= 'active' if active == 'how-government-works' %> govuk-link govuk-link--no-underline govuk-link--inverse"
31
+ data-track-category="headerClicked"
32
+ data-track-action="governmentactivityLink"
33
+ data-track-label="/government/how-government-works"
34
+ data-track-dimension="<%= t("components.government_navigation.how-government-works") %>"
35
+ data-track-dimension-index="29"
36
+ href="/government/how-government-works">
19
37
  <%= t("components.government_navigation.how-government-works") %>
20
38
  </a>
21
39
  </li>
22
40
  <li>
23
- <a class="<%= 'active' if active == 'get-involved' %> govuk-link govuk-link--no-underline govuk-link--inverse" href="/government/get-involved">
41
+ <a class="<%= 'active' if active == 'get-involved' %> govuk-link govuk-link--no-underline govuk-link--inverse"
42
+ data-track-category="headerClicked"
43
+ data-track-action="governmentactivityLink"
44
+ data-track-label="/government/get-involved"
45
+ data-track-dimension="<%= t("components.government_navigation.get-involved") %>"
46
+ data-track-dimension-index="29"
47
+ href="/government/get-involved">
24
48
  <%= t("components.government_navigation.get-involved") %>
25
49
  </a>
26
50
  </li>
27
51
  <li class="clear-child">
28
- <a class="<%= 'active' if active == 'consultations' %> govuk-link govuk-link--no-underline govuk-link--inverse" href="<%= CGI::escapeHTML('/search/policy-papers-and-consultations?content_store_document_type[]=open_consultations&content_store_document_type[]=closed_consultations') %>">
52
+ <a class="<%= 'active' if active == 'consultations' %> govuk-link govuk-link--no-underline govuk-link--inverse"
53
+ data-track-category="headerClicked"
54
+ data-track-action="governmentactivityLink"
55
+ data-track-label="<%= CGI::escapeHTML('/search/policy-papers-and-consultations?content_store_document_type[]=open_consultations&content_store_document_type[]=closed_consultations') %>"
56
+ data-track-dimension="<%= t("components.government_navigation.consultations") %>"
57
+ data-track-dimension-index="29"
58
+ href="<%= CGI::escapeHTML('/search/policy-papers-and-consultations?content_store_document_type[]=open_consultations&content_store_document_type[]=closed_consultations') %>">
29
59
  <%= t("components.government_navigation.consultations") %>
30
60
  </a>
31
61
  </li>
32
62
  <li>
33
- <a class="<%= 'active' if active == 'statistics' %> govuk-link govuk-link--no-underline govuk-link--inverse" href="/search/research-and-statistics">
63
+ <a class="<%= 'active' if active == 'statistics' %> govuk-link govuk-link--no-underline govuk-link--inverse"
64
+ data-track-category="headerClicked"
65
+ data-track-action="governmentactivityLink"
66
+ data-track-label="/search/research-and-statistics"
67
+ data-track-dimension="<%= t("components.government_navigation.statistics") %>"
68
+ data-track-dimension-index="29"
69
+ href="/search/research-and-statistics">
34
70
  <%= t("components.government_navigation.statistics") %>
35
71
  </a>
36
72
  </li>
37
73
  <li>
38
- <a class="<%= 'active' if active == 'announcements' %> govuk-link govuk-link--no-underline govuk-link--inverse" href="/news-and-communications">
74
+ <a class="<%= 'active' if active == 'announcements' %> govuk-link govuk-link--no-underline govuk-link--inverse"
75
+ data-track-category="headerClicked"
76
+ data-track-action="governmentactivityLink"
77
+ data-track-label="/search/news-and-communications"
78
+ data-track-dimension="<%= t("components.government_navigation.news_and_communications") %>"
79
+ data-track-dimension-index="29"
80
+ href="/search/news-and-communications">
39
81
  <%= t("components.government_navigation.news_and_communications") %>
40
82
  </a>
41
83
  </li>
@@ -37,6 +37,8 @@
37
37
  <meta charset="utf-8" />
38
38
  <title><%= title %></title>
39
39
 
40
+ <%= javascript_include_tag "govuk_publishing_components/rum-loader", { async: true } %>
41
+
40
42
  <%= csrf_meta_tags %>
41
43
 
42
44
  <%= stylesheet_link_tag "application", media: "all" %>
@@ -7,6 +7,9 @@ Rails.application.config.assets.precompile += %w[
7
7
  component_guide/filter-components.js
8
8
  component_guide/visual-regression.js
9
9
  component_guide/print.css
10
+ govuk_publishing_components/rum-loader.js
11
+ govuk_publishing_components/vendor/lux.js
12
+ govuk_publishing_components/vendor/lux-polyfill.js
10
13
  govuk_publishing_components/all_components.js
11
14
  govuk_publishing_components/ie.js
12
15
  govuk_publishing_components/modules.js
@@ -8,7 +8,9 @@ module GovukPublishingComponents
8
8
  education_coronavirus: "272308f4-05c8-4d0d-abc7-b7c2e3ccd249",
9
9
  worker_coronavirus: "b7f57213-4b16-446d-8ded-81955d782680",
10
10
  business_coronavirus: "65666cdf-b177-4d79-9687-b9c32805e450",
11
- transition_period: "d6c2de5d-ef90-45d1-82d4-5f2438369eea",
11
+ brexit_business: "634fd193-8039-4a70-a059-919c34ff4bfc",
12
+ brexit_individuals: "614b2e65-56ac-4f8d-bb9c-d1a14167ba25",
13
+ brexit_taxon: "d6c2de5d-ef90-45d1-82d4-5f2438369eea",
12
14
  }.freeze
13
15
 
14
16
  # Returns the highest priority taxon that has a content_id matching those in PRIORITY_TAXONS
@@ -33,9 +35,9 @@ module GovukPublishingComponents
33
35
  def breadcrumbs
34
36
  taxon && {
35
37
  title: taxon["title"],
36
- path: taxon["base_path"],
38
+ path: breadcrumb_path,
37
39
  tracking_category: "breadcrumbClicked",
38
- tracking_action: "superBreadcrumb",
40
+ tracking_action: tracking_action,
39
41
  tracking_label: content_item["base_path"],
40
42
  tracking_dimension_enabled: false,
41
43
  }
@@ -46,6 +48,8 @@ module GovukPublishingComponents
46
48
  def preferred_taxon
47
49
  if preferred_priority_taxon
48
50
  priority_taxons.find { |t| t["content_id"] == preferred_priority_taxon }
51
+ elsif tagged_to_both_brexit_child_taxons?
52
+ priority_taxons.find { |t| t["content_id"] == PRIORITY_TAXONS[:brexit_taxon] }
49
53
  end
50
54
  end
51
55
 
@@ -68,9 +72,34 @@ module GovukPublishingComponents
68
72
  PRIORITY_TAXONS.values.include?(taxon["content_id"])
69
73
  end
70
74
 
75
+ def brexit_child_taxon?(taxon)
76
+ brexit_child_taxons.include?(taxon["content_id"])
77
+ end
78
+
79
+ def brexit_child_taxons
80
+ [PRIORITY_TAXONS[:brexit_business], PRIORITY_TAXONS[:brexit_individuals]]
81
+ end
82
+
71
83
  def preferred_priority_taxon
72
84
  query_parameters["priority-taxon"] if query_parameters
73
85
  end
86
+
87
+ def tracking_action
88
+ action = %w[superBreadcrumb]
89
+ action << "Brexitbusiness" if taxon["content_id"] == PRIORITY_TAXONS[:brexit_business]
90
+ action << "Brexitcitizen" if taxon["content_id"] == PRIORITY_TAXONS[:brexit_individuals]
91
+ action << "Brexitbusinessandcitizen" if taxon["content_id"] == PRIORITY_TAXONS[:brexit_taxon]
92
+ action.join(" ")
93
+ end
94
+
95
+ def tagged_to_both_brexit_child_taxons?
96
+ t = priority_taxons.select { |taxon| brexit_child_taxon?(taxon) }
97
+ t.uniq.count > 1
98
+ end
99
+
100
+ def breadcrumb_path
101
+ taxon.dig("details", "url_override").present? ? taxon.dig("details", "url_override") : taxon["base_path"]
102
+ end
74
103
  end
75
104
  end
76
105
  end
@@ -194,6 +194,7 @@ module GovukPublishingComponents
194
194
  maib_report
195
195
  raib_report
196
196
  simple_smart_answer
197
+ smart_answer
197
198
  transaction
198
199
  ]
199
200
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "24.13.3".freeze
2
+ VERSION = "24.15.0".freeze
3
3
  end
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: 24.13.3
4
+ version: 24.15.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: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2021-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -484,8 +484,11 @@ files:
484
484
  - app/assets/javascripts/govuk_publishing_components/lib/track-click.js
485
485
  - app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js
486
486
  - app/assets/javascripts/govuk_publishing_components/modules.js
487
+ - app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
487
488
  - app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js
488
489
  - app/assets/javascripts/govuk_publishing_components/vendor/json2.js
490
+ - app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-polyfill.js
491
+ - app/assets/javascripts/govuk_publishing_components/vendor/lux/lux.js
489
492
  - app/assets/javascripts/govuk_publishing_components/vendor/modernizr.js
490
493
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js
491
494
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js