govuk_publishing_components 21.59.0 → 21.61.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -6
  3. data/app/assets/javascripts/component_guide/accessibility-test.js +21 -21
  4. data/app/assets/javascripts/component_guide/filter-components.js +19 -19
  5. data/app/assets/javascripts/component_guide/visual-regression.js +38 -37
  6. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +102 -73
  7. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +4 -4
  8. data/app/assets/javascripts/govuk_publishing_components/ie.js +2 -0
  9. data/app/assets/javascripts/govuk_publishing_components/lib/auto-track-event.js +31 -0
  10. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +24 -24
  11. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +17 -17
  12. data/app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js +4 -0
  13. data/app/assets/javascripts/govuk_publishing_components/vendor/json2.js +487 -0
  14. data/app/assets/stylesheets/component_guide/application.scss +19 -15
  15. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +0 -8
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -1
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +4 -0
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +1 -8
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +0 -1
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +4 -5
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +3 -8
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +1 -1
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +1 -1
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +5 -8
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +8 -0
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +4 -0
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +87 -1
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +4 -0
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -2
  31. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +46 -1
  32. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +0 -5
  33. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +1 -4
  34. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +8 -12
  35. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +21 -24
  36. data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +4 -8
  37. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +2 -0
  38. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -4
  39. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +6 -6
  40. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +2 -0
  41. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +2 -0
  42. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -0
  43. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +1 -1
  44. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +2 -0
  45. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -1
  46. data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +2 -0
  47. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +0 -4
  48. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss +2 -10
  49. data/app/controllers/govuk_publishing_components/audit_controller.rb +2 -2
  50. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +2 -2
  51. data/app/models/govuk_publishing_components/audit_applications.rb +45 -27
  52. data/app/models/govuk_publishing_components/audit_comparer.rb +77 -51
  53. data/app/models/govuk_publishing_components/audit_components.rb +25 -6
  54. data/app/models/govuk_publishing_components/component_example.rb +4 -0
  55. data/app/views/govuk_publishing_components/audit/show.html.erb +227 -190
  56. data/app/views/govuk_publishing_components/component_guide/component_doc/_component.html.erb +1 -0
  57. data/app/views/govuk_publishing_components/component_guide/index.html.erb +3 -1
  58. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  59. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -1
  60. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +32 -21
  61. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +76 -0
  62. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +39 -51
  63. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
  64. data/app/views/govuk_publishing_components/components/_radio.html.erb +13 -5
  65. data/app/views/govuk_publishing_components/components/_search.html.erb +10 -5
  66. data/app/views/govuk_publishing_components/components/_share_links.html.erb +9 -9
  67. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +2 -2
  68. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +4 -0
  69. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +45 -0
  70. data/app/views/govuk_publishing_components/components/docs/heading.yml +6 -3
  71. data/app/views/govuk_publishing_components/components/docs/image_card.yml +13 -1
  72. data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +17 -0
  73. data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +5 -1
  74. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +29 -0
  75. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +34 -0
  76. data/app/views/govuk_publishing_components/components/docs/radio.yml +4 -0
  77. data/app/views/govuk_publishing_components/components/docs/search.yml +6 -0
  78. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +23 -0
  79. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +17 -0
  80. data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +9 -0
  81. data/config/initializers/assets.rb +8 -0
  82. data/lib/govuk_publishing_components.rb +1 -0
  83. data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +15 -7
  84. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +1 -0
  85. data/lib/govuk_publishing_components/presenters/heading_helper.rb +21 -1
  86. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +3 -2
  87. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +380 -0
  88. data/lib/govuk_publishing_components/version.rb +1 -1
  89. data/node_modules/axe-core/package.json +145 -220
  90. data/node_modules/govuk-frontend/govuk/all.js +160 -57
  91. data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +0 -4
  92. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +16 -8
  93. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +6 -0
  94. data/node_modules/govuk-frontend/govuk/components/character-count/template.njk +1 -0
  95. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -5
  96. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +68 -21
  97. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  98. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +0 -27
  99. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -3
  100. data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
  101. data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
  102. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +2 -2
  103. data/node_modules/govuk-frontend/govuk/components/hint/template.njk +2 -2
  104. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +0 -3
  105. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +6 -0
  106. data/node_modules/govuk-frontend/govuk/components/input/template.njk +1 -0
  107. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +76 -28
  108. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +0 -3
  109. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -0
  110. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +0 -3
  111. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +6 -0
  112. data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +1 -0
  113. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +4 -2
  114. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +1 -1
  115. data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +2 -2
  116. data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +33 -33
  117. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +4 -1
  118. data/node_modules/govuk-frontend/package.json +14 -81
  119. data/node_modules/jquery/package.json +44 -116
  120. metadata +34 -66
  121. data/Rakefile +0 -37
