govuk_publishing_components 23.13.1 → 24.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/take-action-amber.svg +4 -0
  3. data/app/assets/images/govuk_publishing_components/take-action-green.svg +4 -0
  4. data/app/assets/images/govuk_publishing_components/take-action-red.svg +4 -0
  5. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +286 -4
  6. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +0 -4
  7. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +23 -14
  8. data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js +8 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +0 -1
  10. data/app/assets/stylesheets/govuk_publishing_components/component_support.scss +0 -2
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +298 -14
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +34 -17
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +14 -8
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +4 -4
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +35 -44
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +21 -5
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +105 -48
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +8 -8
  19. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +0 -5
  20. data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +17 -9
  21. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss +2 -2
  22. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +1 -11
  23. data/app/models/govuk_publishing_components/audit_applications.rb +1 -1
  24. data/app/models/govuk_publishing_components/component_doc.rb +1 -1
  25. data/app/views/govuk_publishing_components/audit/show.html.erb +26 -26
  26. data/app/views/govuk_publishing_components/components/_accordion.html.erb +13 -20
  27. data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -3
  28. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +2 -8
  29. data/app/views/govuk_publishing_components/components/_document_list.html.erb +12 -2
  30. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +9 -4
  31. data/app/views/govuk_publishing_components/components/attachment/{_thumbnail_document.svg → _thumbnail_document.html.erb} +0 -0
  32. data/app/views/govuk_publishing_components/components/attachment/{_thumbnail_generic.svg → _thumbnail_generic.html.erb} +0 -0
  33. data/app/views/govuk_publishing_components/components/attachment/{_thumbnail_spreadsheet.svg → _thumbnail_spreadsheet.html.erb} +0 -0
  34. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +21 -0
  35. data/app/views/govuk_publishing_components/components/docs/accordion.yml +8 -3
  36. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +65 -1
  37. data/app/views/govuk_publishing_components/components/docs/document_list.yml +50 -7
  38. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +3 -3
  39. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +11 -0
  40. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
  41. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +9 -4
  42. data/config/initializers/assets.rb +3 -1
  43. data/config/locales/cy.yml +6 -1
  44. data/config/locales/en.yml +6 -1
  45. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +183 -2
  46. data/lib/govuk_publishing_components/version.rb +1 -1
  47. data/node_modules/govuk-frontend/govuk/all.js +1 -1
  48. data/node_modules/govuk-frontend/govuk/components/_all.scss +1 -0
  49. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +10 -10
  50. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/template.njk +2 -2
  51. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +2 -0
  52. data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +1 -0
  53. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +1 -1
  54. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +13 -0
  55. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_cookie-banner.scss +2 -0
  56. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +51 -0
  57. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +425 -0
  58. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +132 -0
  59. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro.njk +3 -0
  60. data/node_modules/govuk-frontend/govuk/components/cookie-banner/template.njk +63 -0
  61. data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +2 -2
  62. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +18 -18
  63. data/node_modules/govuk-frontend/govuk/components/header/template.njk +4 -4
  64. data/node_modules/govuk-frontend/govuk/components/table/_index.scss +21 -0
  65. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +2 -2
  66. data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
  67. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +94 -0
  68. data/node_modules/govuk-frontend/package.json +1 -1
  69. metadata +16 -21
  70. data/app/assets/images/govuk_publishing_components/chevron-banner/chevron-banner-small-focus.svg +0 -4
  71. data/app/assets/images/govuk_publishing_components/chevron-banner/chevron-banner-small.svg +0 -4
  72. data/app/assets/javascripts/govuk_publishing_components/components/header.js +0 -8
  73. data/app/assets/javascripts/govuk_publishing_components/lib/auto-track-event.js +0 -31
  74. data/app/assets/stylesheets/govuk_publishing_components/components/_chevron-banner.scss +0 -138
  75. data/app/assets/stylesheets/govuk_publishing_components/components/_list.scss +0 -1
  76. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_variables.scss +0 -27
  77. data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_back-arrow.scss +0 -13
  78. data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_clearfix.scss +0 -8
  79. data/app/views/govuk_publishing_components/components/_chevron_banner.html.erb +0 -19
  80. data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +0 -85
  81. data/app/views/govuk_publishing_components/components/_translation-nav.html.erb +0 -33
  82. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_related_links.html.erb +0 -6
  83. data/app/views/govuk_publishing_components/components/docs/chevron_banner.yml +0 -33
  84. data/app/views/govuk_publishing_components/components/docs/subscription-links.yml +0 -103
  85. data/app/views/govuk_publishing_components/components/docs/translation-nav.yml +0 -139
