govuk_publishing_components 34.11.0 → 34.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/govuk_publishing_components_manifest.js +75 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +8 -2
  4. data/app/assets/stylesheets/govuk_publishing_components/_individual_component_support.scss +10 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +2 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +2 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss +1 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +2 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +1 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +1 -0
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss +1 -0
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +1 -0
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +1 -0
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss +2 -0
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -0
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +1 -0
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_date-input.scss +1 -0
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_details.scss +1 -0
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_devolved-nations.scss +2 -0
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -0
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss +2 -0
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -0
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss +1 -0
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -0
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +2 -0
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss +1 -0
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_file-upload.scss +1 -0
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +2 -0
  31. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +2 -0
  32. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +2 -0
  33. data/app/assets/stylesheets/govuk_publishing_components/components/_hint.scss +1 -0
  34. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +2 -0
  35. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +2 -0
  36. data/app/assets/stylesheets/govuk_publishing_components/components/_inset-text.scss +1 -0
  37. data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +2 -0
  38. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +2 -0
  39. data/app/assets/stylesheets/govuk_publishing_components/components/_label.scss +1 -0
  40. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
  41. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +2 -0
  42. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -0
  43. data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +2 -0
  44. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +2 -0
  45. data/app/assets/stylesheets/govuk_publishing_components/components/_modal-dialogue.scss +2 -0
  46. data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +1 -0
  47. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -0
  48. data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +1 -0
  49. data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +1 -0
  50. data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +1 -0
  51. data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +2 -0
  52. data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +1 -0
  53. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -0
  54. data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +2 -0
  55. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +2 -0
  56. data/app/assets/stylesheets/govuk_publishing_components/components/_select.scss +1 -0
  57. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +2 -0
  58. data/app/assets/stylesheets/govuk_publishing_components/components/_show-password.scss +2 -0
  59. data/app/assets/stylesheets/govuk_publishing_components/components/_signup-link.scss +2 -0
  60. data/app/assets/stylesheets/govuk_publishing_components/components/_single-page-notification-button.scss +2 -0
  61. data/app/assets/stylesheets/govuk_publishing_components/components/_skip-link.scss +1 -0
  62. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +2 -0
  63. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +2 -0
  64. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +2 -0
  65. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +2 -0
  66. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -0
  67. data/app/assets/stylesheets/govuk_publishing_components/components/_summary-list.scss +1 -0
  68. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +1 -0
  69. data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +1 -0
  70. data/app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss +1 -0
  71. data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +2 -0
  72. data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +2 -0
  73. data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -0
  74. data/app/models/govuk_publishing_components/audit_components.rb +55 -1
  75. data/app/views/govuk_publishing_components/audit/_components.html.erb +46 -1
  76. data/app/views/govuk_publishing_components/components/_accordion.html.erb +2 -0
  77. data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -0
  78. data/app/views/govuk_publishing_components/components/_attachment.html.erb +2 -0
  79. data/app/views/govuk_publishing_components/components/_attachment_link.html.erb +2 -0
  80. data/app/views/govuk_publishing_components/components/_back_link.html.erb +2 -0
  81. data/app/views/govuk_publishing_components/components/_big_number.html.erb +3 -1
  82. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +2 -0
  83. data/app/views/govuk_publishing_components/components/_button.html.erb +2 -0
  84. data/app/views/govuk_publishing_components/components/_cards.html.erb +2 -0
  85. data/app/views/govuk_publishing_components/components/_character_count.html.erb +2 -0
  86. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -0
  87. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -0
  88. data/app/views/govuk_publishing_components/components/_contextual_guidance.html.erb +2 -0
  89. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +2 -0
  90. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +2 -0
  91. data/app/views/govuk_publishing_components/components/_date_input.html.erb +2 -0
  92. data/app/views/govuk_publishing_components/components/_details.html.erb +2 -0
  93. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +2 -0
  94. data/app/views/govuk_publishing_components/components/_document_list.html.erb +2 -0
  95. data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +2 -0
  96. data/app/views/govuk_publishing_components/components/_error_alert.html.erb +2 -0
  97. data/app/views/govuk_publishing_components/components/_error_message.html.erb +2 -0
  98. data/app/views/govuk_publishing_components/components/_error_summary.html.erb +2 -0
  99. data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -0
  100. data/app/views/govuk_publishing_components/components/_fieldset.html.erb +2 -0
  101. data/app/views/govuk_publishing_components/components/_file_upload.html.erb +2 -0
  102. data/app/views/govuk_publishing_components/components/_govspeak.html.erb +1 -0
  103. data/app/views/govuk_publishing_components/components/_govspeak_html_publication.html.erb +2 -0
  104. data/app/views/govuk_publishing_components/components/_heading.html.erb +2 -0
  105. data/app/views/govuk_publishing_components/components/_hint.html.erb +2 -0
  106. data/app/views/govuk_publishing_components/components/_image_card.html.erb +5 -3
  107. data/app/views/govuk_publishing_components/components/_input.html.erb +2 -0
  108. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +2 -0
  109. data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -0
  110. data/app/views/govuk_publishing_components/components/_inverse_header.html.erb +2 -0
  111. data/app/views/govuk_publishing_components/components/_label.html.erb +2 -0
  112. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +2 -0
  113. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +5 -1
  114. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -0
  115. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +2 -0
  116. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +5 -0
  117. data/app/views/govuk_publishing_components/components/_lead_paragraph.html.erb +2 -0
  118. data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -0
  119. data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +2 -0
  120. data/app/views/govuk_publishing_components/components/_notice.html.erb +2 -0
  121. data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -0
  122. data/app/views/govuk_publishing_components/components/_panel.html.erb +2 -0
  123. data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +2 -0
  124. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +6 -1
  125. data/app/views/govuk_publishing_components/components/_print_link.html.erb +2 -0
  126. data/app/views/govuk_publishing_components/components/_radio.html.erb +2 -0
  127. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +4 -0
  128. data/app/views/govuk_publishing_components/components/_reorderable_list.html.erb +2 -0
  129. data/app/views/govuk_publishing_components/components/_search.html.erb +2 -0
  130. data/app/views/govuk_publishing_components/components/_select.html.erb +2 -0
  131. data/app/views/govuk_publishing_components/components/_share_links.html.erb +2 -0
  132. data/app/views/govuk_publishing_components/components/_show_password.html.erb +2 -0
  133. data/app/views/govuk_publishing_components/components/_signup_link.html.erb +2 -0
  134. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +2 -0
  135. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +2 -0
  136. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +2 -0
  137. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +3 -1
  138. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +2 -0
  139. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +2 -0
  140. data/app/views/govuk_publishing_components/components/_success_alert.html.erb +2 -0
  141. data/app/views/govuk_publishing_components/components/_summary_list.html.erb +2 -0
  142. data/app/views/govuk_publishing_components/components/_table.html.erb +3 -1
  143. data/app/views/govuk_publishing_components/components/_tabs.html.erb +2 -0
  144. data/app/views/govuk_publishing_components/components/_textarea.html.erb +2 -0
  145. data/app/views/govuk_publishing_components/components/_title.html.erb +2 -0
  146. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +2 -0
  147. data/app/views/govuk_publishing_components/components/_warning_text.html.erb +2 -0
  148. data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +20 -0
  149. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +15 -9
  150. data/config/locales/en.yml +1 -1
  151. data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +86 -0
  152. data/lib/govuk_publishing_components/config.rb +3 -0
  153. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +1 -1
  154. data/lib/govuk_publishing_components/railtie.rb +7 -0
  155. data/lib/govuk_publishing_components/version.rb +1 -1
  156. data/lib/govuk_publishing_components.rb +3 -0
  157. metadata +5 -2
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("signup-link")
3
+
2
4
  local_assigns[:heading_level] ||= 3
