govuk_publishing_components 54.0.0 → 55.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/lib/sticky-element-container.js +117 -0
  3. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +5 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +6 -12
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +13 -9
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_back-to-top-link.scss +15 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list-with-body.scss +58 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_figure.scss +46 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +1 -21
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_published-dates.scss +57 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +0 -74
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_summary-banner.scss +33 -0
  13. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_legislative-list.scss +5 -0
  14. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_sticky-element-container.scss +23 -0
  15. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +1 -1
  16. data/app/models/govuk_publishing_components/audit_applications.rb +1 -1
  17. data/app/models/govuk_publishing_components/audit_comparer.rb +1 -1
  18. data/app/models/govuk_publishing_components/audit_components.rb +1 -1
  19. data/app/models/govuk_publishing_components/component_doc.rb +1 -1
  20. data/app/views/govuk_publishing_components/components/_attachment.html.erb +2 -0
  21. data/app/views/govuk_publishing_components/components/_back_to_top_link.html.erb +19 -0
  22. data/app/views/govuk_publishing_components/components/_contents_list_with_body.html.erb +27 -0
  23. data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -6
  24. data/app/views/govuk_publishing_components/components/_figure.html.erb +28 -0
  25. data/app/views/govuk_publishing_components/components/_heading.html.erb +0 -1
  26. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +0 -1
  27. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +0 -6
  28. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -1
  29. data/app/views/govuk_publishing_components/components/_metadata.html.erb +0 -3
  30. data/app/views/govuk_publishing_components/components/_published_dates.html.erb +50 -0
  31. data/app/views/govuk_publishing_components/components/_radio.html.erb +0 -1
  32. data/app/views/govuk_publishing_components/components/_search.html.erb +1 -4
  33. data/app/views/govuk_publishing_components/components/_summary_banner.html.erb +27 -0
  34. data/app/views/govuk_publishing_components/components/docs/back_to_top_link.yml +19 -0
  35. data/app/views/govuk_publishing_components/components/docs/contents_list_with_body.yml +90 -0
  36. data/app/views/govuk_publishing_components/components/docs/figure.yml +43 -0
  37. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +7 -4
  38. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +0 -1
  39. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +0 -3
  40. data/app/views/govuk_publishing_components/components/docs/published_dates.yml +43 -0
  41. data/app/views/govuk_publishing_components/components/docs/search.yml +0 -9
  42. data/app/views/govuk_publishing_components/components/docs/summary_banner.yml +28 -0
  43. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +0 -4
  44. data/config/locales/ar.yml +11 -4
  45. data/config/locales/az.yml +11 -4
  46. data/config/locales/be.yml +11 -4
  47. data/config/locales/bg.yml +11 -4
  48. data/config/locales/bn.yml +11 -4
  49. data/config/locales/cs.yml +11 -4
  50. data/config/locales/cy.yml +11 -4
  51. data/config/locales/da.yml +11 -4
  52. data/config/locales/de.yml +11 -4
  53. data/config/locales/dr.yml +11 -4
  54. data/config/locales/el.yml +11 -4
  55. data/config/locales/en.yml +17 -10
  56. data/config/locales/es-419.yml +12 -5
  57. data/config/locales/es.yml +12 -5
  58. data/config/locales/et.yml +11 -4
  59. data/config/locales/fa.yml +11 -4
  60. data/config/locales/fi.yml +11 -4
  61. data/config/locales/fr.yml +11 -4
  62. data/config/locales/gd.yml +11 -4
  63. data/config/locales/gu.yml +11 -4
  64. data/config/locales/he.yml +11 -4
  65. data/config/locales/hi.yml +11 -4
  66. data/config/locales/hr.yml +11 -4
  67. data/config/locales/hu.yml +11 -4
  68. data/config/locales/hy.yml +11 -4
  69. data/config/locales/id.yml +11 -4
  70. data/config/locales/is.yml +11 -4
  71. data/config/locales/it.yml +11 -4
  72. data/config/locales/ja.yml +11 -4
  73. data/config/locales/ka.yml +11 -4
  74. data/config/locales/kk.yml +11 -4
  75. data/config/locales/ko.yml +11 -4
  76. data/config/locales/lt.yml +11 -4
  77. data/config/locales/lv.yml +11 -4
  78. data/config/locales/ms.yml +11 -4
  79. data/config/locales/mt.yml +11 -4
  80. data/config/locales/ne.yml +224 -0
  81. data/config/locales/nl.yml +11 -4
  82. data/config/locales/no.yml +11 -4
  83. data/config/locales/pa-pk.yml +11 -4
  84. data/config/locales/pa.yml +11 -4
  85. data/config/locales/pl.yml +11 -4
  86. data/config/locales/ps.yml +11 -4
  87. data/config/locales/pt.yml +11 -4
  88. data/config/locales/ro.yml +11 -4
  89. data/config/locales/ru.yml +11 -4
  90. data/config/locales/si.yml +11 -4
  91. data/config/locales/sk.yml +11 -4
  92. data/config/locales/sl.yml +11 -4
  93. data/config/locales/so.yml +11 -4
  94. data/config/locales/sq.yml +11 -4
  95. data/config/locales/sr.yml +11 -4
  96. data/config/locales/sv.yml +11 -4
  97. data/config/locales/sw.yml +11 -4
  98. data/config/locales/ta.yml +11 -4
  99. data/config/locales/th.yml +11 -4
  100. data/config/locales/tk.yml +11 -4
  101. data/config/locales/tr.yml +11 -4
  102. data/config/locales/uk.yml +11 -4
  103. data/config/locales/ur.yml +11 -4
  104. data/config/locales/uz.yml +11 -4
  105. data/config/locales/vi.yml +11 -4
  106. data/config/locales/zh-hk.yml +11 -4
  107. data/config/locales/zh-tw.yml +11 -4
  108. data/config/locales/zh.yml +11 -4
  109. data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +35 -26
  110. data/lib/govuk_publishing_components/config.rb +3 -0
  111. data/lib/govuk_publishing_components/presenters/attachment_helper.rb +2 -6
  112. data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +2 -2
  113. data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +14 -14
  114. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_organisations.rb +1 -1
  115. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons.rb +1 -1
  116. data/lib/govuk_publishing_components/presenters/content_item.rb +1 -3
  117. data/lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb +1 -1
  118. data/lib/govuk_publishing_components/presenters/machine_readable/government_service_schema.rb +2 -2
  119. data/lib/govuk_publishing_components/presenters/machine_readable/organisation_schema.rb +3 -3
  120. data/lib/govuk_publishing_components/presenters/meta_tags.rb +2 -2
  121. data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +1 -1
  122. data/lib/govuk_publishing_components/version.rb +1 -1
  123. data/node_modules/axe-core/README.md +2 -2
  124. data/node_modules/axe-core/axe.js +63 -46
  125. data/node_modules/axe-core/axe.min.js +3 -3
  126. data/node_modules/axe-core/locales/_template.json +1 -1
  127. data/node_modules/axe-core/locales/de.json +19 -19
  128. data/node_modules/axe-core/locales/ko.json +4 -4
  129. data/node_modules/axe-core/package.json +4 -3
  130. data/node_modules/axe-core/sri-history.json +4 -0
  131. metadata +20 -9
  132. data/app/assets/images/govuk_publishing_components/action-link-arrow--dark.png +0 -0
  133. data/app/assets/images/govuk_publishing_components/action-link-arrow--light.png +0 -0
  134. data/app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.png +0 -0
  135. data/app/assets/images/govuk_publishing_components/action-link-arrow--simple.png +0 -0
  136. data/app/assets/images/govuk_publishing_components/action-link-arrow.png +0 -0
  137. data/app/assets/images/govuk_publishing_components/search-button.png +0 -0
  138. data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +0 -29
