govuk_publishing_components 24.18.5 → 24.21.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +59 -91
  3. data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +71 -0
  4. data/app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js +13 -2
  5. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +2 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +1 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +7 -9
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +16 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +0 -4
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +125 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +9 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/print/_layout-super-navigation-header.scss +3 -0
  13. data/app/views/govuk_publishing_components/component_guide/index.html.erb +1 -1
  14. data/app/views/govuk_publishing_components/components/_document_list.html.erb +3 -3
  15. data/app/views/govuk_publishing_components/components/_govspeak.html.erb +2 -0
  16. data/app/views/govuk_publishing_components/components/_intervention.html.erb +15 -0
  17. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +19 -13
  18. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +121 -0
  19. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +9 -0
  20. data/app/views/govuk_publishing_components/components/docs/intervention.yml +24 -0
  21. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +4 -0
  22. data/app/views/govuk_publishing_components/components/docs/layout_super_navigation_header.yml +22 -0
  23. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +3 -4
  24. data/config/initializers/assets.rb +0 -1
  25. data/config/locales/ar.yml +8 -0
  26. data/config/locales/az.yml +8 -0
  27. data/config/locales/be.yml +8 -0
  28. data/config/locales/bg.yml +8 -0
  29. data/config/locales/bn.yml +8 -0
  30. data/config/locales/cs.yml +8 -0
  31. data/config/locales/cy.yml +8 -0
  32. data/config/locales/da.yml +8 -0
  33. data/config/locales/de.yml +8 -0
  34. data/config/locales/dr.yml +8 -0
  35. data/config/locales/el.yml +8 -0
  36. data/config/locales/en.yml +89 -0
  37. data/config/locales/es-419.yml +8 -0
  38. data/config/locales/es.yml +8 -0
  39. data/config/locales/et.yml +8 -0
  40. data/config/locales/fa.yml +8 -0
  41. data/config/locales/fi.yml +8 -0
  42. data/config/locales/fr.yml +8 -0
  43. data/config/locales/gd.yml +8 -0
  44. data/config/locales/gu.yml +8 -0
  45. data/config/locales/he.yml +8 -0
  46. data/config/locales/hi.yml +8 -0
  47. data/config/locales/hr.yml +8 -0
  48. data/config/locales/hu.yml +8 -0
  49. data/config/locales/hy.yml +8 -0
  50. data/config/locales/id.yml +8 -0
  51. data/config/locales/is.yml +8 -0
  52. data/config/locales/it.yml +8 -0
  53. data/config/locales/ja.yml +8 -0
  54. data/config/locales/ka.yml +8 -0
  55. data/config/locales/kk.yml +8 -0
  56. data/config/locales/ko.yml +8 -0
  57. data/config/locales/lt.yml +8 -0
  58. data/config/locales/lv.yml +8 -0
  59. data/config/locales/ms.yml +8 -0
  60. data/config/locales/mt.yml +8 -0
  61. data/config/locales/nl.yml +8 -0
  62. data/config/locales/no.yml +8 -0
  63. data/config/locales/pa-pk.yml +8 -0
  64. data/config/locales/pa.yml +8 -0
  65. data/config/locales/pl.yml +8 -0
  66. data/config/locales/ps.yml +8 -0
  67. data/config/locales/pt.yml +8 -0
  68. data/config/locales/ro.yml +8 -0
  69. data/config/locales/ru.yml +8 -0
  70. data/config/locales/si.yml +8 -0
  71. data/config/locales/sk.yml +8 -0
  72. data/config/locales/sl.yml +8 -0
  73. data/config/locales/so.yml +8 -0
  74. data/config/locales/sq.yml +8 -0
  75. data/config/locales/sr.yml +8 -0
  76. data/config/locales/sv.yml +8 -0
  77. data/config/locales/sw.yml +8 -0
  78. data/config/locales/ta.yml +8 -0
  79. data/config/locales/th.yml +8 -0
  80. data/config/locales/tk.yml +8 -0
  81. data/config/locales/tr.yml +8 -0
  82. data/config/locales/uk.yml +8 -0
  83. data/config/locales/ur.yml +8 -0
  84. data/config/locales/uz.yml +8 -0
  85. data/config/locales/vi.yml +8 -0
  86. data/config/locales/zh-hk.yml +8 -0
  87. data/config/locales/zh-tw.yml +8 -0
  88. data/config/locales/zh.yml +8 -0
  89. data/lib/govuk_publishing_components/app_helpers/environment.rb +3 -8
  90. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +32 -11
  91. data/lib/govuk_publishing_components/presenters/meta_tags.rb +11 -4
  92. data/lib/govuk_publishing_components/version.rb +1 -1
  93. metadata +10 -2