3
5
  local_assigns[:margin_bottom] ||= 0
4
6
  link_text ||= false
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("single-page-notification-button")
3
+
2
4
  component_helper = GovukPublishingComponents::Presenters::SinglePageNotificationButtonHelper.new(local_assigns)
3
5
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
4
6
 
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("skip-link")
3
+
2
4
  href ||= '#main-content'
3
5
  text ||= t('components.skip_link.text')
4
6
  %>
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("step-by-step-nav")
3
+
2
4
  options = {}
3
5
  options[:heading_level] = heading_level ||= 2
4
6
 
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("step-by-step-nav-header")
3
+
2
4
  title ||= false
3
5
  path ||= false
4
6
  breadcrumbs = [
@@ -20,7 +22,7 @@
20
22
  end
21
23
 
22
24
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
23
- classes = %w(gem-c-step-nav-header)
25
+ classes = %w[gem-c-step-nav-header]
24
26
  classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
25
27
  %>
26
28
  <% if title %>
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("step-by-step-nav-related")
3
+
2
4
  links ||= []
3
5
  pretitle ||= t("components.step_by_step_nav_related.part_of")
4
6
  always_display_as_list ||= false
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("subscription-links")
3
+
2
4
  brand ||= false
3
5
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
4
6
 
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("success-alert")
3
+
2
4
  description ||= nil
3
5
  title_id ||= "govuk-notification-banner-title-#{SecureRandom.hex(4)}"
4
6
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("summary-list")
3
+
2
4
  local_assigns[:heading_level] ||= 3
3
5
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
4
6
  heading_size = "m" unless shared_helper.valid_heading_size?(heading_size)
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("table")
3
+
2
4
  caption ||= nil
3
5
  head ||= []
4
6
  rows ||= []
@@ -16,7 +18,7 @@
16
18
  <%= GovukPublishingComponents::AppHelpers::TableHelper.helper(self, caption, {
17
19
  sortable: sortable,
18
20
  filterable: filterable,
19
- caption_classes: caption_classes,
21
+ caption_classes: caption_classes,
20
22
  table_id: table_id
21
23
  }) do |t| %>
22
24
 
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("tabs")
3
+
2
4
  tabs ||= []
3
5
  panel_border ||= true unless panel_border == false
4
6
  panel_css_classes = %w(govuk-tabs__panel)
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("textarea")
3
+
2
4
  id ||= "textarea-#{SecureRandom.hex(4)}"
3
5
  value ||= nil
4
6
  rows ||= 5
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("title")
3
+
2
4
  average_title_length ||= false
3
5
 
4
6
  context ||= false
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("translation-nav")
3
+
2
4
  brand ||= false
3
5
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
4
6
  translation_helper = GovukPublishingComponents::Presenters::TranslationNavHelper.new(local_assigns)
@@ -1,4 +1,6 @@
1
1
  <%
2
+ add_gem_component_stylesheet("warning-text")
3
+
2
4
  id ||= "warning-text-#{SecureRandom.hex(4)}"
3
5
  text_assistive ||= 'Warning'
4
6
  text_icon ||= '!'
@@ -333,3 +333,23 @@ examples:
333
333
  - title: UK-China High-Level People to People Dialogue 2017
334
334
  base_path: /government/topical-events/uk-china-high-level-people-to-people-dialogue-2017
335
335
  document_type: topical_event
336
+ world_locations:
337
+ - title: Algeria
338
+ base_path: /world/algeria/news
339
+ - title: Austria
340
+ base_path: /world/austria/news
341
+ - title: Belarus
342
+ base_path: /world/belarus/news
343
+ - title: Belgium
344
+ base_path: /world/belgium/news
345
+ - title: Bolivia
346
+ base_path: /world/bolivia/news
347
+ - title: Brazil
348
+ base_path: /world/brazil/news
349
+ - title: Canada
350
+ base_path: /world/canada/news
351
+ - title: Chile
352
+ base_path: /world/chile/news
353
+ - title: China
354
+ base_path: /world/China/news
355
+
@@ -63,17 +63,23 @@
63
63
  <% end %>
64
64
 
65
65
  <% if links.length > section_link_limit %>
66
- <li class="gem-c-related-navigation__link toggle-wrap">
67
- <a href="#"
68
- class="gem-c-related-navigation__toggle"
69
- data-controls="toggle_<%= section_title %>"
70
- data-expanded="false"
71
- data-toggled-text="<%= t("common.toggle_less") %>">
66
+ <%
67
+ classes = "gem-c-related-navigation__link toggle-wrap"
68
+ data_attributes_li = { module: "ga4-event-tracker" } if ga4_tracking
69
+ data_attributes_link = {
70
+ controls: "toggle_#{section_title}",
71
+ expanded: "false",
72
+ toggled_text: t("common.toggle_less")
73
+ }
74
+ data_attributes_link[:ga4_event] = { "event_name": "select_content", "type": "related content" } if ga4_tracking
75
+ %>
76
+ <%= tag.li(class: classes, data: data_attributes_li) do %>
77
+ <%= link_to("#", class: "gem-c-related-navigation__toggle", data: data_attributes_link) do %>
72
78
  <%= t("common.toggle_more",
73
79
  show: t('common.show'),
74
- number: related_nav_helper.remaining_link_count(links)) %>
75
- </a>
76
- </li>
80
+ number: related_nav_helper.remaining_link_count(links)) %>
81
+ <% end %>
82
+ <% end %>
77
83
 