@@ -24,10 +24,13 @@ examples:
24
24
  text: 'Original consultation'
25
25
  heading_level: 3
26
26
  different_font_sizes:
27
- description: Choose a different font size. Valid options are 24 (24px) and 19 (19px), with the component defaulting to 27px, appropriate for a H1. This option is not tied to the heading_level option in order to give flexibility.
27
+ description: |
28
+ Set a different font size for the heading. Uses the [GOV.UK Frontend heading sizes](https://design-system.service.gov.uk/styles/typography/#headings) but defaults to 27px for legacy reasons. Valid options are `xl`, `l`, `m` and `s`.
29
+
30
+ This option is not tied to the heading_level option in order to give flexibility.
28
31
  data:
29
- text: 'Heading 3'
30
- font_size: 19
32
+ text: 'One big heading'
33
+ font_size: "xl"
31
34
  with_id_attribute:
32
35
  data:
33
36
  text: 'Detail of outcome'
@@ -9,6 +9,7 @@ accessibility_criteria: |
9
9
 
10
10
  - include alt text for images when present
11
11
  - not have duplicate links for the image and the text
12
+ - if the contents of the component are in a different language than the rest of the document, include an appropriate `lang` attribute to correctly identify the language used in the component
12
13
  shared_accessibility_criteria:
13
14
  - link
14
15
  examples:
@@ -191,7 +192,7 @@ examples:
191
192
  description: Can be used for links to people pages to indicate payment type
192
193
  data:
193
194
  href: "/government/people/"
194
- image_src: "http://placekitten.com/215/140"
195
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
195
196
  image_alt: "some meaningful alt text please"
196
197
  context:
197
198
  text: "The Rt Hon"
@@ -204,3 +205,14 @@ examples:
204
205
  }
205
206
  ]
206
207
  extra_links_no_indent: true