@@ -79,6 +79,14 @@ tr:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -79,6 +79,14 @@ uk:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -79,6 +79,14 @@ ur:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -79,6 +79,14 @@ uz:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -79,6 +79,14 @@ vi:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -79,6 +79,14 @@ zh-hk:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -79,6 +79,14 @@ zh-tw:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -79,6 +79,14 @@ zh:
79
79
  search_button:
80
80
  show_button:
81
81
  top_level:
82
+ layout_super_navigation_header:
83
+ logo_link_title:
84
+ logo_text:
85
+ navigation_menu_heading:
86
+ search_text:
87
+ popular_links_heading:
88
+ popular_links:
89
+ navigation_links:
82
90
  metadata:
83
91
  from:
84
92
  history:
@@ -1,19 +1,14 @@
1
1
  module GovukPublishingComponents
2
2
  module AppHelpers
3
3
  class Environment
4
- GOVUK_ENVIRONMENTS = {
5
- "production" => "production",
6
- "staging" => "staging",
7
- "integration-blue-aws" => "integration",
8
- }.freeze
4
+ GOVUK_ENVIRONMENTS = %w[integration staging production].freeze
9
5
 
10
6
  # The "acceptance environment" we're in - not the same as Rails env.
11
- #
12
- # Can be "production", "staging", "integration", or "development"
7
+ # Can be "production", "staging", "integration", "development" or "example" (if running on Heroku)
13
8
  def self.current_acceptance_environment
14
9
  return "example" if ENV["HEROKU"]
15
10
 
16
- GOVUK_ENVIRONMENTS.fetch(ENV["ERRBIT_ENVIRONMENT_NAME"], "development")
11
+ GOVUK_ENVIRONMENTS.include?(ENV["GOVUK_ENVIRONMENT_NAME"]) ? ENV["GOVUK_ENVIRONMENT_NAME"] : "development"
17
12
  end
18
13
  end
19
14
  end
@@ -4,15 +4,18 @@ module GovukPublishingComponents
4
4
  # keys are labels, values are the content_ids for the matching taxons
5
5
  # Where multiple matching taxons are present, the top most one is the highest priority
6
6
  # and the bottom one the lowest priority