78
84
  <li class="gem-c-related-navigation__link gem-c-related-navigation__link--truncated-links">
79
85
  <span id="toggle_<%= section_title %>" class="gem-c-related-navigation__toggle-more js-hidden">
@@ -293,7 +293,7 @@ en:
293
293
  - label: 'Homes for Ukraine: record your interest'
294
294
  href: https://www.gov.uk/register-interest-homes-ukraine
295
295
  - label: Find out about the UK’s response
296
- href: https://ukstandswithukraine.campaign.gov.uk/
296
+ href: https://www.gov.uk/government/topical-events/russian-invasion-of-ukraine-uk-government-response
297
297
  title: Invasion of Ukraine
298
298
  world_locations: World locations
299
299
  search_box:
@@ -0,0 +1,86 @@
1
+ module GovukPublishingComponents
2
+ module AppHelpers
3
+ module AssetHelper
4
+ # This is a list of all the components that have stylesheets - so a new
5
+ # component needs to be added to this list rather than being laboriously
6
+ # added and removed from every single rendering application.
7
+ COMPONENT_CSS_PATHS = Dir.glob("#{GovukPublishingComponents::Config.gem_directory}/app/assets/stylesheets/govuk_publishing_components/components/_*.scss").map { |path|
8
+ filename = path.split("/").last
9
+ component_name = filename.sub("_", "").sub(".scss", "")
10
+ "govuk_publishing_components/components/_#{component_name}.css"
11
+ }.freeze
12
+
13
+ # This list includes components already included in Static; taken from
14
+ # https://github.com/alphagov/static/blob/198a598682df40ce4a2c3c286c06244297c18cf0/app/assets/stylesheets/application.scss
15
+
16
+ # This is used to dedupe stylesheets.
17
+ STATIC_STYLESHEET_LIST = %w[
18
+ govuk_publishing_components/components/_breadcrumbs.css
19
+ govuk_publishing_components/components/_button.css
20
+ govuk_publishing_components/components/_error-message.css
21
+ govuk_publishing_components/components/_heading.css
22
+ govuk_publishing_components/components/_hint.css
23
+ govuk_publishing_components/components/_input.css
24
+ govuk_publishing_components/components/_label.css
25
+ govuk_publishing_components/components/_search.css
26
+ govuk_publishing_components/components/_skip-link.css
27
+ govuk_publishing_components/components/_textarea.css
28
+ govuk_publishing_components/components/_title.css
29
+
30
+ govuk_publishing_components/components/_cookie-banner.css
31
+ govuk_publishing_components/components/_feedback.css
32
+ govuk_publishing_components/components/_layout-footer.css
33
+ govuk_publishing_components/components/_layout-for-public.css
34
+ govuk_publishing_components/components/_layout-header.css
35
+ govuk_publishing_components/components/_layout-super-navigation-header.css
36
+ ].freeze
37
+
38
+ def add_stylesheet_path(component_path)
39
+ unless is_already_used?(component_path)
40
+ all_component_stylesheets_being_used << component_path
41
+ end
42
+ end
43
+
44
+ # Used to add a component that exists in the gem to the list
45
+ def add_gem_component_stylesheet(gem_component)
46
+ add_stylesheet_path("govuk_publishing_components/components/_#{gem_component}.css")
47
+ end
48
+
49
+ # Used to add a component that exists in the application to the list
50
+ def add_app_component_stylesheet(app_component)
51
+ add_stylesheet_path("components/_#{app_component}.css")
52
+ end
53
+
54
+ # Some applications have view-specific stylesheets - use this method
55
+ # to add them to the list
56
+ def add_view_stylesheet(view_component)
57
+ add_stylesheet_path("views/_#{view_component}.css")
58
+ end
59
+
60
+ def all_component_stylesheets_being_used
61
+ @all_component_stylesheets_being_used ||= []
62
+ end
63
+
64
+ def render_component_stylesheets
65
+ list_of_stylesheets = all_component_stylesheets_being_used.map do |component|
66
+ stylesheet_link_tag(component, integrity: false)
67
+ end
68
+ raw(list_of_stylesheets.join(""))
69
+ end
70
+
71
+ def get_component_css_paths
72
+ COMPONENT_CSS_PATHS
73
+ end
74
+
75
+ private
76
+
77
+ def is_already_used?(component)
78
+ if GovukPublishingComponents::Config.exclude_css_from_static
79
+ all_component_stylesheets_being_used.include?(component) || STATIC_STYLESHEET_LIST.include?(component)
80
+ else
81
+ all_component_stylesheets_being_used.include?(component)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -15,6 +15,9 @@ module GovukPublishingComponents
15
15
  mattr_accessor :application_javascript