@@ -27,6 +27,8 @@ uz:
27
27
  request_format_text: Ушбу файл ёрдамчи технологиялардан фойдаланаётган шахслар учун мос келмаслиги мумкин.
28
28
  back_link:
29
29
  back: Орқага
30
+ back_to_top_link:
31
+ contents: Мундарижа
30
32
  character_count:
31
33
  body: Сиз %{number} %{type} гача киритишингиз мумкин
32
34
  type:
@@ -89,6 +91,8 @@ uz:
89
91
  what_doing: Сиз нима қилаётган эдингиз?
90
92
  what_wrong: Қандай хатолик бўлди?
91
93
  'yes': Ҳа
94
+ figure:
95
+ image_credit: 'График материаллар тақдим этилган: %{credit}'
92
96
  intervention:
93
97
  accessible_link_text_suffix:
94
98
  layout_footer:
@@ -108,10 +112,7 @@ uz:
108
112
  manage:
109
113
  link_text:
110
114
  layout_header:
111
- hide_button: Излашни яшириш
112
115
  menu: Меню
113
- search_button: GOV.UK излаш
114
- show_button: Излашни кўрсатиш
115
116
  top_level: Юқори даража
116
117
  layout_super_navigation_header:
117
118
  logo_link_title:
@@ -124,7 +125,6 @@ uz:
124
125
  label:
125
126
  navigation_links_columns:
126
127
  navigation_menu_heading:
127
- navigation_search_heading:
128
128
  navigation_search_subheading:
129
129
  search_text:
130
130
  metadata:
@@ -160,6 +160,13 @@ uz:
160
160
  previous:
161
161
  print_link:
162
162
  text: Ушбу саҳифани чоп этиш
163
+ published_dates:
164
+ hidden_heading:
165
+ hide_all_updates: Барча янгиланишларни яшириш
166
+ last_updated: Сўнгги янгиланиш %{date}
167
+ published: Нашр қилинган %{date}
168
+ see_all_updates: Барча янгиланишларни кўриш
169
+ show_all_updates: янгиланишларни барчасини кўрсатиш
163
170
  radio:
164
171
  or: ёки
165
172
  related_footer_navigation:
@@ -26,6 +26,8 @@ vi:
26
26
  request_format_text: Tệp này có thể không phù hợp với người dùng công nghệ hỗ trợ.
27
27
  back_link:
28
28
  back: Quay lại
29
+ back_to_top_link:
30
+ contents: Mục lục
29
31
  character_count:
30
32
  body: Bạn có thể nhập tối đa %{number} %{type}
31
33
  type:
@@ -86,6 +88,8 @@ vi:
86
88
  what_doing: Bạn đang làm gì?
87
89
  what_wrong: Sự cố gì đã xảy ra?
88
90
  'yes': Có
91
+ figure:
92
+ image_credit: 'Nguồn hình ảnh: %{credit}'
89
93
  intervention:
90
94
  accessible_link_text_suffix:
91
95
  layout_footer:
@@ -105,10 +109,7 @@ vi:
105
109
  manage:
106
110
  link_text:
107
111
  layout_header:
108
- hide_button: Ẩn tìm kiếm
109
112
  menu: Menu
110
- search_button: Tìm kiếm trên GOV.UK
111
- show_button: Hiển thị tìm kiếm
112
113
  top_level: Mức cao nhất
113
114
  layout_super_navigation_header:
114
115
  logo_link_title:
@@ -121,7 +122,6 @@ vi:
121
122
  label:
122
123
  navigation_links_columns:
123
124
  navigation_menu_heading:
124
- navigation_search_heading:
125
125
  navigation_search_subheading:
126
126
  search_text:
127
127
  metadata:
@@ -157,6 +157,13 @@ vi:
157
157
  previous:
158
158
  print_link:
159
159
  text: In trang này
160
+ published_dates:
161
+ hidden_heading:
162
+ hide_all_updates: ẩn tất cả các cập nhật
163
+ last_updated: Lần cập nhật gần đây nhất %{date}
164
+ published: Ngày xuất bản %{date}
165
+ see_all_updates: xem tất cả nội dung cập nhật
166
+ show_all_updates: hiển thị tất cả nội dung cập nhật
160
167
  radio:
161
168
  or: hoặc
162
169
  related_footer_navigation:
@@ -26,6 +26,8 @@ zh-hk:
26
26
  request_format_text: 此文檔或許不適合輔助技術使用者。
27
27
  back_link:
28
28
  back: 返回
29
+ back_to_top_link:
30
+ contents: 內容
29
31
  character_count:
30
32
  body: 您最多可輸入 %{number} %{type}
31
33
  type:
@@ -85,6 +87,8 @@ zh-hk:
85
87
  what_doing: 您剛才在做什麼?
86
88
  what_wrong: 出現什麼錯誤?
87
89
  'yes': 是
90
+ figure:
91
+ image_credit: 圖片來源: %{credit}
88
92
  intervention:
89
93
  accessible_link_text_suffix:
90
94
  layout_footer:
@@ -104,10 +108,7 @@ zh-hk:
104
108
  manage:
105
109
  link_text:
106
110
  layout_header:
107
- hide_button: 隱藏搜尋項
108
111
  menu: 選單
109
- search_button: 搜尋 GOV.UK
110
- show_button: 顯示搜尋項
111
112
  top_level: 最高級別
112
113
  layout_super_navigation_header:
113
114
  logo_link_title:
@@ -120,7 +121,6 @@ zh-hk:
120
121
  label:
121
122
  navigation_links_columns:
122
123
  navigation_menu_heading:
123
- navigation_search_heading:
124
124
  navigation_search_subheading:
125
125
  search_text:
126
126
  metadata:
@@ -156,6 +156,13 @@ zh-hk:
156
156
  previous:
157
157
  print_link:
158
158
  text: 列印本頁面
159
+ published_dates:
160
+ hidden_heading:
161
+ hide_all_updates: 隱藏所有更新
162
+ last_updated: 最近更新 %{date}
163
+ published: 已發佈 %{date}
164
+ see_all_updates: 查看所有更新
165
+ show_all_updates: 顯示所有更新
159
166
  radio:
160
167
  or: 或
161
168
  related_footer_navigation:
@@ -26,6 +26,8 @@ zh-tw:
26
26
  request_format_text: 此文檔可能不適合輔助科技用戶。
27
27
  back_link:
28
28
  back: 返回
29
+ back_to_top_link:
30
+ contents: 內容
29
31
  character_count:
30
32
  body: 最多可以輸入 %{number} %{type}
31
33
  type:
@@ -85,6 +87,8 @@ zh-tw:
85
87
  what_doing: 你做了什麼?
86
88
  what_wrong: 哪出錯了?
87
89
  'yes': 是的
90
+ figure:
91
+ image_credit: 圖片來源: %{credit}
88
92
  intervention:
89
93
  accessible_link_text_suffix:
90
94
  layout_footer:
@@ -104,10 +108,7 @@ zh-tw:
104
108
  manage:
105
109
  link_text:
106
110
  layout_header:
107
- hide_button: 隱藏搜尋
108
111
  menu: 菜單
109
- search_button: 搜尋英國政府網站
110
- show_button: 展開搜尋
111
112
  top_level: 最高層
112
113
  layout_super_navigation_header:
113
114
  logo_link_title:
@@ -120,7 +121,6 @@ zh-tw:
120
121
  label:
121
122
  navigation_links_columns:
122
123
  navigation_menu_heading:
123
- navigation_search_heading:
124
124
  navigation_search_subheading:
125
125
  search_text:
126
126
  metadata:
@@ -156,6 +156,13 @@ zh-tw:
156
156
  previous:
157
157
  print_link:
158
158
  text: 列印此頁面
159
+ published_dates:
160
+ hidden_heading:
161
+ hide_all_updates: 隱藏所有更新
162
+ last_updated: 最後更新於 %{date}
163
+ published: 發布於 %{date}
164
+ see_all_updates: 查看所有更新
165
+ show_all_updates: 展開所有更新
159
166
  radio:
160
167
  or: 或
161
168
  related_footer_navigation:
@@ -26,6 +26,8 @@ zh:
26
26
  request_format_text: 此文件可能不适合辅助技术用户使用。
27
27
  back_link:
28
28
  back: 向后
29
+ back_to_top_link:
30
+ contents: 目录
29
31
  character_count:
30
32
  body: 您最多可以输入 %{number} 个 %{type}
31
33
  type:
@@ -85,6 +87,8 @@ zh:
85
87
  what_doing: 您在干什么?
86
88
  what_wrong: 发生了哪些错误?
87
89
  'yes': 是
90
+ figure:
91
+ image_credit: 图片提供:%{credit}
88
92
  intervention:
89
93
  accessible_link_text_suffix:
90
94
  layout_footer:
@@ -104,10 +108,7 @@ zh:
104
108
  manage:
105
109
  link_text:
106
110
  layout_header:
107
- hide_button: 隐藏搜索
108
111
  menu: 菜单
109
- search_button: 搜索GOV.UK
110
- show_button: 显示搜索
111
112
  top_level: 最高级
112
113
  layout_super_navigation_header:
113
114
  logo_link_title:
@@ -120,7 +121,6 @@ zh:
120
121
  label:
121
122
  navigation_links_columns:
122
123
  navigation_menu_heading:
123
- navigation_search_heading:
124
124
  navigation_search_subheading:
125
125
  search_text:
126
126
  metadata:
@@ -156,6 +156,13 @@ zh:
156
156
  previous:
157
157
  print_link:
158
158
  text: 打印本页面
159
+ published_dates:
160
+ hidden_heading:
161
+ hide_all_updates: 隐藏全部更新
162
+ last_updated: 上次更新 %{date}
163
+ published: 发布 %{date}
164
+ see_all_updates: 查看全部更新
165
+ show_all_updates: 显示全部更新
159
166
  radio:
160
167
  or: 或
161
168
  related_footer_navigation:
@@ -15,26 +15,25 @@ module GovukPublishingComponents
15
15
 
16
16
  # This is used to dedupe stylesheets.
17
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/_search-with-autocomplete.css
27
- govuk_publishing_components/components/_skip-link.css
28
- govuk_publishing_components/components/_textarea.css
29
- govuk_publishing_components/components/_title.css
30
-
31
- govuk_publishing_components/components/_cookie-banner.css
32
- govuk_publishing_components/components/_cross-service-header.css
33
- govuk_publishing_components/components/_feedback.css
34
- govuk_publishing_components/components/_layout-footer.css
35
- govuk_publishing_components/components/_layout-for-public.css
36
- govuk_publishing_components/components/_layout-header.css
37
- govuk_publishing_components/components/_layout-super-navigation-header.css
18
+ breadcrumbs
19
+ button
20
+ error-message
21
+ heading
22
+ hint
23
+ input
24
+ label
25
+ search
26
+ search-with-autocomplete
27
+ skip-link
28
+ textarea
29
+ title
30
+ cookie-banner
31
+ cross-service-header
32
+ feedback
33
+ layout-footer
34
+ layout-for-public
35
+ layout-header
36
+ layout-super-navigation-header
38
37
  ].freeze
39
38
 
40
39
  def add_stylesheet_path(component_path)
@@ -81,15 +80,25 @@ module GovukPublishingComponents
81
80
  private
82
81
 
83
82
  def is_already_used?(component)
84
- if GovukPublishingComponents::Config.exclude_css_from_static && !viewing_component_guide?
85
- all_component_stylesheets_being_used.include?(component) || STATIC_STYLESHEET_LIST.include?(component)
86
- else
87
- all_component_stylesheets_being_used.include?(component)
88
- end
83
+ (all_component_stylesheets_being_used + component_paths(css_exclude_list)).include?(component)
84
+ end
85
+
86
+ def css_exclude_list
87
+ return [] if viewing_component_guide?
88
+ return GovukPublishingComponents::Config.custom_css_exclude_list if GovukPublishingComponents::Config.custom_css_exclude_list&.any?
89
+ return STATIC_STYLESHEET_LIST if GovukPublishingComponents::Config.exclude_css_from_static
90
+
91
+ []
89
92
  end
