govuk_publishing_components 34.12.0 → 34.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/govuk_publishing_components_manifest.js +75 -0
  3. data/app/assets/stylesheets/govuk_publishing_components/_individual_component_support.scss +10 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +2 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +2 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss +1 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +2 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +1 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +1 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss +1 -0
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +1 -0
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +1 -0
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss +2 -0
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -0
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +1 -0
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_date-input.scss +1 -0
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_details.scss +1 -0
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_devolved-nations.scss +2 -0
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -0
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss +2 -0
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -0
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss +1 -0
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -0
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +2 -0
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss +1 -0
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_file-upload.scss +1 -0
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +2 -0
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +2 -0
  31. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +2 -0
  32. data/app/assets/stylesheets/govuk_publishing_components/components/_hint.scss +1 -0
  33. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +2 -0
  34. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +2 -0
  35. data/app/assets/stylesheets/govuk_publishing_components/components/_inset-text.scss +1 -0
  36. data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +2 -0
  37. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +2 -0
  38. data/app/assets/stylesheets/govuk_publishing_components/components/_label.scss +1 -0
  39. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
  40. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +2 -0
  41. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -0
  42. data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +2 -0
  43. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +2 -0
  44. data/app/assets/stylesheets/govuk_publishing_components/components/_modal-dialogue.scss +2 -0
  45. data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +1 -0
  46. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -0
  47. data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +1 -0
  48. data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +1 -0
  49. data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +1 -0
  50. data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +2 -0
  51. data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +1 -0
  52. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -0
  53. data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +2 -0
  54. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +2 -0
  55. data/app/assets/stylesheets/govuk_publishing_components/components/_select.scss +1 -0
  56. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +2 -0
  57. data/app/assets/stylesheets/govuk_publishing_components/components/_show-password.scss +2 -0
  58. data/app/assets/stylesheets/govuk_publishing_components/components/_signup-link.scss +2 -0
  59. data/app/assets/stylesheets/govuk_publishing_components/components/_single-page-notification-button.scss +2 -0
  60. data/app/assets/stylesheets/govuk_publishing_components/components/_skip-link.scss +1 -0
  61. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +2 -0
  62. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +2 -0
  63. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +2 -0
  64. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +2 -0
  65. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -0
  66. data/app/assets/stylesheets/govuk_publishing_components/components/_summary-list.scss +1 -0
  67. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +1 -0
  68. data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +1 -0
  69. data/app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss +1 -0
  70. data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +2 -0
  71. data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +2 -0
  72. data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -0
  73. data/app/views/govuk_publishing_components/components/_accordion.html.erb +2 -0
  74. data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -0
  75. data/app/views/govuk_publishing_components/components/_attachment.html.erb +2 -0
  76. data/app/views/govuk_publishing_components/components/_attachment_link.html.erb +2 -0
  77. data/app/views/govuk_publishing_components/components/_back_link.html.erb +2 -0
  78. data/app/views/govuk_publishing_components/components/_big_number.html.erb +3 -1
  79. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +2 -0
  80. data/app/views/govuk_publishing_components/components/_button.html.erb +2 -0
  81. data/app/views/govuk_publishing_components/components/_cards.html.erb +2 -0
  82. data/app/views/govuk_publishing_components/components/_character_count.html.erb +2 -0
  83. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -0
  84. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -0
  85. data/app/views/govuk_publishing_components/components/_contextual_guidance.html.erb +2 -0
  86. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +2 -0
  87. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +2 -0
  88. data/app/views/govuk_publishing_components/components/_date_input.html.erb +2 -0
  89. data/app/views/govuk_publishing_components/components/_details.html.erb +2 -0
  90. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +2 -0
  91. data/app/views/govuk_publishing_components/components/_document_list.html.erb +2 -0
  92. data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +2 -0
  93. data/app/views/govuk_publishing_components/components/_error_alert.html.erb +2 -0
  94. data/app/views/govuk_publishing_components/components/_error_message.html.erb +2 -0
  95. data/app/views/govuk_publishing_components/components/_error_summary.html.erb +2 -0
  96. data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -0
  97. data/app/views/govuk_publishing_components/components/_fieldset.html.erb +2 -0
  98. data/app/views/govuk_publishing_components/components/_file_upload.html.erb +2 -0
  99. data/app/views/govuk_publishing_components/components/_govspeak.html.erb +1 -0
  100. data/app/views/govuk_publishing_components/components/_govspeak_html_publication.html.erb +2 -0
  101. data/app/views/govuk_publishing_components/components/_heading.html.erb +2 -0
  102. data/app/views/govuk_publishing_components/components/_hint.html.erb +2 -0
  103. data/app/views/govuk_publishing_components/components/_image_card.html.erb +5 -3
  104. data/app/views/govuk_publishing_components/components/_input.html.erb +2 -0
  105. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +2 -0
  106. data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -0
  107. data/app/views/govuk_publishing_components/components/_inverse_header.html.erb +2 -0
  108. data/app/views/govuk_publishing_components/components/_label.html.erb +2 -0
  109. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +2 -0
  110. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +5 -1
  111. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -0
  112. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +2 -0
  113. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -0
  114. data/app/views/govuk_publishing_components/components/_lead_paragraph.html.erb +2 -0
  115. data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -0
  116. data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +2 -0
  117. data/app/views/govuk_publishing_components/components/_notice.html.erb +2 -0
  118. data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -0
  119. data/app/views/govuk_publishing_components/components/_panel.html.erb +2 -0
  120. data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +2 -0
  121. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +6 -1
  122. data/app/views/govuk_publishing_components/components/_print_link.html.erb +2 -0
  123. data/app/views/govuk_publishing_components/components/_radio.html.erb +2 -0
  124. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +4 -0
  125. data/app/views/govuk_publishing_components/components/_reorderable_list.html.erb +2 -0
  126. data/app/views/govuk_publishing_components/components/_search.html.erb +2 -0
  127. data/app/views/govuk_publishing_components/components/_select.html.erb +2 -0
  128. data/app/views/govuk_publishing_components/components/_share_links.html.erb +2 -0
  129. data/app/views/govuk_publishing_components/components/_show_password.html.erb +2 -0
  130. data/app/views/govuk_publishing_components/components/_signup_link.html.erb +2 -0
  131. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +2 -0
  132. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +2 -0
  133. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +2 -0
  134. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +3 -1
  135. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +2 -0
  136. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +2 -0
  137. data/app/views/govuk_publishing_components/components/_success_alert.html.erb +2 -0
  138. data/app/views/govuk_publishing_components/components/_summary_list.html.erb +2 -0
  139. data/app/views/govuk_publishing_components/components/_table.html.erb +3 -1
  140. data/app/views/govuk_publishing_components/components/_tabs.html.erb +2 -0
  141. data/app/views/govuk_publishing_components/components/_textarea.html.erb +2 -0
  142. data/app/views/govuk_publishing_components/components/_title.html.erb +2 -0
  143. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +2 -0
  144. data/app/views/govuk_publishing_components/components/_warning_text.html.erb +2 -0
  145. data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +86 -0
  146. data/lib/govuk_publishing_components/config.rb +3 -0
  147. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +1 -1
  148. data/lib/govuk_publishing_components/railtie.rb +7 -0
  149. data/lib/govuk_publishing_components/version.rb +1 -1
  150. data/lib/govuk_publishing_components.rb +3 -0
  151. metadata +5 -2
@@ -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.12.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.12.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-23 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