16
16
  self.application_javascript = "application"
17
17
 
18
+ mattr_accessor :exclude_css_from_static
19
+ self.exclude_css_from_static = true
20
+
18
21
  def self.component_directory_name
19
22
  APP_COMPONENT_DIRECTORY
20
23
  end
@@ -69,7 +69,7 @@ module GovukPublishingComponents
69
69
  # Force English so we can still understand what is being tracked if translated.
70
70
  underscores_to_spaces = true
71
71
  underscores_to_spaces = false if section == "related_content"
72
- I18n.with_locale("en") do
72
+ I18n.with_locale(:en) do
73
73
  construct_section_text(section, underscores_to_spaces)
74
74
  end
75
75
  end
@@ -0,0 +1,7 @@
1
+ module GovukPublishingComponents
2
+ class Railtie < Rails::Railtie
3
+ initializer "govuk_publishing_components.view_helpers" do
4
+ ActiveSupport.on_load(:action_view) { include GovukPublishingComponents::AppHelpers::AssetHelper }
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "34.11.0".freeze
2
+ VERSION = "34.13.0".freeze
3
3
  end
@@ -40,6 +40,9 @@ require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
40
40
  require "govuk_publishing_components/app_helpers/table_helper"
41
41
  require "govuk_publishing_components/app_helpers/brand_helper"
