govuk_publishing_components 53.0.0 → 54.0.1
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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +25 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +5 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +4 -18
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_call-to-action.scss +3 -12
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_example.scss +2 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +2 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_form-download.scss +1 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_images.scss +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_information-callout.scss +2 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_legislative-list.scss +1 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_media-player.scss +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +1 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss +1 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +2 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +15 -55
- data/app/controllers/govuk_publishing_components/audit_controller.rb +1 -0
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +1 -1
- data/app/models/govuk_publishing_components/audit_applications.rb +1 -1
- data/app/models/govuk_publishing_components/audit_comparer.rb +1 -1
- data/app/models/govuk_publishing_components/audit_components.rb +1 -1
- data/app/views/govuk_publishing_components/components/_attachment.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -6
- data/app/views/govuk_publishing_components/components/_govspeak.html.erb +3 -0
- data/app/views/govuk_publishing_components/components/_heading.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +6 -21
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +0 -3
- data/app/views/govuk_publishing_components/components/_radio.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +7 -4
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +0 -2
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +0 -4
- data/config/locales/ar.yml +0 -1
- data/config/locales/az.yml +0 -1
- data/config/locales/be.yml +0 -1
- data/config/locales/bg.yml +0 -1
- data/config/locales/bn.yml +0 -1
- data/config/locales/cs.yml +0 -1
- data/config/locales/cy.yml +0 -1
- data/config/locales/da.yml +0 -1
- data/config/locales/de.yml +0 -1
- data/config/locales/dr.yml +0 -1
- data/config/locales/el.yml +0 -1
- data/config/locales/en.yml +6 -7
- data/config/locales/es-419.yml +1 -2
- data/config/locales/es.yml +1 -2
- data/config/locales/et.yml +0 -1
- data/config/locales/fa.yml +0 -1
- data/config/locales/fi.yml +0 -1
- data/config/locales/fr.yml +0 -1
- data/config/locales/gd.yml +0 -1
- data/config/locales/gu.yml +0 -1
- data/config/locales/he.yml +0 -1
- data/config/locales/hi.yml +0 -1
- data/config/locales/hr.yml +0 -1
- data/config/locales/hu.yml +0 -1
- data/config/locales/hy.yml +0 -1
- data/config/locales/id.yml +0 -1
- data/config/locales/is.yml +0 -1
- data/config/locales/it.yml +0 -1
- data/config/locales/ja.yml +0 -1
- data/config/locales/ka.yml +0 -1
- data/config/locales/kk.yml +0 -1
- data/config/locales/ko.yml +0 -1
- data/config/locales/lt.yml +0 -1
- data/config/locales/lv.yml +0 -1
- data/config/locales/ms.yml +0 -1
- data/config/locales/mt.yml +0 -1
- data/config/locales/nl.yml +0 -1
- data/config/locales/no.yml +0 -1
- data/config/locales/pa-pk.yml +0 -1
- data/config/locales/pa.yml +0 -1
- data/config/locales/pl.yml +0 -1
- data/config/locales/ps.yml +0 -1
- data/config/locales/pt.yml +0 -1
- data/config/locales/ro.yml +0 -1
- data/config/locales/ru.yml +0 -1
- data/config/locales/si.yml +0 -1
- data/config/locales/sk.yml +0 -1
- data/config/locales/sl.yml +0 -1
- data/config/locales/so.yml +0 -1
- data/config/locales/sq.yml +0 -1
- data/config/locales/sr.yml +0 -1
- data/config/locales/sv.yml +0 -1
- data/config/locales/sw.yml +0 -1
- data/config/locales/ta.yml +0 -1
- data/config/locales/th.yml +0 -1
- data/config/locales/tk.yml +0 -1
- data/config/locales/tr.yml +0 -1
- data/config/locales/uk.yml +0 -1
- data/config/locales/ur.yml +0 -1
- data/config/locales/uz.yml +0 -1
- data/config/locales/vi.yml +0 -1
- data/config/locales/zh-hk.yml +0 -1
- data/config/locales/zh-tw.yml +0 -1
- data/config/locales/zh.yml +0 -1
- data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +35 -26
- data/lib/govuk_publishing_components/config.rb +3 -0
- data/lib/govuk_publishing_components/presenters/attachment_helper.rb +2 -6
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +2 -2
- data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +14 -14
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_organisations.rb +1 -1
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons.rb +1 -1
- data/lib/govuk_publishing_components/presenters/content_item.rb +1 -3
- data/lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb +1 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/government_service_schema.rb +2 -2
- data/lib/govuk_publishing_components/presenters/machine_readable/organisation_schema.rb +3 -3
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +2 -2
- data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
data/config/locales/ta.yml
CHANGED
data/config/locales/th.yml
CHANGED
data/config/locales/tk.yml
CHANGED
data/config/locales/tr.yml
CHANGED
data/config/locales/uk.yml
CHANGED
data/config/locales/ur.yml
CHANGED
data/config/locales/uz.yml
CHANGED
data/config/locales/vi.yml
CHANGED
data/config/locales/zh-hk.yml
CHANGED
data/config/locales/zh-tw.yml
CHANGED
data/config/locales/zh.yml
CHANGED
@@ -15,26 +15,25 @@ module GovukPublishingComponents
|
|
15
15
|
|
16
16
|
# This is used to dedupe stylesheets.
|
17
17
|
STATIC_STYLESHEET_LIST = %w[
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
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
|
-
|
51
|
-
content_type.abbr
|
52
|
-
end
|
50
|
+
delegate :abbr, to: :content_type, prefix: true
|
53
51
|
|
54
|
-
|
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
|
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].
|
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]
|
28
|
-
attributes[:data] = @options[:data_attributes]
|
29
|
-
attributes[:aria] = @options[:aria]
|
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]
|
32
|
+
attributes[:class] = @options[:classes] if @options[:classes].present?
|
33
33
|
|
34
|
-
attributes[:role] = @options[:role]
|
35
|
-
attributes[:lang] = @options[:lang]
|
36
|
-
attributes[:open] = @options[:open]
|
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]
|
39
|
-
attributes[:dir] = @options[:dir]
|
40
|
-
attributes[:type] = @options[:type]
|
41
|
-
attributes[:draggable] = @options[:draggable]
|
42
|
-
attributes[:rel] = @options[:rel]
|
43
|
-
attributes[:target] = @options[:target]
|
44
|
-
attributes[:title] = @options[:title]
|
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
|
data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_organisations.rb
CHANGED
@@ -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 []
|
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.
|
17
|
+
url: parent.url_override.presence || parent.base_path,
|
18
18
|
is_page_parent: index.zero?,
|
19
19
|
}
|
20
20
|
end
|
@@ -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 {}
|
32
|
+
return {} if page.body.blank?
|
33
33
|
|
34
34
|
{
|
35
35
|
"articleBody" => page.body,
|
data/lib/govuk_publishing_components/presenters/machine_readable/government_service_schema.rb
CHANGED
@@ -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 {}
|
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 {}
|
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 {}
|
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 {}
|
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 {}
|
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]
|
51
|
-
meta_tags["govuk:primary-publishing-organisation"] = primary_publisher
|
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"].
|
143
|
+
@active_step_nav_content_id ||= @query_parameters["step-by-step-nav"].presence
|
144
144
|
end
|
145
145
|
|
146
146
|
def steps
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 54.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-05 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: govuk_app_config
|