govuk_publishing_components 24.13.2 → 24.14.1

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 (32) 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 +6 -0
  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 +844 -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 +4 -0
  25. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +11 -2
  26. data/app/views/govuk_publishing_components/components/_search.html.erb +5 -2
  27. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +3 -3
  28. data/config/initializers/assets.rb +3 -0
  29. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +32 -3
  30. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -0
  31. data/lib/govuk_publishing_components/version.rb +1 -1
  32. 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>
@@ -4,6 +4,7 @@
4
4
  global_bar ||= nil
5
5
  html_lang ||= "en"
6
6
  layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns)
7
+ logo_link ||= "/"
7
8
  navigation_items ||= []
8
9
  omit_header ||= false
9
10
  show_search = local_assigns.include?(:show_search) ? local_assigns[:show_search] : true
@@ -36,6 +37,8 @@
36
37
  <meta charset="utf-8" />
37
38
  <title><%= title %></title>
38
39
 
40
+ <%= javascript_include_tag "govuk_publishing_components/rum-loader", { async: true } %>
41
+
39
42
  <%= csrf_meta_tags %>
40
43
 
41
44
  <%= stylesheet_link_tag "application", media: "all" %>
@@ -71,6 +74,7 @@
71
74
  <% unless omit_header %>
72
75
  <%= render "govuk_publishing_components/components/layout_header", {
73
76
  search: show_search,
77
+ logo_link: logo_link,
74
78
  navigation_items: navigation_items,
75
79
 
76
80
  # The (blue) bottom border needs to be underneath the emergency banner -
@@ -8,6 +8,7 @@
8
8
  search ||= false
9
9
  search_left ||= false
10
10
  width_class = full_width ? "govuk-header__container--full-width" : "govuk-width-container"
11
+ logo_link ||= "/"
11
12
 
12
13
  header_classes = %w[gem-c-layout-header govuk-header]
13
14
  header_classes << "gem-c-layout-header--#{environment}" if environment
@@ -20,7 +21,11 @@
20
21
  <% if search_left %>
21
22
  <div class="govuk-grid-row">
22
23
  <div class="gem-c-layout-header__logo govuk-grid-column-one-third-from-desktop">
23
- <%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
24
+ <%= render "govuk_publishing_components/components/layout_header/header_logo", {
25
+ environment: environment,
26
+ logo_link: logo_link,
27
+ product_name: product_name,
28
+ } %>
24
29
  </div>
25
30
  </div>
26
31
  <div class="govuk-grid-row">
@@ -36,7 +41,11 @@
36
41
  <% else %>
37
42
  <div class="govuk-grid-row">
38
43
  <div class="gem-c-layout-header__logo govuk-grid-column-two-thirds">
39
- <%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
44
+ <%= render "govuk_publishing_components/components/layout_header/header_logo", {
45
+ environment: environment,
46
+ logo_link: logo_link,
47
+ product_name: product_name,
48
+ } %>
40
49
  </div>
41
50
  <% if navigation_items.any? %>
42
51
  <div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
@@ -10,6 +10,9 @@
10
10
  size ||= ""
11
11
  value ||= ""
12
12
 
13
+ data_attributes ||= {}
14
+ data_attributes[:module] = 'gem-track-click'
15
+
13
16
  classes = %w[gem-c-search govuk-!-display-none-print]
14
17
  classes << (shared_helper.get_margin_top)
15
18
  classes << (shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
@@ -40,9 +43,9 @@
40
43
  value: value,
41
44
  ) %>
42
45
  <div class="gem-c-search__item gem-c-search__submit-wrapper">
43
- <button class="gem-c-search__submit" type="submit">
46
+ <%= tag.button class: "gem-c-search__submit", type: "submit", data: data_attributes do %>
44
47
  <%= button_text %>
45
- </button>
48
+ <% end %>
46
49
  </div>
47
50
  </div>
48
51
  </div>
@@ -1,11 +1,11 @@
1
1
  <div class="govuk-header__logo gem-c-header__logo">
2
- <a href="/" class="govuk-header__link govuk-header__link--homepage" data-module="gem-track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
2
+ <a href="<%= logo_link %>" class="govuk-header__link govuk-header__link--homepage" data-module="gem-track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
3
3
  <span class="govuk-header__logotype">
4
- <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="32" width="36">
4
+ <svg aria-hidden="true" focusable="false" class="gem-c-header__logotype-crown govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="32" width="36">
5
5
  <path fill="currentColor" fill-rule="evenodd"
6
6
  d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3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.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
7
7
  <%# Deliberate use of image tag as a fallback method https://lynn.ru/examples/svg/en.html %>
8
- <image src="<%= asset_path('govuk-logotype-crown.png') %>" class="govuk-header__logotype-crown-fallback-image"></image>
8
+ <image src="<%= asset_path('govuk-logotype-crown.png') %>" xlink:href="" display="none" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
9
9
  </svg>
10
10
  <span class="govuk-header__logotype-text">
11
11
  GOV.UK
@@ -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.2".freeze
2
+ VERSION = "24.14.1".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.2
4
+ version: 24.14.1
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-04 00:00:00.000000000 Z
11
+ date: 2021-06-15 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