@@ -4,20 +4,25 @@ govuk_frontend_components:
4
4
  - accordion
5
5
  body: |
6
6
  This component is based on the [design system accordion component](https://design-system.service.gov.uk/components/accordion/)
7
- and is currently experimental. If using this component, please feed back any research findings to the Design System team.
7
+ and is currently experimental because more research is needed to validate it. If using this component, [please feed back any research findings to the Design System team](https://design-system.service.gov.uk/components/accordion/#next-steps).
8
8
 
9
9
  accessibility_criteria: |
10
10
  The accordion must:
11
11
 
12
12
  * accept focus
13
13
  * be usable with a keyboard
14
- * indicate when they have focus
14
+ * the controls must change in appearance when keyboard focus moves to it
15
+ * the controls must indicate when the mouse is hovered over it
15
16
  * be usable with touch
16
17
  * be usable with voice commands
17
18
  * have visible text
18
19
  * indicate to users that each section can be expanded and collapsed
19
20
  * inform the user when a step has been expanded or collapsed
20
- * be readable when only the text of the page is zoomed in
21
+ * be readable when only the [text of the page is zoomed in](https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text)
22
+ * zoom in up to 300% without the text spilling off the screen
23
+ * pass colour contrast
24
+ * the accordion header button element has aria-controls set to the ID of the element containing the accordion panel content.
25
+ * section content must have aria-label / aria-labelledby with a value that refers to the button that controls display of the content.
21
26
 
22
27
  Section headings must use a button element:
23
28
 
@@ -72,6 +72,11 @@ examples:
72
72
  - text: Check what age you can drive
73
73
  href: "/vehicles-can-drive"
74
74
  optional: false
75
+ - title: Testing the and
76
+ logic: and
77
+ contents:
78
+ - type: paragraph
79
+ text: hello hello what's UP
75
80
  - title: Driving lessons and practice
76
81
  contents:
77
82
  - type: paragraph
@@ -144,7 +149,33 @@ examples:
144
149
  - text: Find out what you’ll get
145
150
  href: "/settled-status-eu-citizens-families/what-settled-and-presettled-status-means"
146
151
  optional: false
147
- transition_countdown_exception:
152
+ with_brexit_cta:
153
+ description: For documents tagged with certain taxons defined in `brexit_cta_taxon_allow_list` we show a custom Brexit call to action element.
154
+ data:
155
+ content_item:
156
+ title: "Transport news story"
157
+ content_id: "3c402d90-fe77-49b9-a8aa-1800d4fc2b3d"
158
+ links:
159
+ ordered_related_items:
160
+ - title: Find an apprenticeship
161
+ base_path: /apply-apprenticeship
162
+ - title: Training and study at work
163
+ base_path: /training-study-work-your-rights
164
+ - title: Careers helpline for teenagers
165
+ base_path: /careers-helpline-for-teenagers
166
+ document_collections:
167
+ - title: Recruit an apprentice (formerly apprenticeship vacancies)
168
+ base_path: /government/collections/apprenticeship-vacancies
169
+ document_type: document_collection
170
+ - title: The future of jobs and skills
171
+ base_path: /government/collections/the-future-of-jobs-and-skills
172
+ document_type: document_collection
173
+ taxons:
174
+ - content_id: "a4038b29-b332-4f13-98b1-1c9709e216bc"
175
+ title: "Transport"
176
+ phase: "live"
177
+ with_brexit_cta_document_exception:
178
+ description: Illustrates an exception to showing the custom Brexit call to action element as defined in `brexit_cta_document_type_exceptions`.
148
179
  data:
149
180
  content_item:
150
181
  title: "30 creative teams awarded up to £100,000 each for Festival UK* 2022 R&D project"
@@ -164,3 +195,36 @@ examples:
164
195
  - title: The future of jobs and skills
165
196
  base_path: /government/collections/the-future-of-jobs-and-skills
166
197
  document_type: document_collection
198
+ taxons:
199
+ - content_id: "e2ca2f1a-0ff3-43ce-b813-16645ff27904"
200
+ title: "Society and culture"
201
+ phase: "live"
202
+ with_brexit_cta_taxon_exception:
203
+ description: Illustrates an exception to showing the custom Brexit call to action element as defined in `brexit_cta_taxon_exception_list`.
204
+ data:
205
+ content_item:
206
+ title: "Local transport news story"
207
+ content_id: "5c82db20-7631-11e4-a3cb-005056011aef"
208
+ links:
209
+ ordered_related_items:
210
+ - title: Find an apprenticeship
211
+ base_path: /apply-apprenticeship
212
+ - title: Training and study at work
213
+ base_path: /training-study-work-your-rights
214
+ - title: Careers helpline for teenagers
215
+ base_path: /careers-helpline-for-teenagers
216
+ document_collections:
217
+ - title: Recruit an apprentice (formerly apprenticeship vacancies)
218
+ base_path: /government/collections/apprenticeship-vacancies
219
+ document_type: document_collection
220
+ - title: The future of jobs and skills
221
+ base_path: /government/collections/the-future-of-jobs-and-skills
222
+ document_type: document_collection
223
+ taxons:
224
+ - content_id: "3b4d6319-fcef-4637-b35a-e3df76321894"
225
+ title: "Local transport"
226
+ phase: "live"
227
+ links:
228
+ parent_taxons:
229
+ - content_id: "a4038b29-b332-4f13-98b1-1c9709e216bc"
230
+ title: "Transport"
@@ -1,16 +1,16 @@
1
1
  name: Document list
2
2
  description: An ordered list of documents including a document type, when updated and a link.
3
3
  body: |
4
- Outputs a list to documents, based on an array of document data. This may include:
4
+ Outputs a list to documents, based on an array of document data. A "document" in this context can be an asset (such as a ODT or other downloadable document) or a web page.
5
+
6
+ The component can display:
5
7
 
6
- * document title
7
- * link to the document
8
- * last updated date object
9
- * document type
8
+ * a document title
9
+ * a link to the document
10
+ * a last updated date object
11
+ * a document type
10
12
 
11
13
  Tracking can be added to the links by supplying optional data attributes for each.
12
-
13
- Documents are presented in an ordered list as the component expects that the ordering of the documents is relevant.
14
14
  accessibility_criteria: |
15
15
  The component must:
16
16
 
@@ -195,6 +195,23 @@ examples:
195
195
  public_updated_at: 2017-07-19 15:01:48
196
196
  document_type: 'Statistical data set'
197
197
  subtext: 'First published during the 1996 Conservative Government'
198
+ without_top_border_on_list_element:
199
+ description: Several interfaces across GOV.UK benefit from the semantics of the document list but have their own bespoke designs, sometimes meaning that the visual border element doesn't gel with said interface. Removing it using the below attribute allows for cleaner visual fidelity in this instances.
200
+ data:
201
+ remove_top_border: true
202
+ items:
203
+ - link:
204
+ text: 'Department for Education – Statistics at DfE'
205
+ path: '/government/organisations/department-for-education/about/statistics'
206
+ metadata:
207
+ public_updated_at: 2017-07-19 15:01:48
208
+ document_type: 'Corporate information'
209
+ - link:
210
+ text: 'State-funded school inspections and outcomes: management information'
211
+ path: '/government/organisations/department-for-education/about/statistics'
212
+ metadata:
213
+ public_updated_at: 2017-07-19 15:01:48
214
+ document_type: 'Statistical data set'
198
215
  highlighted_result:
199
216
  description: Highlight one or more of the items in the list. This is used on finders to provide a 'top result' for a search. The `highlight_text` parameter is optional.
200
217
  data:
@@ -280,3 +297,29 @@ examples:
280
297
  document_type: 'Data tryloywder'
281
298
  locale:
282
299
  document_type: 'cy'
300
+ with_full_size_description_text:
301
+ data:
302
+ items:
303
+ - link:
304
+ text: 'Become an apprentice'
305
+ path: '/become-an-apprentice'
306
+ description: 'Becoming an apprentice - what to expect, apprenticeship levels, pay and training, making an application, complaining about an apprenticeship.'
307
+ full_size_description: true
308
+ with_rel_link_attribute:
309
+ description: |
310
+ The [rel attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel) is an option attribute to dictate the relationship between the document being linked to and the current page. This is predominantly used by search engines to help index journeys through a website.
311
+
312
+ On GOV.UK, this is typically used to dictate an external website being linked to with `rel="external"`, however this component supports:
313
+
314
+ - external
315
+ - nofollow
316
+ - noopener
317
+ - noreferrer
318
+ - opener
319
+ data:
320
+ items:
321
+ - link:
322
+ text: 'Report Fraud'
323
+ path: 'https://www.actionfraud.police.uk/contact-us'
324
+ rel: 'external'
325
+ description: "Contact Action Fraud to report fraud and cyber crime, or to tell them you've been the victim of a scam."
@@ -312,8 +312,8 @@ examples:
312
312
  block: |
313
313
  <div class="contact" id="contact_1017">
314
314
  <div class="content">
315
- <h3>Media enquiries</h3>
316
315
  <div class="vcard contact-inner">
316
+ <p>Media enquiries</p>
317
317
  <p class="adr">
318
318
  <span class="street-address">2 Marsham Street<br>London</span><br>
319
319
  <span class="postal-code">SW1P 4DF</span>
@@ -332,8 +332,8 @@ examples:
332
332
  <h2>This is a title</h2>
333
333
  <div class="contact" id="contact_1018">
334
334
  <div class="content">
335
- <h3>Media enquiries</h3>
336
335
  <div class="vcard contact-inner">
336
+ <p>Media enquiries</p>
337
337
  <p class="adr">
338
338
  <span class="street-address">2 Marsham Street<br>London</span><br>
339
339
  <span class="postal-code">SW1P 4DF</span>
@@ -349,8 +349,8 @@ examples:
349
349
  <p>This is a paragraph.</p>
350
350
  <div class="contact" id="contact_1019">
351
351
  <div class="content">
352
- <h3>Media enquiries</h3>
353
352
  <div class="vcard contact-inner">
353
+ <p>Media enquiries</p>
354
354
  <p class="adr">
355
355
  <span class="street-address">2 Marsham Street<br>London</span><br>
356
356
  <span class="postal-code">SW1P 4DF</span>
@@ -81,6 +81,17 @@ examples:
81
81
  - text: News and communications
82
82
  href: "item-6"
83
83
  active: true
84
+ with_navigation_link_data_attributes:
85
+ description: Supports adding data attributes i.e for tracking
86
+ data:
87
+ navigation_items:
88
+ - text: Departments
89
+ href: "item-1"
90
+ data:
91
+ module: "a custom attribute"
92
+ something_else: "some other custom attribute"
93
+ - text: Worldwide
94
+ href: "item-2"
84
95
  full_width:
85
96
  description: |
86
97
  This is difficult to preview because the preview windows are constrained, but the header will stretch to the size of its container.
@@ -1,5 +1,5 @@
1
1
  <div class="govuk-header__logo gem-c-header__logo">
2
- <a href="/" class="govuk-header__link govuk-header__link--homepage" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
2
+ <a href="/" 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
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">
5
5
  <path fill="currentColor" fill-rule="evenodd"
@@ -1,16 +1,21 @@
1
1
  <% if navigation_items.any? %>
2
2
  <button role="button" class="govuk-header__menu-button gem-c-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide Top Level Navigation">Menu</button>
3
- <%= tag.nav(class: "gem-c-header__nav", 'aria-label': navigation_aria_label ? navigation_aria_label : nil ) do %>
3
+ <%= tag.nav class: "gem-c-header__nav", aria: { label: navigation_aria_label } do %>
4
4
  <ul id="navigation" class="govuk-header__navigation govuk-header__navigation--end">
5
5
  <% navigation_items.each_with_index do |item, index| %>
6
- <li class="govuk-header__navigation-item <%= "govuk-header__navigation-item--active" if item[:active] %>
7
- <%= "govuk-header__navigation-item--collapsed-menu-only" if item[:show_only_in_collapsed_menu] %>">
6
+ <%
7
+ li_classes = %w(govuk-header__navigation-item)
8
+ li_classes << "govuk-header__navigation-item--active" if item[:active]
9
+ li_classes << "govuk-header__navigation-item--collapsed-menu-only" if item[:show_only_in_collapsed_menu]
10
+ %>
11
+ <%= tag.li class: li_classes do %>
8
12
  <%= link_to(
9
13
  item[:text],
10
14
  item[:href],
11
15
  class: 'govuk-header__link',
16
+ data: item[:data],
12
17
  ) %>
13
- </li>
18
+ <% end %>
14
19
  <% end %>
15
20
  </ul>
16
21
  <% end %>
@@ -25,8 +25,10 @@ Rails.application.config.assets.precompile += %w[
25
25
  govuk_publishing_components/search-button.png
26
26
  govuk_publishing_components/icon-file-download.svg
27
27
  govuk_publishing_components/icon-important.svg
28
- govuk_publishing_components/chevron-banner/*.svg
29
28
  govuk_publishing_components/crests/*.png
29
+ govuk_publishing_components/take-action-amber.svg
30
+ govuk_publishing_components/take-action-green.svg
31
+ govuk_publishing_components/take-action-red.svg
30
32
  ]
31
33
 
32
34
  # GOV.UK Frontend assets
@@ -12,4 +12,9 @@ cy:
12
12
  transition:
13
13
  title: "Brexit"
14
14
  link_path: "/transition.cy"
15
- link_text: "Darganfyddwch sut mae’r rheolau Brexit newydd yn effeithio arnoch chi"
15
+ link_text: "Gwiriwch beth sydd angen i chi ei wneud"
16
+ take_action_list:
17
+ red: Gwiriwch
18
+ amber: Newidiwch
19
+ green: Ewch
20
+ aria_label: Ymgyrch slogan Brexit, Gwiriwch, Newidiwch, Ewch.
@@ -79,7 +79,12 @@ en:
79
79
  transition:
80
80
  title: "Brexit"
81
81
  link_path: "/transition"
82
- link_text: "Check how the new Brexit rules affect you"
82
+ link_text: "Check what you need to do"
83
+ take_action_list:
84
+ red: Check
85
+ amber: Change
86
+ green: Go
87
+ aria_label: Brexit campaign slogan, Check, Change, Go.
83
88
  related_footer_navigation:
84
89
  collections: "Collections"
85
90
  policies: "Policies"
@@ -113,8 +113,189 @@ module GovukPublishingComponents
113
113
  tagged_to_brexit? && (page_content_id != brexit_start_page_content_id)
114
114
  end
115
115
 
116
- def transition_countdown_exception?
117
- content_item["content_id"] == "c3752802-f091-43a9-ba90-33568fccf391"
116
+ def brexit_cta_document_exceptions
117
+ # /government/news/30-creative-teams-awarded-up-to-100000-each-for-festival-uk-2022-rd-project
118
+ # and answer pages that have a start button (tracked in https://docs.google.com/spreadsheets/d/1ynH8zIjvElvK-u8JLI8KOYylxTbzJsoXRqEnqrnqv_4/edit)
119
+ %w[
120
+ c3752802-f091-43a9-ba90-33568fccf391
121
+ e1a9ce2b-4085-4761-b70f-d125a6571de3
122
+ 6a2bf66e-2313-4204-afd5-9940de5e1d66
123
+ f65b0ac7-b8cd-476b-bd5d-738268517659
124
+ 45ad868a-2e79-4029-991b-c29559d7eb29
125
+ e4e9c4ec-385e-4758-93ac-388bc154815e
126
+ cee73f76-83f0-44e2-b657-3b51a9cbc76e
127
+ 9a945506-60bc-44d8-a2ec-0eb2824732d6
128
+ 6ae16c12-a554-44e2-b3e3-596375aa1b9a
129
+ 9add4ccc-dc4c-44cf-9b69-6878c162d431
130
+ 4f5cf1cd-efda-4c49-8292-1db1c6c3cfb0
131
+ 73058592-dedf-4379-9a1d-d8222a796c0a
132
+ c9259172-5432-43a6-b710-409d463c7627
133
+ 59ecfc6d-cb9e-49b8-b013-fc368ebdf8ed
134
+ 9897695d-624b-4cb9-b873-f3113f0332a1
135
+ 715f4659-b058-46ec-84c8-cc346c210778
136
+ c63890f9-2356-4be3-9e07-6cf4b8de7081
137
+ e7661ec8-b678-444e-b4d0-a221fa83a7f7
138
+ 723f9c0a-bcdb-4d8f-952c-6df0ed468c57
139
+ a1c420b7-11d7-4b9c-a97e-406fb73c0200
140
+ c1347936-839b-4547-a570-0c315c34ee45
141
+ 1396f68b-6ffa-47ef-a049-414e7b548e81
142
+ 3b054acf-d0af-470e-b912-9481204d1a9a
143
+ 317b9c08-928b-4fd2-bc8e-4c6acf287c58
144
+ 44d6cb7a-d853-4cd8-a9cb-69eff0299d9e
145
+ 15517245-f142-4e45-ad84-773250f7d5a2
146
+ 6fe6644d-d037-4ea4-baf6-800dc1966ed0
147
+ 4a63625c-a195-4b86-9562-cb6653dd26ff
148
+ 47521233-20a8-4d02-ba31-6e1977448fd1
149
+ 7b8ca4ac-f3a3-41b8-9555-9e244c36575b
150
+ be1a82d1-e53c-431a-9e7a-337ed4b2654f
151
+ 6c445001-4e29-4853-8c14-444d7f9374ee
152
+ c8cf2a7c-5c13-4f3d-b1ff-6a7eb5533973
153
+ 2422a237-f8f1-4e9f-ad51-f1d44fde9755
154
+ ae000c08-c74f-467b-b8a4-90f138252a5c
155
+ 7eec7800-9c4d-4160-af53-57b5d3e02972
156
+ eb545b3b-111b-4c3c-890c-c9ec29b9090d
157
+ 8d705ade-8977-480d-9080-72a19e341c2a
158
+ 2a0dd317-0252-4c7c-8c13-b43af28406bc
159
+ f27e5792-a84b-4164-9890-7e86767634e8
160
+ b0b9a600-1fe6-4257-9e68-2be0f59ea25d
161
+ 28fa04ea-42e1-46ad-9abc-acf132c5666d
162
+ 64b27b8a-ae53-4034-a812-f4805cd7e3ad
163
+ 1dd5a75f-18b4-419d-b2b6-6d4808f2c7e4
164
+ b21b9e34-455c-4305-b4cc-4e6b8d3f7522
165
+ 0ab53a0d-b098-43a8-b3cc-8b3224697228
166
+ e3862156-ba5a-41ba-8ee6-22e5cd6a6144
167
+ 2e8f7fae-7164-459c-898b-0c0538eee3e0
168
+ 6087439c-26d2-4881-b345-5160e23f3b5e
169
+ cac78a0a-9c28-436a-a29e-8ccbe8fbc956
170
+ c2fd13a5-537b-4368-ac2e-6078b2c463f1
171
+ 98f0a21d-7b67-4089-a98c-f0a0177291a2
172
+ 06692612-8c39-464c-8aee-2aa62e6c8887
173
+ df943977-69cb-479d-a921-9410d603c471
174
+ 2656eb6b-f2eb-4982-8a90-e40d03a34a4d
175
+ 4ca8698b-4a24-45ff-baea-7633cc24b679
176
+ ed73581f-9bf8-48b5-bb66-935581a255e3
177
+ 15f1c594-af1d-4f16-97cc-ad4d12017509
178
+ ]
179
+ end
180
+
181
+ def brexit_cta_document_exception?
182
+ brexit_cta_document_exceptions.include?(content_item["content_id"])
183
+ end
184
+
185
+ def brexit_cta_document_type_exceptions
186
+ %w[
187
+ aaib_report
188
+ asylum_support_decision
189
+ fatality_notice
190
+ maib_report
191
+ raib_report
192
+ simple_smart_answer
193
+ transaction
194
+ ]
195
+ end
196
+
197
+ def brexit_cta_document_type_exception?
198
+ brexit_cta_document_type_exceptions.include?(content_item["document_type"])
199
+ end
200
+
201
+ def brexit_cta_taxon_allow_list
202
+ # Entering and staying in the UK
203
+ # Going and being abroad
204
+ # Corporate information
205
+ # Transport
206
+ # Environment
207
+ # International
208
+ # Defence and armed forces
209
+ # Society and culture
210
+ # Government
211
+ # Work
212
+ # Welfare
213
+ # Money
214
+ # Business and industry
215
+ # Health and social care
216
+ # Education > Further and higher education
217
+ # Education > Teaching and leadership
218
+ # Education > Funding and finance for students
219
+ # Coronavirus (COVID-19)
220
+ %w[
221
+ ba3a9702-da22-487f-86c1-8334a730e559
222
+ 9597c30a-605a-4e36-8bc1-47e5cdae41b3
223
+ a544d48b-1e9e-47fb-b427-7a987c658c14
224
+ a4038b29-b332-4f13-98b1-1c9709e216bc
225
+ 3cf97f69-84de-41ae-bc7b-7e2cc238fa58
226
+ 37d0fa26-abed-4c74-8835-b3b51ae1c8b2
227
+ e491505c-77ae-45b2-84be-8c94b94f6a2b
228
+ e2ca2f1a-0ff3-43ce-b813-16645ff27904
229
+ e48ab80a-de80-4e83-bf59-26316856a5f9
230
+ d0f1e5a3-c8f4-4780-8678-994f19104b21
231
+ dded88e2-f92e-424f-b73e-6ad24a839c51
232
+ 6acc9db4-780e-4a46-92b4-1812e3c2c48a
233
+ 495afdb6-47be-4df1-8b38-91c8adb1eefc
234
+ 8124ead8-8ebc-4faf-88ad-dd5cbcc92ba8
235
+ dd767840-363e-43ad-8835-c9ab516633de
236
+ ff00b8b2-dcdb-4659-93c2-291c9be354f3
237
+ 23265b25-7ec3-4960-8517-4ff8d4d92cac
238
+ 5b7b9532-a775-4bd2-a3aa-6ce380184b6c
239
+ ]
240
+ end
241
+
242
+ def brexit_cta_taxon_allow_list?
243
+ taxons = content_item.dig("links", "taxons").to_a
244
+ taxons.each do |taxon|
245
+ if brexit_cta_taxon_allow_list.include?(taxon["content_id"]) || parent_taxon_include?(taxon, brexit_cta_taxon_allow_list)
246
+ return true
247
+ end
248
+ end
249
+ false
250
+ end
251
+
252
+ def parent_taxon_include?(taxon, taxon_list)
253
+ if taxon.present?
254
+ if taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| taxon_list.include?(taxon_item["content_id"]) }
255
+ return true
256
+ end
257
+
258
+ taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| parent_taxon_include?(taxon_item, taxon_list) }
259
+ else
260
+ false
261
+ end
262
+ end
263
+
264
+ def brexit_cta_taxon_exception_list
265
+ # Entering and staying in the UK > Immigration offences
266
+ # Entering and staying in the UK > Inspections of border, immigration and asylum services
267
+ # Entering and staying in the UK > Refugees, asylum and human rights
268
+ # Transport > Local transport
269
+ # Education > Further and higher education > Education in prisons
270
+ %w[
271
+ fa13521f-9285-45b0-bd65-4a472a8037e7
272
+ 0fab9131-f877-4286-b4d8-922fbfb402b6
273
+ 08a8a69f-2825-4fe2-a4cf-c83458a5629e
274
+ 3b4d6319-fcef-4637-b35a-e3df76321894
275
+ 6426d1c5-93c8-4659-85d5-1f0d3368a124
276
+ ]
277
+ end
278
+
279
+ def brexit_cta_taxon_exception_list?
280
+ taxons = content_item.dig("links", "taxons").to_a
281
+ taxons.each do |taxon|
282
+ if brexit_cta_taxon_exception_list.include?(taxon["content_id"]) || parent_taxon_include?(taxon, brexit_cta_taxon_exception_list)
283
+ return true
284
+ end
285
+ end
286
+ false
287
+ end
288
+
289
+ def brexit_cta_exception?
290
+ brexit_cta_document_exception? ||
291
+ brexit_cta_document_type_exception? ||
292
+ brexit_cta_taxon_exception_list?
293
+ end
294
+
295
+ def show_brexit_cta?
296
+ brexit_cta_taxon_allow_list? &&
297
+ step_by_step_count.zero? &&
298
+ !brexit_cta_exception?
118
299
  end
119
300
 
120
301
  def step_by_step_count