90
93
 
91
94
  def viewing_component_guide?
92
- request&.path&.include?("/component-guide")
95
+ return false unless request
96
+
97
+ request.path.include?("/component-guide")
98
+ end
99
+
100
+ def component_paths(component_list)
101
+ component_list.map { |c| "govuk_publishing_components/components/_#{c}.css" }
93
102
  end
94
103
  end
95
104
  end
@@ -18,6 +18,9 @@ module GovukPublishingComponents
18
18
  mattr_accessor :application_javascript
19
19
  self.application_javascript = "application"
20
20
 
21
+ mattr_accessor :custom_css_exclude_list
22
+ self.custom_css_exclude_list = []
23
+
21
24
  mattr_accessor :exclude_css_from_static
22
25
  self.exclude_css_from_static = true
23
26
 
@@ -47,13 +47,9 @@ module GovukPublishingComponents
47
47
  )
48
48
  end
49
49
 
50
- def content_type_abbr
51
- content_type.abbr
52
- end
50
+ delegate :abbr, to: :content_type, prefix: true
53
51
 
54
- def content_type_name
55
- content_type.name
56
- end
52
+ delegate :name, to: :content_type, prefix: true
57
53
 
58
54
  def file_size
59
55
  attachment_data[:file_size]
@@ -64,7 +64,7 @@ module GovukPublishingComponents
64
64
  end
65
65
 
66
66
  def heading_markup
67
- return unless @heading.present?
67
+ return if @heading.blank?
68
68
 
69
69
  if @is_page_heading
