govuk_publishing_components 28.7.1 → 28.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +2 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +102 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_cards.scss +4 -0
- data/app/models/govuk_publishing_components/component_docs.rb +4 -1
- data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_cards.html.erb +62 -0
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +4 -0
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +27 -0
- data/app/views/govuk_publishing_components/components/docs/attachment.yml +11 -0
- data/app/views/govuk_publishing_components/components/docs/cards.yml +139 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +18 -0
- data/config/locales/ar.yml +4 -0
- data/config/locales/az.yml +4 -0
- data/config/locales/be.yml +4 -0
- data/config/locales/bg.yml +4 -0
- data/config/locales/bn.yml +4 -0
- data/config/locales/cs.yml +4 -0
- data/config/locales/cy.yml +4 -0
- data/config/locales/da.yml +4 -0
- data/config/locales/de.yml +4 -0
- data/config/locales/dr.yml +4 -0
- data/config/locales/el.yml +4 -0
- data/config/locales/en.yml +4 -0
- data/config/locales/es-419.yml +4 -0
- data/config/locales/es.yml +4 -0
- data/config/locales/et.yml +4 -0
- data/config/locales/fa.yml +4 -0
- data/config/locales/fi.yml +4 -0
- data/config/locales/fr.yml +4 -0
- data/config/locales/gd.yml +4 -0
- data/config/locales/gu.yml +4 -0
- data/config/locales/he.yml +4 -0
- data/config/locales/hi.yml +4 -0
- data/config/locales/hr.yml +4 -0
- data/config/locales/hu.yml +4 -0
- data/config/locales/hy.yml +4 -0
- data/config/locales/id.yml +4 -0
- data/config/locales/is.yml +4 -0
- data/config/locales/it.yml +4 -0
- data/config/locales/ja.yml +4 -0
- data/config/locales/ka.yml +4 -0
- data/config/locales/kk.yml +4 -0
- data/config/locales/ko.yml +4 -0
- data/config/locales/lt.yml +4 -0
- data/config/locales/lv.yml +4 -0
- data/config/locales/ms.yml +4 -0
- data/config/locales/mt.yml +4 -0
- data/config/locales/nl.yml +4 -0
- data/config/locales/no.yml +4 -0
- data/config/locales/pa-pk.yml +4 -0
- data/config/locales/pa.yml +4 -0
- data/config/locales/pl.yml +4 -0
- data/config/locales/ps.yml +4 -0
- data/config/locales/pt.yml +4 -0
- data/config/locales/ro.yml +4 -0
- data/config/locales/ru.yml +4 -0
- data/config/locales/si.yml +4 -0
- data/config/locales/sk.yml +4 -0
- data/config/locales/sl.yml +4 -0
- data/config/locales/so.yml +4 -0
- data/config/locales/sq.yml +4 -0
- data/config/locales/sr.yml +4 -0
- data/config/locales/sv.yml +4 -0
- data/config/locales/sw.yml +4 -0
- data/config/locales/ta.yml +4 -0
- data/config/locales/th.yml +4 -0
- data/config/locales/tk.yml +4 -0
- data/config/locales/tr.yml +4 -0
- data/config/locales/uk.yml +4 -0
- data/config/locales/ur.yml +4 -0
- data/config/locales/uz.yml +4 -0
- data/config/locales/vi.yml +4 -0
- data/config/locales/zh-hk.yml +4 -0
- data/config/locales/zh-tw.yml +4 -0
- data/config/locales/zh.yml +4 -0
- data/lib/govuk_publishing_components/presenters/attachment.rb +23 -0
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +16 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +7 -16
@@ -1,6 +1,16 @@
|
|
1
1
|
module GovukPublishingComponents
|
2
2
|
module Presenters
|
3
3
|
class Attachment
|
4
|
+
# DfE, DWP, DHSC, HMRC, DVSA and PHE are taking part in a pilot to use a form
|
5
|
+
# rather than direct email for users to request accessible formats. When the pilot
|
6
|
+
# scheme is rolled out further this can be removed.
|
7
|
+
EMAILS_IN_ACCESSIBLE_FORMAT_REQUEST_PILOT = %w[alternative.formats@education.gov.uk
|
8
|
+
accessible.formats@dwp.gov.uk
|
9
|
+
publications@dhsc.gov.uk
|
10
|
+
different.format@hmrc.gov.uk
|
11
|
+
gov.uk.publishing@dvsa.gov.uk
|
12
|
+
publications@phe.gov.uk].freeze
|
13
|
+
|
4
14
|
delegate :opendocument?, :document?, :spreadsheet?, to: :content_type
|
5
15
|
|
6
16
|
attr_reader :attachment_data
|
@@ -8,6 +18,7 @@ module GovukPublishingComponents
|
|
8
18
|
# Expects a hash of attachment data
|
9
19
|
# * title and url are required
|
10
20
|
# * content_type, filename, file_size, number of pages, alternative_format_contact_email can be provided
|
21
|
+
# * attachment_id and owning_document_content_id are required to use the accessible format request form
|
11
22
|
def initialize(attachment_data)
|
12
23
|
@attachment_data = attachment_data.with_indifferent_access
|
13
24
|
end
|
@@ -47,6 +58,14 @@ module GovukPublishingComponents
|
|
47
58
|
attachment_data[:alternative_format_contact_email]
|
48
59
|
end
|
49
60
|
|
61
|
+
def attachment_id
|
62
|
+
attachment_data[:attachment_id]
|
63
|
+
end
|
64
|
+
|
65
|
+
def owning_document_content_id
|
66
|
+
attachment_data[:owning_document_content_id]
|
67
|
+
end
|
68
|
+
|
50
69
|
def reference
|
51
70
|
reference = []
|
52
71
|
reference << "ISBN #{attachment_data[:isbn]}" if attachment_data[:isbn].present?
|
@@ -71,6 +90,10 @@ module GovukPublishingComponents
|
|
71
90
|
attachment_data[:command_paper_number].present? || attachment_data[:hoc_paper_number].present? || attachment_data[:unnumbered_command_paper].eql?(true) || attachment_data[:unnumbered_hoc_paper].eql?(true)
|
72
91
|
end
|
73
92
|
|
93
|
+
def display_accessible_format_request_form_link?
|
94
|
+
EMAILS_IN_ACCESSIBLE_FORMAT_REQUEST_PILOT.include?(alternative_format_contact_email) && owning_document_content_id.present? && attachment_id.present?
|
95
|
+
end
|
96
|
+
|
74
97
|
class SupportedContentType
|
75
98
|
attr_reader :content_type_data
|
76
99
|
|
@@ -166,6 +166,22 @@ module GovukPublishingComponents
|
|
166
166
|
step_nav_helper.show_also_part_of_step_nav?
|
167
167
|
end
|
168
168
|
|
169
|
+
def content_tagged_to_ukraine_topical_event?
|
170
|
+
ukraine_topical_event_id = "bfa79635-ffda-4b5d-8266-a9cd3a03649c"
|
171
|
+
topical_events = content_item.dig("links", "topical_events").to_a
|
172
|
+
topical_events.each do |topical_event|
|
173
|
+
if topical_event["content_id"].eql?(ukraine_topical_event_id)
|
174
|
+
return true
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
false
|
179
|
+
end
|
180
|
+
|
181
|
+
def show_ukraine_cta?
|
182
|
+
content_tagged_to_ukraine_topical_event?
|
183
|
+
end
|
184
|
+
|
169
185
|
def breadcrumbs_based_on_ancestors
|
170
186
|
ContentBreadcrumbsBasedOnAncestors.call(content_item)
|
171
187
|
end
|
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: 28.
|
4
|
+
version: 28.9.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: 2022-03-
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: psych
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '4'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '4'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rails
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -529,6 +515,7 @@ files:
|
|
529
515
|
- app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss
|
530
516
|
- app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss
|
531
517
|
- app/assets/stylesheets/govuk_publishing_components/components/_button.scss
|
518
|
+
- app/assets/stylesheets/govuk_publishing_components/components/_cards.scss
|
532
519
|
- app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss
|
533
520
|
- app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss
|
534
521
|
- app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss
|
@@ -626,6 +613,7 @@ files:
|
|
626
613
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_prefixed-transform.scss
|
627
614
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss
|
628
615
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_button.scss
|
616
|
+
- app/assets/stylesheets/govuk_publishing_components/components/print/_cards.scss
|
629
617
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_contents-list.scss
|
630
618
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak-html-publication.scss
|
631
619
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss
|
@@ -667,6 +655,7 @@ files:
|
|
667
655
|
- app/views/govuk_publishing_components/components/_big_number.html.erb
|
668
656
|
- app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
|
669
657
|
- app/views/govuk_publishing_components/components/_button.html.erb
|
658
|
+
- app/views/govuk_publishing_components/components/_cards.html.erb
|
670
659
|
- app/views/govuk_publishing_components/components/_character_count.html.erb
|
671
660
|
- app/views/govuk_publishing_components/components/_checkboxes.html.erb
|
672
661
|
- app/views/govuk_publishing_components/components/_contents_list.html.erb
|
@@ -740,6 +729,7 @@ files:
|
|
740
729
|
- app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.html.erb
|
741
730
|
- app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb
|
742
731
|
- app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb
|
732
|
+
- app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb
|
743
733
|
- app/views/govuk_publishing_components/components/docs/accordion.yml
|
744
734
|
- app/views/govuk_publishing_components/components/docs/action_link.yml
|
745
735
|
- app/views/govuk_publishing_components/components/docs/attachment.yml
|
@@ -748,6 +738,7 @@ files:
|
|
748
738
|
- app/views/govuk_publishing_components/components/docs/big_number.yml
|
749
739
|
- app/views/govuk_publishing_components/components/docs/breadcrumbs.yml
|
750
740
|
- app/views/govuk_publishing_components/components/docs/button.yml
|
741
|
+
- app/views/govuk_publishing_components/components/docs/cards.yml
|
751
742
|
- app/views/govuk_publishing_components/components/docs/character_count.yml
|
752
743
|
- app/views/govuk_publishing_components/components/docs/checkboxes.yml
|
753
744
|
- app/views/govuk_publishing_components/components/docs/contents_list.yml
|