7
- PRIORITY_TAXONS = {
8
- education_coronavirus: "272308f4-05c8-4d0d-abc7-b7c2e3ccd249",
9
- worker_coronavirus: "b7f57213-4b16-446d-8ded-81955d782680",
10
- business_coronavirus: "65666cdf-b177-4d79-9687-b9c32805e450",
7
+ BREXIT_TAXONS = {
11
8
  brexit_business: "634fd193-8039-4a70-a059-919c34ff4bfc",
12
9
  brexit_individuals: "614b2e65-56ac-4f8d-bb9c-d1a14167ba25",
13
10
  brexit_taxon: "d6c2de5d-ef90-45d1-82d4-5f2438369eea",
14
11
  }.freeze
15
12
 
13
+ PRIORITY_TAXONS = {
14
+ education_coronavirus: "272308f4-05c8-4d0d-abc7-b7c2e3ccd249",
15
+ worker_coronavirus: "b7f57213-4b16-446d-8ded-81955d782680",
16
+ business_coronavirus: "65666cdf-b177-4d79-9687-b9c32805e450",
17
+ }.merge(BREXIT_TAXONS).freeze
18
+
16
19
  # Returns the highest priority taxon that has a content_id matching those in PRIORITY_TAXONS
17
20
  def self.call(content_item, query_parameters = nil)
18
21
  new(content_item, query_parameters).breadcrumbs
@@ -25,16 +28,24 @@ module GovukPublishingComponents
25
28
  @query_parameters = query_parameters
26
29
  end
27
30
 
28
- def taxon
29
- @taxon ||= begin
31
+ def priority_taxon
32
+ @priority_taxon ||= begin
30
33
  default_taxon = priority_taxons.min_by { |t| PRIORITY_TAXONS.values.index(t["content_id"]) }
31
34
  preferred_taxon || default_taxon
32
35
  end
33
36
  end
34
37
 
38
+ def priority_brexit_taxon
39
+ if tagged_to_both_brexit_child_taxons?
40
+ priority_brexit_taxons.find { |t| t["content_id"] == BREXIT_TAXONS[:brexit_taxon] }
41
+ else
42
+ priority_brexit_taxons.min_by { |t| BREXIT_TAXONS.values.index(t["content_id"]) }
43
+ end
44
+ end
45
+
35
46
  def breadcrumbs
36
- taxon && {
37
- title: taxon["title"],
47
+ priority_taxon && {
48
+ title: priority_taxon["title"],
38
49
  path: breadcrumb_path,
39
50
  tracking_category: "breadcrumbClicked",
40
51
  tracking_action: tracking_action,
@@ -43,7 +54,9 @@ module GovukPublishingComponents
43
54
  }
44
55
  end
45
56
 
46
- def brexit_audience
57
+ def brexit_audience(taxon)
58
+ return nil unless taxon
59
+
47
60
  {
48
61
  PRIORITY_TAXONS[:brexit_business] => "Brexitbusiness",
49
62
  PRIORITY_TAXONS[:brexit_individuals] => "Brexitcitizen",
@@ -70,6 +83,10 @@ module GovukPublishingComponents
70
83
  end
71
84
  end
72
85
 
86
+ def priority_brexit_taxons
87
+ priority_taxons.select { |t| priority_brexit_taxon?(t) }
88
+ end
89
+
73
90
  def taxon_tree(taxons)
74
91
  return [] if taxons.blank?
75
92
 
@@ -80,6 +97,10 @@ module GovukPublishingComponents
80
97
  PRIORITY_TAXONS.values.include?(taxon["content_id"])
81
98
  end
82
99
 
100
+ def priority_brexit_taxon?(taxon)
101
+ BREXIT_TAXONS.values.include?(taxon["content_id"])
102
+ end
103
+
83
104
  def brexit_child_taxon?(taxon)
84
105
  brexit_child_taxons.include?(taxon["content_id"])
85
106
  end
@@ -94,7 +115,7 @@ module GovukPublishingComponents
94
115
 
95
116
  def tracking_action
96
117
  action = %w[superBreadcrumb]
97
- action << brexit_audience
118
+ action << brexit_audience(priority_taxon)
98
119
  action.compact.join(" ")
99
120
  end
100
121
 
@@ -104,7 +125,7 @@ module GovukPublishingComponents
104
125
  end
105
126
 
106
127
  def breadcrumb_path
107
- taxon.dig("details", "url_override").present? ? taxon.dig("details", "url_override") : taxon["base_path"]
128
+ priority_taxon.dig("details", "url_override").present? ? priority_taxon.dig("details", "url_override") : priority_taxon["base_path"]
108
129
  end
109
130
  end
110
131
  end
@@ -123,21 +123,28 @@ module GovukPublishingComponents
123
123
  return meta_tags if taxons.blank?
124
124
  return meta_tags unless tagged_to_priority_taxon?
125
125
 
126
- meta_tags[tag_key] = brexit_audience if brexit_audience.present?
126
+ taxon =
127
+ tag_key == "govuk:brexit-audience" ? priority_brexit_taxon : priority_taxon
127
128
 
129
+ brexit_audience = priority_taxon_helper.brexit_audience(taxon)
130
+ meta_tags[tag_key] = brexit_audience if brexit_audience.present?
128
131
  meta_tags
129
132
  end
130
133
 
131
134
  def tagged_to_priority_taxon?
132
- priority_taxon_helper.taxon.present?
135
+ priority_taxon_helper.priority_taxon.present?
133
136
  end
134
137
 
135
138
  def priority_taxon_helper
136
139
  @priority_taxon_helper ||= ContentBreadcrumbsBasedOnPriority.new(content_item.deep_stringify_keys, request.query_parameters)
137
140
  end
138
141
 
139
- def brexit_audience
140
- priority_taxon_helper.brexit_audience
142
+ def priority_taxon
143
+ priority_taxon_helper.priority_taxon
144
+ end
145
+
146
+ def priority_brexit_taxon
147
+ priority_taxon_helper.priority_brexit_taxon
141
148
  end
142
149
 
143
150
  def has_content_history?
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "24.18.5".freeze
2
+ VERSION = "24.21.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.18.5
4
+ version: 24.21.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-07-09 00:00:00.000000000 Z
11
+ date: 2021-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -475,6 +475,7 @@ files:
475
475
  - app/assets/javascripts/govuk_publishing_components/components/feedback.js
476
476
  - app/assets/javascripts/govuk_publishing_components/components/govspeak.js
477
477
  - app/assets/javascripts/govuk_publishing_components/components/layout-header.js
478
+ - app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js
478
479
  - app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js
479
480
  - app/assets/javascripts/govuk_publishing_components/components/print-link.js
480
481
  - app/assets/javascripts/govuk_publishing_components/components/radio.js
@@ -546,12 +547,14 @@ files:
546
547
  - app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss
547
548
  - app/assets/stylesheets/govuk_publishing_components/components/_input.scss
548
549
  - app/assets/stylesheets/govuk_publishing_components/components/_inset-text.scss
550
+ - app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss
549
551
  - app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss
550
552
  - app/assets/stylesheets/govuk_publishing_components/components/_label.scss
551
553
  - app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss
552
554
  - app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss
553
555
  - app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss
554
556
  - app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss
557
+ - app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss
555
558
  - app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss
556
559
  - app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss
557
560
  - app/assets/stylesheets/govuk_publishing_components/components/_modal-dialogue.scss
@@ -624,6 +627,7 @@ files:
624
627
  - app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss
625
628
  - app/assets/stylesheets/govuk_publishing_components/components/print/_layout-footer.scss
626
629
  - app/assets/stylesheets/govuk_publishing_components/components/print/_layout-header.scss
630
+ - app/assets/stylesheets/govuk_publishing_components/components/print/_layout-super-navigation-header.scss
627
631
  - app/assets/stylesheets/govuk_publishing_components/components/print/_metadata.scss
628
632
  - app/assets/stylesheets/govuk_publishing_components/components/print/_search.scss
629
633
  - app/assets/stylesheets/govuk_publishing_components/components/print/_share-links.scss
@@ -694,12 +698,14 @@ files:
694
698
  - app/views/govuk_publishing_components/components/_image_card.html.erb
695
699
  - app/views/govuk_publishing_components/components/_input.html.erb
696
700
  - app/views/govuk_publishing_components/components/_inset_text.html.erb
701
+ - app/views/govuk_publishing_components/components/_intervention.html.erb
697
702
  - app/views/govuk_publishing_components/components/_inverse_header.html.erb
698
703
  - app/views/govuk_publishing_components/components/_label.html.erb
699
704
  - app/views/govuk_publishing_components/components/_layout_footer.html.erb
700
705
  - app/views/govuk_publishing_components/components/_layout_for_admin.html.erb
701
706
  - app/views/govuk_publishing_components/components/_layout_for_public.html.erb
702
707
  - app/views/govuk_publishing_components/components/_layout_header.html.erb
708
+ - app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb
703
709
  - app/views/govuk_publishing_components/components/_lead_paragraph.html.erb
704
710
  - app/views/govuk_publishing_components/components/_list.html.erb
705
711
  - app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb
@@ -773,12 +779,14 @@ files:
773
779
  - app/views/govuk_publishing_components/components/docs/image_card.yml
774
780
  - app/views/govuk_publishing_components/components/docs/input.yml
775
781
  - app/views/govuk_publishing_components/components/docs/inset_text.yml
782
+ - app/views/govuk_publishing_components/components/docs/intervention.yml
776
783
  - app/views/govuk_publishing_components/components/docs/inverse_header.yml
777
784
  - app/views/govuk_publishing_components/components/docs/label.yml
778
785
  - app/views/govuk_publishing_components/components/docs/layout_footer.yml
779
786
  - app/views/govuk_publishing_components/components/docs/layout_for_admin.yml
780
787
  - app/views/govuk_publishing_components/components/docs/layout_for_public.yml
781
788
  - app/views/govuk_publishing_components/components/docs/layout_header.yml
789
+ - app/views/govuk_publishing_components/components/docs/layout_super_navigation_header.yml
782
790
  - app/views/govuk_publishing_components/components/docs/lead_paragraph.yml
783
791
  - app/views/govuk_publishing_components/components/docs/list.yml
784
792
  - app/views/govuk_publishing_components/components/docs/machine_readable_metadata.yml