70
70
  content_tag(
@@ -87,7 +87,7 @@ module GovukPublishingComponents
87
87
  checkbox_id = checkbox[:id] || "#{@id}-#{index}"
88
88
  controls = checkbox[:controls]
89
89
  aria_controls = "#{checkbox_id}-conditional-#{index || rand(1..100)}" if checkbox[:conditional].present?
90
- checkbox_name = checkbox[:name].present? ? checkbox[:name] : @name
90
+ checkbox_name = checkbox[:name].presence || @name
91
91
  checked = true if checkbox[:checked].present?
92
92
  data = checkbox[:data_attributes] || {}
93
93
  data[:controls] = controls
@@ -24,24 +24,24 @@ module GovukPublishingComponents
24
24
  def all_attributes
25
25
  attributes = {}
26
26
 
27
- attributes[:id] = @options[:id] unless @options[:id].blank?
28
- attributes[:data] = @options[:data_attributes] unless @options[:data_attributes].blank?
29
- attributes[:aria] = @options[:aria] unless @options[:aria].blank?
27
+ attributes[:id] = @options[:id] if @options[:id].present?
28
+ attributes[:data] = @options[:data_attributes] if @options[:data_attributes].present?
29
+ attributes[:aria] = @options[:aria] if @options[:aria].present?
30
30
 
31
31
  ((@options[:classes] ||= "") << " govuk-!-margin-bottom-#{@options[:margin_bottom]}").strip! if @options[:margin_bottom]
32
- attributes[:class] = @options[:classes] unless @options[:classes].blank?
32
+ attributes[:class] = @options[:classes] if @options[:classes].present?
33
33
 
34
- attributes[:role] = @options[:role] unless @options[:role].blank?
35
- attributes[:lang] = @options[:lang] unless @options[:lang].blank?
36
- attributes[:open] = @options[:open] unless @options[:open].blank?
34
+ attributes[:role] = @options[:role] if @options[:role].present?
35
+ attributes[:lang] = @options[:lang] if @options[:lang].present?
36
+ attributes[:open] = @options[:open] if @options[:open].present?
37
37
  attributes[:hidden] = @options[:hidden] unless @options[:hidden].nil?
38
- attributes[:tabindex] = @options[:tabindex] unless @options[:tabindex].blank?
39
- attributes[:dir] = @options[:dir] unless @options[:dir].blank?
40
- attributes[:type] = @options[:type] unless @options[:type].blank?
41
- attributes[:draggable] = @options[:draggable] unless @options[:draggable].blank?
42
- attributes[:rel] = @options[:rel] unless @options[:rel].blank?
43
- attributes[:target] = @options[:target] unless @options[:target].blank?
44
- attributes[:title] = @options[:title] unless @options[:title].blank?
38
+ attributes[:tabindex] = @options[:tabindex] if @options[:tabindex].present?
39
+ attributes[:dir] = @options[:dir] if @options[:dir].present?
40
+ attributes[:type] = @options[:type] if @options[:type].present?
41
+ attributes[:draggable] = @options[:draggable] if @options[:draggable].present?
42
+ attributes[:rel] = @options[:rel] if @options[:rel].present?
43
+ attributes[:target] = @options[:target] if @options[:target].present?
44
+ attributes[:title] = @options[:title] if @options[:title].present?
45
45
 
46
46
  attributes
47
47
  end
@@ -24,7 +24,7 @@ module GovukPublishingComponents
24
24
 
25
25
  def organisation_breadcrumbs_items
26
26
  first_related_organisation = ContentItem.new(content_item.related_organisations.first)
27
- return [] unless first_related_organisation.present?
27
+ return [] if first_related_organisation.blank?
28
28
 
29
29
  [{
30
30
  title: first_related_organisation.title,
@@ -14,7 +14,7 @@ module GovukPublishingComponents
14
14
  ordered_parents = all_parents.map.with_index do |parent, index|
15
15
  {
16
16
  title: parent.title,
17
- url: parent.url_override.present? ? parent.url_override : parent.base_path,
17
+ url: parent.url_override.presence || parent.base_path,
18
18
  is_page_parent: index.zero?,
19
19
  }
20
20
  end
@@ -124,9 +124,7 @@ module GovukPublishingComponents
124
124
  content_id == other.content_id
125
125
  end
126
126
 
127
- def hash
128
- content_id.hash
129
- end
127
+ delegate :hash, to: :content_id
130
128
 
131
129
  def eql?(other)
132
130
  self == other
@@ -29,7 +29,7 @@ module GovukPublishingComponents
29
29
  # Not all formats have a `body` - some have their content split over
30
30
  # multiple fields. In this case we'll skip the `articleBody` field
31
31
  def body
32
- return {} unless page.body.present?
32
+ return {} if page.body.blank?
33
33
 
34
34
  {
35
35
  "articleBody" => page.body,
@@ -25,7 +25,7 @@ module GovukPublishingComponents
25
25
  def related_services
26
26
  related_links = page.content_item.dig("links", "ordered_related_items")
27
27
 
28
- return {} unless related_links.present?
28
+ return {} if related_links.blank?
29
29
 
30
30
  {
31
31
  "isRelatedTo" => related_links.each_with_object([]) do |link, items|
@@ -43,7 +43,7 @@ module GovukPublishingComponents
43
43
  def provider
44
44
  organisations = page.content_item.dig("links", "organisations")
45
45
 
46
- return {} unless organisations.present?
46
+ return {} if organisations.blank?
47
47
 
48
48
  providers = organisations.map do |organisation|
49
49
  {
@@ -29,7 +29,7 @@ module GovukPublishingComponents
29
29
  private
30
30
 
31
31
  def members
32
- return {} unless ministers.present?
32
+ return {} if ministers.blank?
33
33
 
34
34
  members = ministers_with_grouped_roles.map do |person, roles|
35
35
  person.merge("hasOccupation" => roles)
@@ -67,7 +67,7 @@ module GovukPublishingComponents
67
67
  end
68
68
 
69
69
  def role_for_minister(minister)
70
- return {} unless minister["role"].present?
70
+ return {} if minister["role"].blank?
71
71
 
72
72
  {
73
73
  "@type" => "Role",
@@ -108,7 +108,7 @@ module GovukPublishingComponents
108
108
  def related_organisations(link_type, schema_name)
109
109
  organisations = page.content_item.dig("links", link_type)
110
110
 
111
- return {} unless organisations.present?
111
+ return {} if organisations.blank?
112
112
 
113
113
  related_orgs = organisations.map do |org|
114
114
  page = Page.new(content_item: org)
@@ -47,8 +47,8 @@ module GovukPublishingComponents
47
47
  meta_tags["govuk:updated-at"] = content_item[:updated_at] if content_item[:updated_at]
48
48
  meta_tags["govuk:public-updated-at"] = content_item[:public_updated_at] if content_item[:public_updated_at]
49
49
  primary_publisher = content_item.dig(:links, :primary_publishing_organisation)
50
- primary_publisher = primary_publisher.first[:title] unless primary_publisher.blank?
51
- meta_tags["govuk:primary-publishing-organisation"] = primary_publisher unless primary_publisher.blank?
50
+ primary_publisher = primary_publisher.first[:title] if primary_publisher.present?
51
+ meta_tags["govuk:primary-publishing-organisation"] = primary_publisher if primary_publisher.present?
52
52
 
53
53
  # Some browse topics are nested in the content item, we want to grab these for GA4 tracking.
54
54
  ga4_browse_topic = content_item.dig(:links, :ordered_related_items, 0, :links, :mainstream_browse_pages, 0, :links, :parent, 0, :title)
@@ -140,7 +140,7 @@ module GovukPublishingComponents
140
140
  end
141
141
 
142
142
  def active_step_nav_content_id
143
- @active_step_nav_content_id ||= @query_parameters["step-by-step-nav"].present? ? @query_parameters["step-by-step-nav"] : nil
143
+ @active_step_nav_content_id ||= @query_parameters["step-by-step-nav"].presence
144
144
  end
145
145
 
146
146
  def steps
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "54.0.0".freeze
2
+ VERSION = "55.0.0".freeze
3
3
  end
@@ -14,7 +14,7 @@ Axe is an accessibility testing engine for websites and other HTML-based user in
14
14
 
15
15
  ## The Accessibility Rules
16
16
 
17
- Axe-core has different types of rules, for WCAG 2.0, 2.1, 2.2 on level A, AA and AAA as well as a number of best practices that help you identify common accessibility practices like ensuring every page has an `h1` heading, and to help you avoid "gotchas" in ARIA like where an ARIA attribute you used will get ignored. The complete list of rules, grouped WCAG level and best practice, can found in [doc/rule-descriptions.md](./doc/rule-descriptions.md).
17
+ Axe-core has different types of rules, for WCAG 2.0, 2.1, 2.2 on level A, AA and AAA as well as a number of best practices that help you identify common accessibility practices like ensuring every page has an `h1` heading, and to help you avoid "gotchas" in ARIA like where an ARIA attribute you used will get ignored. The complete list of rules, grouped WCAG level and best practice, can be found in [doc/rule-descriptions.md](./doc/rule-descriptions.md).
18
18
 
19
19
  With axe-core, you can find **on average 57% of WCAG issues automatically**. Additionally, axe-core will return elements as "incomplete" where axe-core could not be certain, and manual review is needed.
20
20
 
@@ -65,7 +65,7 @@ Axe was built to reflect how web development actually works. It works with all m
65
65
  - It's actively supported by [Deque Systems](https://www.deque.com), a major accessibility vendor.
66
66
  - It integrates with your existing functional/acceptance automated tests.
67
67
  - It automatically determines which rules to run based on the evaluation context.
68
- - Axe supports in-memory fixtures, static fixtures, integration tests and iframes of infinite depth.
68
+ - Axe supports in-memory fixtures, static fixtures, integration tests, and iframes of infinite depth.
69
69
  - Axe is highly configurable.
70
70
 
71
71
  ## Supported Browsers