208
+ with_lang:
209
+ description: |
210
+ Pass through an appropriate `lang` to set a HTML lang attribute for the component.
211
+
212
+ The `lang` attribute **must** be set to a [valid BCP47 string](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#Language_tag_syntax). A valid code can be the two or three letter language code - for example, English is `en` or `eng`, Korean is `ko` or `kor` - but if in doubt please check.
213
+ data:
214
+ href: "/not-a-page"
215
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
216
+ image_alt: "some meaningful alt text please"
217
+ heading_text: Yr hyn rydym ni'n ei wneud
218
+ lang: cy
@@ -139,3 +139,20 @@ examples:
139
139
  attributes:
140
140
  lang: en
141
141
  hreflang: en
142
+ with_border:
143
+ data:
144
+ with_border: true
145
+ meta:
146
+ items:
147
+ - href: '/help'
148
+ text: Help
149
+ - href: '/help/cookies'
150
+ text: Cookies
151
+ - href: '/contact'
152
+ text: Contact
153
+ - href: '/help/terms-conditions'
154
+ text: Terms and conditions
155
+ - href: '/cymraeg'
156
+ text: Rhestr o Wasanaethau Cymraeg
157
+ - href: '/government/organisations/government-digital-service'
158
+ text: Government Digital Service
@@ -10,7 +10,11 @@ body: |
10
10
  display_preview: false
11
11
  display_html: true
12
12
  accessibility_criteria: |
13
- TBD
13
+ The layout template must:
14
+
15
+ * have a `lang` attribute
16
+ * contain a [skip link](/component-guide/skip_link)
17
+ * have a sensible page `<title>`
14
18
  examples:
15
19
  default:
16
20
  data:
@@ -0,0 +1,29 @@
1
+ name: Public layout
2
+ description: A layout to be used by public-facing applications
3
+ body: |
4
+ Because it is an entire HTML document, this component can only be [previewed on a separate page](/public).
5
+
6
+ display_preview: false
7
+ display_html: true
8
+ accessibility_criteria: |
9
+ The layout template must:
10
+
11
+ * have a `lang` attribute
12
+ * contain a [skip link](/component-guide/skip_link)
13
+ * have a sensible page `<title>`
14
+ examples:
15
+ default:
16
+ data:
17
+ title: 'Example layout'
18
+ block: |
19
+ <h1>Page content goes here</h1>
20
+ full_width:
21
+ description: By default, the layout applies the `govuk-width-container` class to the main element. We can remove this class by setting `full_width` to `true`
22
+ data:
23
+ full_width: true
24
+ block: |
25
+ <h1>Page content goes here</h1>
26
+ omit_header:
27
+ description: This allows the header to be omitted which is currently used when rendering CSV previews from Whitehall
28
+ data:
29
+ omit_header: true
@@ -7,6 +7,10 @@ govuk_frontend_components:
7
7
  - header
8
8
  accessibility_excluded_rules:
9
9
  - landmark-banner-is-top-level # The header element can not be top level in the examples
10
+ - duplicate-id-aria # IDs will be duplicated in component examples list
11
+ - form-field-multiple-labels # Form labels will be ambiguous in component examples list
12
+ - landmark-no-duplicate-banner # banners will be duplicated in component examples list
13
+ - landmark-unique # aria-label attributes will be duplicated in component examples list
10
14
  examples:
11
15
  default:
12
16
  data:
@@ -36,12 +40,42 @@ examples:
36
40
  - text: Hidden on desktop
37
41
  href: "item-3"
38
42
  show_only_in_collapsed_menu: true
43
+ with_left_search_and_navigation:
44
+ description: This supports pages where the search appears on the left with multiple navigation links on the right, such as the [How government works](https://www.gov.uk/government/how-government-works) page
45
+ data:
46
+ search_left: true
47
+ environment: public
48
+ navigation_items:
49
+ - text: Departments
50
+ href: "item-1"
51
+ - text: Worldwide
52
+ href: "item-2"
53
+ - text: How government works
54
+ href: "item-3"
55
+ - text: Get involved
56
+ href: "item-4"
57
+ - text: Consultations
58
+ href: "item-4"
59
+ - text: Statistics
60
+ href: "item-5"
61
+ - text: News and communications
62
+ href: "item-6"
63
+ active: true
39
64
  full_width:
40
65
  description: |
41
66
  This is difficult to preview because the preview windows are constrained, but the header will stretch to the size of its container.
42
67
  data:
43
68
  environment: production
44
69
  full_width: true
70
+ no_bottom_border:
71
+ description: This is useful for pages where a large full-width banner is the first thing to appear on the page, for example, the [GOV.UK homepage](https://www.gov.uk)
72
+ data:
73
+ remove_bottom_border: true
74
+ environment: 'public'
75
+ with_search_bar:
76
+ data:
77
+ environment: 'public'
78
+ search: true
45
79
 
46
80
  accessibility_criteria: |
47
81
  The component must:
@@ -183,6 +183,10 @@ examples:
183
183
  - value: "blue"
184
184
  text: "Blue"
185
185
  with_custom_heading_size:
186
+ description: |
187
+ This allows the size of the legend to be changed. Valid options are s, m, l, xl, defaulting to m if no option is passed.
188
+
189
+ If the is_page_heading option is true and heading_size is not set, the text size will be xl.
186
190
  data:
187
191
  name: "radio-group-description"
188
192
  heading: "What is your favourite colour?"
@@ -24,6 +24,12 @@ examples:
24
24
  stop_the_label_appearing_inline:
25
25
  data:
26
26
  inline_label: false
27
+ no_border:
28
+ description: Sometimes we don't need the grey border surrounding the input field, such as when the component is used on a black background
29
+ data:
30
+ no_border: true
31
+ context:
32
+ black_background: true
27
33
  for_use_on_govuk_blue_background:
28
34
  data:
29
35
  on_govuk_blue: true
@@ -0,0 +1,23 @@
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">
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">
5
+ <path fill="currentColor" fill-rule="evenodd"
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.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.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
+ <%# 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>
9
+ </svg>
10
+ <span class="govuk-header__logotype-text">
11
+ GOV.UK
12
+ </span>
13
+ </span>
14
+ <% unless public_environment %>
15
+ <span class="govuk-header__product-name gem-c-header__product-name">
16
+ <%= product_name %>
17
+ </span>
18
+ <span class="gem-c-environment-tag govuk-tag gem-c-environment-tag--<%= environment %>">
19
+ <%= environment %>
20
+ </span>
21
+ <% end %>
22
+ </a>
23
+ </div>
@@ -0,0 +1,17 @@
1
+ <% if navigation_items.any? %>
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
+ <nav class="gem-c-header__nav">
4
+ <ul id="navigation" class="govuk-header__navigation govuk-header__navigation--end" aria-label="Top Level Navigation">
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] %>">
8
+ <%= link_to(
9
+ item[:text],
10
+ item[:href],
11
+ class: 'govuk-header__link',
12
+ ) %>
13
+ </li>
14
+ <% end %>
15
+ </ul>
16
+ </nav>
17
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <a href="#search" class="search-toggle js-header-toggle">Search</a>
2
+ <form id="search" class="gem-c-layout-header__search-form govuk-clearfix" action="/search" method="get" role="search">
3
+ <%= render "govuk_publishing_components/components/search", {
4
+ id: "site-search-text",
5
+ label_text: "Search",
6
+ no_border: true,
7
+ margin_bottom: 0
8
+ } %>
9
+ </form>
@@ -8,6 +8,7 @@ Rails.application.config.assets.precompile += %w[
8
8
  component_guide/visual-regression.js
9
9
  component_guide/print.css
10
10
  govuk_publishing_components/all_components.js
11
+ govuk_publishing_components/ie.js
11
12
  govuk_publishing_components/modules.js
12
13
  govuk_publishing_components/vendor/modernizr.js
13
14
  govuk_publishing_components/component_guide.css
@@ -30,6 +31,13 @@ Rails.application.config.assets.precompile += %w[
30
31
  # GOV.UK Frontend assets
31
32
  Rails.application.config.assets.precompile += %w[
32
33
  govuk-logotype-crown.png
34
+ favicon.ico
35
+ govuk-opengraph-image.png
36
+ govuk-mask-icon.svg
37
+ govuk-apple-touch-icon-180x180.png
38
+ govuk-apple-touch-icon-167x167.png
39
+ govuk-apple-touch-icon-152x152.png
40
+ govuk-apple-touch-icon.png
33
41
  ]
34
42
 
35
43
  Rails.application.config.assets.paths += %W[
@@ -12,6 +12,7 @@ require "govuk_publishing_components/presenters/contextual_navigation"
12
12
  require "govuk_publishing_components/presenters/related_navigation_helper"
13
13
  require "govuk_publishing_components/presenters/step_by_step_nav_helper"
14
14
  require "govuk_publishing_components/presenters/page_with_step_by_step_navigation"
15
+ require "govuk_publishing_components/presenters/public_layout_helper"
15
16
  require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_ancestors"
16
17
  require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority"
17
18
  require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons"
@@ -14,7 +14,6 @@ module GovukPublishingComponents
14
14
  :id,
15
15
  :hint_text,
16
16
  :description,
17
- :heading_size,
18
17
  :heading_caption,
19
18
  :has_exclusive
20
19
 
@@ -35,9 +34,8 @@ module GovukPublishingComponents
35
34
 
36
35
  @id = options[:id] || "checkboxes-#{SecureRandom.hex(4)}"
37
36
  @heading = options[:heading] || nil
38
- @heading_size = options[:heading_size]
39
- @heading_size = "m" unless %w[s m l xl].include?(@heading_size)
40
37
  @heading_caption = options[:heading_caption] || nil
38
+ @heading_size = options[:heading_size] || nil
41
39
  @is_page_heading = options[:is_page_heading]
42
40
  @description = options[:description] || nil
43
41
  @no_hint_text = options[:no_hint_text]
@@ -60,20 +58,30 @@ module GovukPublishingComponents
60
58
  end
61
59
  end
62
60
 
61
+ def size
62
+ if %w[s m l xl].include?(@heading_size)
63
+ @heading_size
64
+ elsif @is_page_heading
65
+ "xl"
66
+ else
67
+ "m"
68
+ end
69
+ end
70
+
63
71
  def heading_markup
64
72
  return unless @heading.present?
65
73
 
66
74
  if @is_page_heading
67
75
  content_tag(
68
76
  :legend,
69
- class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title",
77
+ class: "govuk-fieldset__legend govuk-fieldset__legend--#{size}",
70
78
  ) do
71
- concat content_tag(:span, heading_caption, class: "govuk-caption-xl") if heading_caption.present?
72
- concat content_tag(:h1, @heading, class: "gem-c-title__text")
79
+ concat content_tag(:span, heading_caption, class: "govuk-caption-#{size}") if heading_caption.present?
80
+ concat content_tag(:h1, @heading, class: "gem-c-checkboxes__heading-text govuk-fieldset__heading")
73
81
  end
74
82
  else
75
83
  classes = %w[govuk-fieldset__legend]
76
- classes << "govuk-fieldset__legend--#{@heading_size}"
84
+ classes << "govuk-fieldset__legend--#{size}"
77
85
  classes << "gem-c-checkboxes__legend--hidden" if @visually_hide_heading
78
86
 
79
87
  content_tag(:legend, @heading, class: classes)
@@ -8,6 +8,7 @@ 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
12
  }.freeze
12
13
 
13
14
  # Returns the highest priority taxon that has a content_id matching those in PRIORITY_TAXONS
@@ -7,12 +7,32 @@ module GovukPublishingComponents
7
7
  @id = options[:id]
8
8
 
9
9
  @classes = ""
10
- @classes << " gem-c-heading--font-size-#{options[:font_size]}" if [24, 19].include? options[:font_size]
10
+ @classes << heading_size(options[:font_size])
11
11
  @classes << " gem-c-heading--mobile-top-margin" if options[:mobile_top_margin]
12
12
  @classes << " gem-c-heading--padding" if options[:padding]
13
13
  @classes << " gem-c-heading--border-top-#{options[:border_top]}" if [1, 2, 5].include? options[:border_top]
14
14
  @classes << " gem-c-heading--inverse" if options[:inverse]
15
15
  end
16
+
17
+ private
18
+
19
+ def heading_size(option)
20
+ gem_class = "gem-c-heading--font-size-"
21
+ govuk_class = "govuk-heading-"
22
+
23
+ case option
24
+ when "xl"
25
+ "#{govuk_class}xl"
26
+ when "l"
27
+ "#{govuk_class}l"
28
+ when 24, "m"
29
+ "#{govuk_class}m"
30
+ when 19, "s"
31
+ "#{govuk_class}s"
32
+ else
33
+ "#{gem_class}27"
34
+ end
35
+ end
16
36
  end
17
37
  end
18
38
  end
@@ -4,7 +4,7 @@ module GovukPublishingComponents
4
4
  include ActionView::Helpers
5
5
  include ActionView::Context
6
6
 
7
- attr_reader :href, :href_data_attributes, :extra_links, :large, :extra_links_no_indent, :heading_text, :metadata
7
+ attr_reader :href, :href_data_attributes, :extra_links, :large, :extra_links_no_indent, :heading_text, :metadata, :lang
8
8
 
9
9
  def initialize(local_assigns)
10
10
  @href = local_assigns[:href]
@@ -18,6 +18,7 @@ module GovukPublishingComponents
18
18
  @heading_text = local_assigns[:heading_text]
19
19
  @extra_links_no_indent = local_assigns[:extra_links_no_indent]
20
20
  @metadata = local_assigns[:metadata]
21
+ @lang = local_assigns[:lang]
21
22
  end
22
23
 
23
24
  def is_tracking?
@@ -44,7 +45,7 @@ module GovukPublishingComponents
44
45
 
45
46
  content_tag(:p, class: "gem-c-image-card__context") do
46
47
  if @context[:date]
47
- date = content_tag(:time, l(@context[:date], format: "%e %B %Y"), datetime: @context[:date].iso8601)
48
+ date = content_tag(:time, l(@context[:date], format: "%e %B %Y"), datetime: @context[:date].iso8601, lang: "en")
48
49
  dash = content_tag(:span, " — ", 'aria-hidden': true)
49
50
 
50
51
  if @context[:text]
@@ -0,0 +1,380 @@
1
+ module GovukPublishingComponents
2
+ module Presenters
3
+ class PublicLayoutHelper
4
+ FOOTER_NAV = [
5
+ {
6
+ title: "Prepare for Brexit",
7
+ columns: 2,
8
+ items: [
9
+ {
10
+ href: "/business-uk-leaving-eu",
11
+ text: "Prepare your business or organisation for Brexit",
12
+ attributes: {
13
+ data: {
14
+ track_category: "footerClicked",
15
+ track_action: "brexitLinks",
16
+ track_label: "Prepare your business or organisation for the UK leaving the EU",
17
+ },
18
+ },
19
+ },
20
+ {
21
+ href: "/prepare-eu-exit",
22
+ text: "Prepare for Brexit if you live in the UK",
23
+ attributes: {
24
+ data: {
25
+ track_category: "footerClicked",
26
+ track_action: "brexitLinks",
27
+ track_label: "Prepare for Brexit if you live in the UK",
28
+ },
29
+ },
30
+ },
31
+ {
32
+ href: "/uk-nationals-living-eu",
33
+ text: "Living in Europe after Brexit",
34
+ attributes: {
35
+ data: {
36
+ track_category: "footerClicked",
37
+ track_action: "brexitLinks",
38
+ track_label: "Living in Europe after Brexit",
39
+ },
40
+ },
41
+ },
42
+ {
43
+ href: "/staying-uk-eu-citizen",
44
+ text: "Continue to live in the UK after Brexit",
45
+ attributes: {
46
+ data: {
47
+ track_category: "footerClicked",
48
+ track_action: "brexitLinks",
49
+ track_label: "Continue to live in the UK after Brexit",
50
+ },
51
+ },
52
+ },
53
+ ],
54
+ },
55
+ {
56
+ title: "Services and information",
57
+ columns: 2,
58
+ items: [
59
+ {
60
+ href: "/browse/benefits",
61
+ text: "Benefits",
62
+ attributes: {
63
+ data: {
64
+ track_category: "footerClicked",
65
+ track_action: "footerLinks",
66
+ track_label: "Benefits",
67
+ },
68
+ },
69
+ },
70
+ {
71
+ href: "/browse/births-deaths-marriages",
72
+ text: "Births, deaths, marriages and care",
73
+ attributes: {
74
+ data: {
75
+ track_category: "footerClicked",
76
+ track_action: "footerLinks",
77
+ track_label: "Births, deaths, marriages and care",
78
+ },
79
+ },
80
+ },
81
+ {
82
+ href: "/browse/business",
83
+ text: "Business and self-employed",
84
+ attributes: {
85
+ data: {
86
+ track_category: "footerClicked",
87
+ track_action: "footerLinks",
88
+ track_label: "Business and self-employed",
89
+ },
90
+ },
91
+ },
92
+ {
93
+ href: "/browse/childcare-parenting",
94
+ text: "Childcare and parenting",
95
+ attributes: {
96
+ data: {
97
+ track_category: "footerClicked",
98
+ track_action: "footerLinks",
99
+ track_label: "Childcare and parenting",
100
+ },
101
+ },
102
+ },
103
+ {
104
+ href: "/browse/citizenship",
105
+ text: "Citizenship and living in the UK",
106
+ attributes: {
107
+ data: {
108
+ track_category: "footerClicked",
109
+ track_action: "footerLinks",
110
+ track_label: "Citizenship and living in the UK",
111
+ },
112
+ },
113
+ },
114
+ {
115
+ href: "/browse/justice",
116
+ text: "Crime, justice and the law",
117
+ attributes: {
118
+ data: {
119
+ track_category: "footerClicked",
120
+ track_action: "footerLinks",
121
+ track_label: "Crime, justice and the law",
122
+ },
123
+ },
124
+ },
125
+ {
126
+ href: "/browse/disabilities",
127
+ text: "Disabled people",
128
+ attributes: {
129
+ data: {
130
+ track_category: "footerClicked",
131
+ track_action: "footerLinks",
132
+ track_label: "Disabled people",
133
+ },
134
+ },
135
+ },
136
+ {
137
+ href: "/browse/driving",
138
+ text: "Driving and transport",
139
+ attributes: {
140
+ data: {
141
+ track_category: "footerClicked",
142
+ track_action: "footerLinks",
143
+ track_label: "Driving and transport",
144
+ },
145
+ },
146
+ },
147
+ {
148
+ href: "/browse/education",
149
+ text: "Education and learning",
150
+ attributes: {
151
+ data: {
152
+ track_category: "footerClicked",
153
+ track_action: "footerLinks",
154
+ track_label: "Education and learning",
155
+ },
156
+ },
157
+ },
158
+ {
159
+ href: "/browse/employing-people",
160
+ text: "Employing people",
161
+ attributes: {
162
+ data: {
163
+ track_category: "footerClicked",
164
+ track_action: "footerLinks",
165
+ track_label: "Employing people",
166
+ },
167
+ },
168
+ },
169
+ {
170
+ href: "/browse/environment-countryside",
171
+ text: "Environment and countryside",
172
+ attributes: {
173
+ data: {
174
+ track_category: "footerClicked",
175
+ track_action: "footerLinks",
176
+ track_label: "Environment and countryside",
177
+ },
178
+ },
179
+ },
180
+ {
181
+ href: "/browse/housing-local-services",
182
+ text: "Housing and local services",
183
+ attributes: {
184
+ data: {
185
+ track_category: "footerClicked",
186
+ track_action: "footerLinks",
187
+ track_label: "Housing and local services",
188
+ },
189
+ },
190
+ },
191
+ {
192
+ href: "/browse/tax",
193
+ text: "Money and tax",
194
+ attributes: {
195
+ data: {
196
+ track_category: "footerClicked",
197
+ track_action: "footerLinks",
198
+ track_label: "Money and tax",
199
+ },
200
+ },
201
+ },
202
+ {
203
+ href: "/browse/abroad",
204
+ text: "Passports, travel and living abroad",
205
+ attributes: {
206
+ data: {
207
+ track_category: "footerClicked",
208
+ track_action: "footerLinks",
209
+ track_label: "Passports, travel and living abroad",
210
+ },
211
+ },
212
+ },
213
+ {
214
+ href: "/browse/visas-immigration",
215
+ text: "Visas and immigration",
216
+ attributes: {
217
+ data: {
218
+ track_category: "footerClicked",
219
+ track_action: "footerLinks",
220
+ track_label: "Visas and immigration",
221
+ },
222
+ },
223
+ },
224
+ {
225
+ href: "/browse/working",
226
+ text: "Working, jobs and pensions",
227
+ attributes: {
228
+ data: {
229
+ track_category: "footerClicked",
230
+ track_action: "footerLinks",
231
+ track_label: "Working, jobs and pensions",
232
+ },
233
+ },
234
+ },
235
+ ],
236
+ },
237
+ {
238
+ title: "Departments and policy",
239
+ items: [
240
+ {
241
+ href: "/government/how-government-works",
242
+ text: "How government works",
243
+ attributes: {
244
+ data: {
245
+ track_category: "footerClicked",
246
+ track_action: "footerLinks",
247
+ track_label: "How government works",
248
+ },
249
+ },
250
+ },
251
+ {
252
+ href: "/government/organisations",
253
+ text: "Departments",
254
+ attributes: {
255
+ data: {
256
+ track_category: "footerClicked",
257
+ track_action: "footerLinks",
258
+ track_label: "Departments",
259
+ },
260
+ },
261
+ },
262
+ {
263
+ href: "/world",
264
+ text: "Worldwide",
265
+ attributes: {
266
+ data: {
267
+ track_category: "footerClicked",
268
+ track_action: "footerLinks",
269
+ track_label: "Worldwide",
270
+ },
271
+ },
272
+ },
273
+ {
274
+ href: "/search/services",
275
+ text: "Services",
276
+ attributes: {
277
+ data: {
278
+ track_category: "footerClicked",
279
+ track_action: "footerLinks",
280
+ track_label: "Services",
281
+ },
282
+ },
283
+ },
284
+ {
285
+ href: "/search/guidance-and-regulation",
286
+ text: "Guidance and regulation",
287
+ attributes: {
288
+ data: {
289
+ track_category: "footerClicked",
290
+ track_action: "footerLinks",
291
+ track_label: "Guidance and regulation",
292
+ },
293
+ },
294
+ },
295
+ {
296
+ href: "/search/news-and-communications",
297
+ text: "News and communications",
298
+ attributes: {
299
+ data: {
300
+ track_category: "footerClicked",
301
+ track_action: "footerLinks",
302
+ track_label: "News and communications",
303
+ },
304
+ },
305
+ },
306
+ {
307
+ href: "/search/research-and-statistics",
308
+ text: "Research and statistics",
309
+ attributes: {
310
+ data: {
311
+ track_category: "footerClicked",
312
+ track_action: "footerLinks",
313
+ track_label: "Research and statistics",
314
+ },
315
+ },
316
+ },
317
+ {
318
+ href: "/search/policy-papers-and-consultations",
319
+ text: "Policy papers and consultations",
320
+ attributes: {
321
+ data: {
322
+ track_category: "footerClicked",
323
+ track_action: "footerLinks",
324
+ track_label: "Policy papers and consultations",
325
+ },
326
+ },
327
+ },
328
+ {
329
+ href: "/search/transparency-and-freedom-of-information-releases",
330
+ text: "Transparency and freedom of information releases",
331
+ attributes: {
332
+ data: {
333
+ track_category: "footerClicked",
334
+ track_action: "footerLinks",
335
+ track_label: "Transparency and freedom of information releases",
336
+ },
337
+ },
338
+ },
339
+ ],
340
+ },
341
+ ].freeze
342
+
343
+ FOOTER_META = {
344
+ items: [
345
+ {
346
+ href: "/help",
347
+ text: "Help",
348
+ },
349
+ {
350
+ href: "/help/cookies",
351
+ text: "Cookies",
352
+ },
353
+ {
354
+ href: "/contact",
355
+ text: "Contact",
356
+ },
357
+ {
358
+ href: "/help/terms-conditions",
359
+ text: "Terms and conditions",
360
+ },
361
+ {
362
+ href: "/cymraeg",
363
+ text: "Rhestr o Wasanaethau Cymraeg",
364
+ },
365
+ {
366
+ href: "/government/organisations/government-digital-service",
367
+ text: "Government Digital Service",
368
+ },
369
+ ],
370
+ }.freeze
371
+
372
+ attr_reader :footer_navigation, :footer_meta
373
+
374
+ def initialize(local_assigns)
375
+ @footer_navigation = local_assigns[:footer_navigation] || FOOTER_NAV
376
+ @footer_meta = local_assigns[:footer_meta] || FOOTER_META
377
+ end
378
+ end
379
+ end
380
+ end