42
42
  require "govuk_publishing_components/app_helpers/environment"
43
+ require "govuk_publishing_components/app_helpers/asset_helper"
44
+
45
+ require "govuk_publishing_components/railtie" if defined?(Rails::Railtie)
43
46
 
44
47
  # Add i18n paths and views for usage outside of a Rails app
45
48
  I18n.load_path.unshift(
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: 34.11.0
4
+ version: 34.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
11
+ date: 2023-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -525,6 +525,7 @@ files:
525
525
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js
526
526
  - app/assets/stylesheets/component_guide/application.scss
527
527
  - app/assets/stylesheets/govuk_publishing_components/_all_components.scss
528
+ - app/assets/stylesheets/govuk_publishing_components/_individual_component_support.scss
528
529
  - app/assets/stylesheets/govuk_publishing_components/component_support.scss
529
530
  - app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss
530
531
  - app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss
@@ -905,6 +906,7 @@ files:
905
906
  - lib/generators/govuk_publishing_components/templates/_component.scss
906
907
  - lib/generators/govuk_publishing_components/templates/component.yml.erb
907
908
  - lib/govuk_publishing_components.rb
909
+ - lib/govuk_publishing_components/app_helpers/asset_helper.rb
908
910
  - lib/govuk_publishing_components/app_helpers/brand_helper.rb
909
911
  - lib/govuk_publishing_components/app_helpers/environment.rb
910
912
  - lib/govuk_publishing_components/app_helpers/table_helper.rb
@@ -957,6 +959,7 @@ files:
957
959
  - lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
958
960
  - lib/govuk_publishing_components/presenters/subscription_links_helper.rb
959
961
  - lib/govuk_publishing_components/presenters/translation_nav_helper.rb
962
+ - lib/govuk_publishing_components/railtie.rb
960
963
  - lib/govuk_publishing_components/version.rb
961
964
  - node_modules/axe-core/LICENSE
962
965
  - node_modules/axe-core/README.md