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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +3 -3
  3. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +1 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +2 -1
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +102 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +1 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -1
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +1 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/print/_cards.scss +4 -0
  11. data/app/models/govuk_publishing_components/component_docs.rb +4 -1
  12. data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -1
  13. data/app/views/govuk_publishing_components/components/_cards.html.erb +62 -0
  14. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +4 -0
  15. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +27 -0
  16. data/app/views/govuk_publishing_components/components/docs/attachment.yml +11 -0
  17. data/app/views/govuk_publishing_components/components/docs/cards.yml +139 -0
  18. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +18 -0
  19. data/config/locales/ar.yml +4 -0
  20. data/config/locales/az.yml +4 -0
  21. data/config/locales/be.yml +4 -0
  22. data/config/locales/bg.yml +4 -0
  23. data/config/locales/bn.yml +4 -0
  24. data/config/locales/cs.yml +4 -0
  25. data/config/locales/cy.yml +4 -0
  26. data/config/locales/da.yml +4 -0
  27. data/config/locales/de.yml +4 -0
  28. data/config/locales/dr.yml +4 -0
  29. data/config/locales/el.yml +4 -0
  30. data/config/locales/en.yml +4 -0
  31. data/config/locales/es-419.yml +4 -0
  32. data/config/locales/es.yml +4 -0
  33. data/config/locales/et.yml +4 -0
  34. data/config/locales/fa.yml +4 -0
  35. data/config/locales/fi.yml +4 -0
  36. data/config/locales/fr.yml +4 -0
  37. data/config/locales/gd.yml +4 -0
  38. data/config/locales/gu.yml +4 -0
  39. data/config/locales/he.yml +4 -0
  40. data/config/locales/hi.yml +4 -0
  41. data/config/locales/hr.yml +4 -0
  42. data/config/locales/hu.yml +4 -0
  43. data/config/locales/hy.yml +4 -0
  44. data/config/locales/id.yml +4 -0
  45. data/config/locales/is.yml +4 -0
  46. data/config/locales/it.yml +4 -0
  47. data/config/locales/ja.yml +4 -0
  48. data/config/locales/ka.yml +4 -0
  49. data/config/locales/kk.yml +4 -0
  50. data/config/locales/ko.yml +4 -0
  51. data/config/locales/lt.yml +4 -0
  52. data/config/locales/lv.yml +4 -0
  53. data/config/locales/ms.yml +4 -0
  54. data/config/locales/mt.yml +4 -0
  55. data/config/locales/nl.yml +4 -0
  56. data/config/locales/no.yml +4 -0
  57. data/config/locales/pa-pk.yml +4 -0
  58. data/config/locales/pa.yml +4 -0
  59. data/config/locales/pl.yml +4 -0
  60. data/config/locales/ps.yml +4 -0
  61. data/config/locales/pt.yml +4 -0
  62. data/config/locales/ro.yml +4 -0
  63. data/config/locales/ru.yml +4 -0
  64. data/config/locales/si.yml +4 -0
  65. data/config/locales/sk.yml +4 -0
  66. data/config/locales/sl.yml +4 -0
  67. data/config/locales/so.yml +4 -0
  68. data/config/locales/sq.yml +4 -0
  69. data/config/locales/sr.yml +4 -0
  70. data/config/locales/sv.yml +4 -0
  71. data/config/locales/sw.yml +4 -0
  72. data/config/locales/ta.yml +4 -0
  73. data/config/locales/th.yml +4 -0
  74. data/config/locales/tk.yml +4 -0
  75. data/config/locales/tr.yml +4 -0
  76. data/config/locales/uk.yml +4 -0
  77. data/config/locales/ur.yml +4 -0
  78. data/config/locales/uz.yml +4 -0
  79. data/config/locales/vi.yml +4 -0
  80. data/config/locales/zh-hk.yml +4 -0
  81. data/config/locales/zh-tw.yml +4 -0
  82. data/config/locales/zh.yml +4 -0
  83. data/lib/govuk_publishing_components/presenters/attachment.rb +23 -0
  84. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +16 -0
  85. data/lib/govuk_publishing_components/version.rb +1 -1
  86. 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
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "28.7.1".freeze
2
+ VERSION = "28.9.0".freeze
3
3
  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.7.1
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-02 00:00:00.000000000 Z
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