govuk_publishing_components 62.3.0 → 63.1.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 (98) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/add-another.js +141 -10
  3. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -1
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_add-another.scss +18 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_figure.scss +10 -32
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +0 -47
  7. data/app/assets/stylesheets/govuk_publishing_components/components/{_previous-and-next-navigation.scss → _pagination.scss} +1 -1
  8. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_images.scss +10 -8
  9. data/app/views/govuk_publishing_components/components/_add_another.html.erb +10 -0
  10. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +2 -1
  11. data/app/views/govuk_publishing_components/components/_figure.html.erb +1 -0
  12. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -2
  13. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +15 -9
  14. data/app/views/govuk_publishing_components/components/_pagination.html.erb +21 -0
  15. data/app/views/govuk_publishing_components/components/docs/add_another.yml +46 -0
  16. data/app/views/govuk_publishing_components/components/docs/figure.yml +16 -15
  17. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +2 -0
  18. data/app/views/govuk_publishing_components/components/docs/image_card.yml +0 -23
  19. data/app/views/govuk_publishing_components/components/docs/{previous_and_next_navigation.yml → pagination.yml} +68 -13
  20. data/config/locales/ar.yml +1 -1
  21. data/config/locales/az.yml +1 -1
  22. data/config/locales/be.yml +1 -1
  23. data/config/locales/bg.yml +1 -1
  24. data/config/locales/bn.yml +1 -1
  25. data/config/locales/cs.yml +1 -1
  26. data/config/locales/cy.yml +2 -2
  27. data/config/locales/da.yml +1 -1
  28. data/config/locales/de.yml +1 -1
  29. data/config/locales/dr.yml +1 -1
  30. data/config/locales/el.yml +1 -1
  31. data/config/locales/en.yml +1 -1
  32. data/config/locales/es-419.yml +1 -1
  33. data/config/locales/es.yml +1 -1
  34. data/config/locales/et.yml +1 -1
  35. data/config/locales/fa.yml +1 -1
  36. data/config/locales/fi.yml +1 -1
  37. data/config/locales/fr.yml +1 -1
  38. data/config/locales/gd.yml +1 -1
  39. data/config/locales/gu.yml +1 -1
  40. data/config/locales/he.yml +1 -1
  41. data/config/locales/hi.yml +1 -1
  42. data/config/locales/hr.yml +1 -1
  43. data/config/locales/hu.yml +1 -1
  44. data/config/locales/hy.yml +1 -1
  45. data/config/locales/id.yml +1 -1
  46. data/config/locales/is.yml +1 -1
  47. data/config/locales/it.yml +1 -1
  48. data/config/locales/ja.yml +1 -1
  49. data/config/locales/ka.yml +1 -1
  50. data/config/locales/kk.yml +1 -1
  51. data/config/locales/ko.yml +1 -1
  52. data/config/locales/ku.yml +1 -1
  53. data/config/locales/ky.yml +1 -1
  54. data/config/locales/lt.yml +1 -1
  55. data/config/locales/lv.yml +1 -1
  56. data/config/locales/ms.yml +1 -1
  57. data/config/locales/mt.yml +1 -1
  58. data/config/locales/ne.yml +1 -1
  59. data/config/locales/nl.yml +1 -1
  60. data/config/locales/no.yml +1 -1
  61. data/config/locales/pa-pk.yml +1 -1
  62. data/config/locales/pa.yml +1 -1
  63. data/config/locales/pl.yml +1 -1
  64. data/config/locales/ps.yml +1 -1
  65. data/config/locales/pt.yml +1 -1
  66. data/config/locales/ro.yml +1 -1
  67. data/config/locales/ru.yml +1 -1
  68. data/config/locales/si.yml +1 -1
  69. data/config/locales/sk.yml +1 -1
  70. data/config/locales/sl.yml +1 -1
  71. data/config/locales/so.yml +1 -1
  72. data/config/locales/sq.yml +1 -1
  73. data/config/locales/sr.yml +1 -1
  74. data/config/locales/sv.yml +1 -1
  75. data/config/locales/sw.yml +1 -1
  76. data/config/locales/ta.yml +1 -1
  77. data/config/locales/th.yml +1 -1
  78. data/config/locales/ti.yml +1 -1
  79. data/config/locales/tk.yml +1 -1
  80. data/config/locales/tr.yml +1 -1
  81. data/config/locales/uk.yml +1 -1
  82. data/config/locales/ur.yml +1 -1
  83. data/config/locales/uz.yml +1 -1
  84. data/config/locales/vi.yml +1 -1
  85. data/config/locales/zh-hk.yml +1 -1
  86. data/config/locales/zh-tw.yml +1 -1
  87. data/config/locales/zh.yml +1 -1
  88. data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +3 -0
  89. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +8 -68
  90. data/lib/govuk_publishing_components/presenters/pagination_helper.rb +130 -0
  91. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +16 -4
  92. data/lib/govuk_publishing_components/version.rb +1 -1
  93. data/lib/govuk_publishing_components.rb +1 -0
  94. metadata +6 -8
  95. data/app/assets/images/govuk_publishing_components/youtube-play-icon.png +0 -0
  96. data/app/assets/images/govuk_publishing_components/youtube-play-icon.svg +0 -4
  97. data/app/assets/javascripts/govuk_publishing_components/components/image-card.js +0 -19
  98. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -73
@@ -167,7 +167,7 @@ ru:
167
167
  label:
168
168
  password_hidden_announcement:
169
169
  password_shown_announcement:
170
- previous_and_next_navigation:
170
+ pagination:
171
171
  next:
172
172
  pagination: Разбивка
173
173
  previous:
@@ -163,7 +163,7 @@ si:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: පිටු අංකය
169
169
  previous:
@@ -168,7 +168,7 @@ sk:
168
168
  label:
169
169
  password_hidden_announcement:
170
170
  password_shown_announcement:
171
- previous_and_next_navigation:
171
+ pagination:
172
172
  next:
173
173
  pagination: Stránkovanie
174
174
  previous:
@@ -170,7 +170,7 @@ sl:
170
170
  label:
171
171
  password_hidden_announcement:
172
172
  password_shown_announcement:
173
- previous_and_next_navigation:
173
+ pagination:
174
174
  next:
175
175
  pagination: Oštevilčenje
176
176
  previous:
@@ -163,7 +163,7 @@ so:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Lambar siinta boga
169
169
  previous:
@@ -163,7 +163,7 @@ sq:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Numërtimi
169
169
  previous:
@@ -164,7 +164,7 @@ sr:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: Broj stranice
170
170
  previous:
@@ -163,7 +163,7 @@ sv:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Paginering
169
169
  previous:
@@ -163,7 +163,7 @@ sw:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Nambari za kurasa
169
169
  previous:
@@ -164,7 +164,7 @@ ta:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: பக்கமிடுதல்
170
170
  previous:
@@ -161,7 +161,7 @@ th:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: การแบ่งหน้า
167
167
  previous:
@@ -162,7 +162,7 @@ ti:
162
162
  label: መሕለፊ ቓል/ፓስዎርድ
163
163
  password_hidden_announcement: መሕለፊ ቓል/ፓስዎርድካ ተሓቢኡ ኣሎ
164
164
  password_shown_announcement: መሕለፊ ቓል/ፓስዎርድካ ይርአ ኣሎ
165
- previous_and_next_navigation:
165
+ pagination:
166
166
  next: ዝቅጽል
167
167
  pagination: ገጻት ምግባር
168
168
  previous: ዝሓለፈ
@@ -164,7 +164,7 @@ tk:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: Sahypa
170
170
  previous:
@@ -164,7 +164,7 @@ tr:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: Sayfa
170
170
  previous:
@@ -170,7 +170,7 @@ uk:
170
170
  label:
171
171
  password_hidden_announcement:
172
172
  password_shown_announcement:
173
- previous_and_next_navigation:
173
+ pagination:
174
174
  next:
175
175
  pagination: Поділ на сторінки
176
176
  previous:
@@ -160,7 +160,7 @@ ur:
160
160
  label:
161
161
  password_hidden_announcement:
162
162
  password_shown_announcement:
163
- previous_and_next_navigation:
163
+ pagination:
164
164
  next:
165
165
  pagination: صفحہ بندی
166
166
  previous:
@@ -165,7 +165,7 @@ uz:
165
165
  label:
166
166
  password_hidden_announcement:
167
167
  password_shown_announcement:
168
- previous_and_next_navigation:
168
+ pagination:
169
169
  next:
170
170
  pagination: Саҳифаларнинг рақамланиши
171
171
  previous:
@@ -162,7 +162,7 @@ vi:
162
162
  label:
163
163
  password_hidden_announcement:
164
164
  password_shown_announcement:
165
- previous_and_next_navigation:
165
+ pagination:
166
166
  next:
167
167
  pagination: Phân trang
168
168
  previous:
@@ -161,7 +161,7 @@ zh-hk:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: 分頁
167
167
  previous:
@@ -161,7 +161,7 @@ zh-tw:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: 分頁
167
167
  previous:
@@ -161,7 +161,7 @@ zh:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: 分页
167
167
  previous:
@@ -184,6 +184,9 @@ module GovukPublishingComponents
184
184
  return if lang.blank?
185
185
 
186
186
  langs = %w[ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh zh-Hans zh-Hant zh-hk zh-tw cv kw co cr hr cs da dv nl dz dr en eo et ee fo fj fi fr ff gl gd gv ka de el kl gn gu ht ha he hz hi ho hu is io ig id in ia ie iu ik ga it ja jv kl kn kr ks kk km ki rw rn ky kv kg ko ku kj lo la lv li ln lt lu lg lb gv mk mg ms ml mt mi mr mh mo mn na nv ng nd ne no nb nn ii oc oj cu or om os pi ps fa pl pt pa pa-pk qu rm ro ru se sm sg sa sr sh st tn sn ii sd si ss sk sl so nr es es-419 su sw ss sv tl ty tg ta tt te th bo ti to ts tr tk tw ug uk ur uz ve vi vo wa cy wo fy xh yi ji yo za zu]
187
+
188
+ lang = lang.to_s
189
+
187
190
  unless langs.include? lang
188
191
  raise(ArgumentError, "lang attribute (#{lang}) is not recognised")
189
192
  end
@@ -4,15 +4,13 @@ module GovukPublishingComponents
4
4
  include ActionView::Helpers
5
5
  include ActionView::Context
6
6
 
7
- attr_reader :extra_details, :extra_details_no_indent, :heading_text, :metadata, :lang, :image_loading, :youtube_video_id, :image_src, :two_thirds, :large_font_size_mobile
7
+ attr_reader :href, :large, :extra_details, :extra_details_no_indent, :heading_text, :metadata, :lang, :image_loading, :image_src, :two_thirds, :large_font_size_mobile
8
8
 
9
- def initialize(local_assigns, brand_helper)
9
+ def initialize(local_assigns)
10
10
  @href = local_assigns[:href]
11
11
  @extra_details = local_assigns[:extra_details] || []
12
12
  @image_src = local_assigns[:image_src]
13
13
  @image_alt = local_assigns[:image_alt] || ""
14
- @youtube_video_alt = local_assigns[:youtube_video_alt]
15
- @image_loading = local_assigns[:image_loading] || "auto"
16
14
  @srcset = local_assigns[:srcset] || nil
17
15
  @sizes = local_assigns[:sizes] || nil
18
16
  @image_loading = local_assigns[:image_loading] || "auto"
@@ -25,22 +23,6 @@ module GovukPublishingComponents
25
23
  @extra_details_no_indent = local_assigns[:extra_details_no_indent]
26
24
  @metadata = local_assigns[:metadata]
27
25
  @lang = local_assigns[:lang]
28
- @youtube_video_id = local_assigns[:youtube_video_id] || nil
29
-
30
- @brand_helper = brand_helper
31
- end
32
-
33
- def href
34
- return youtube_href if @youtube_video_id
35
-
36
- @href
37
- end
38
-
39
- def large
40
- # if youtube video, we don't want to use
41
- # the small variant, large will be always
42
- # true if a youtube_video_id is supplied
43
- @youtube_video_id || @large
44
26
  end
45
27
 
46
28
  def large_mobile_font_size?
@@ -51,20 +33,13 @@ module GovukPublishingComponents
51
33
  end
52
34
 
53
35
  def media
54
- return youtube_link if @youtube_video_id
55
-
56
- image
57
- end
58
-
59
- def image
60
- classes = %w[gem-c-image-card__image-wrapper]
61
36
  height = 200
62
37
  width = 300
63
38
  height = 90 if @two_thirds
64
39
  width = 90 if @two_thirds
65
40
 
66
41
  if @image_src
67
- content_tag(:figure, class: classes) do
42
+ content_tag(:figure, class: "gem-c-image-card__image-wrapper") do
68
43
  image_tag(
69
44
  @image_src,
70
45
  class: "gem-c-image-card__image",
@@ -84,6 +59,7 @@ module GovukPublishingComponents
84
59
 
85
60
  content_tag(:p, class: "gem-c-image-card__context") do
86
61
  if @context[:date]
62
+ @context[:date] = Date.parse(@context[:date]) if @context[:date].is_a? String
87
63
  date = content_tag(:time, l(@context[:date], format: "%e %B %Y"), datetime: @context[:date].iso8601, lang: "en")
88
64
  dash = content_tag(:span, " — ", 'aria-hidden': true)
89
65
 
@@ -99,47 +75,11 @@ module GovukPublishingComponents
99
75
  end
100
76
 
101
77
  def description
102
- return content_tag(:div, @description, class: "gem-c-image-card__description gem-c-image-card__description--large-font-size-mobile") if @description && large_mobile_font_size?
103
-
104
- content_tag(:div, @description, class: "gem-c-image-card__description") if @description
105
- end
106
-
107
- def youtube_href
108
- "https://www.youtube.com/watch?v=#{@youtube_video_id}"
109
- end
78
+ return unless @description
110
79
 
111
- def youtube_thumbnail_url
112
- "https://img.youtube.com/vi/#{@youtube_video_id}/maxresdefault.jpg"
113
- end
114
-
115
- def youtube_thumbnail
116
- thumbnail = content_tag(:div, class: "gem-c-image-card__youtube-thumbnail-image-container") do
117
- image_tag(
118
- youtube_thumbnail_url,
119
- class: "gem-c-image-card__image gem-c-image-card__youtube-thumbnail-image",
120
- alt: "",
121
- loading: @image_loading,
122
- )
123
- end
124
- thumbnail + content_tag(:figcaption, @youtube_video_alt, class: "gem-c-image-card__youtube-thumbnail-container-text govuk-link #{@brand_helper.color_class}")
125
- end
126
-
127
- def youtube_link
128
- content_tag(
129
- :figure,
130
- class: "gem-c-image-card__image-wrapper gem-c-image-card__image-wrapper--youtube-embed",
131
- ) do
132
- content_tag(:div) do
133
- link_to(
134
- href,
135
- {
136
- class: "govuk-body govuk-link gem-c-image-card__youtube-thumbnail-container js-youtube-card-embed",
137
- },
138
- ) do
139
- youtube_thumbnail
140
- end
141
- end
142
- end
80
+ classes = %w[gem-c-image-card__description]
81
+ classes << "gem-c-image-card__description--large-font-size-mobile" if large_mobile_font_size?
82
+ content_tag(:div, @description, class: classes)
143
83
  end
144
84
  end
145
85
  end
@@ -0,0 +1,130 @@
1
+ module GovukPublishingComponents
2
+ module Presenters
3
+ class PaginationHelper
4
+ include ActionView::Helpers
5
+ include ActionView::Context
6
+
7
+ attr_reader :prev_link, :next_link, :page_links, :ga4_type
8
+
9
+ def initialize(local_assigns)
10
+ @arrow_links = {
11
+ next: local_assigns[:next_page] || nil,
12
+ prev: local_assigns[:previous_page] || nil,
13
+ }
14
+
15
+ @items = local_assigns[:items] || nil
16
+
17
+ @disable_ga4 = local_assigns[:disable_ga4] || nil
18
+ @ga4_type = has_pages? ? "pagination" : "previous and next"
19
+ @prev_link = arrow_link_helper(direction: "prev")
20
+ @next_link = arrow_link_helper(direction: "next")
21
+ @page_links = pages_link_helper
22
+ end
23
+
24
+ def ga4_link_event(text:, section:)
25
+ unless @disable_ga4
26
+ {
27
+ event_name: "navigation",
28
+ type: @ga4_type,
29
+ text:,
30
+ section:,
31
+ }.to_json
32
+ end
33
+ end
34
+
35
+ def has_links?
36
+ has_pages? || @prev_link.present? || @next_link.present?
37
+ end
38
+
39
+ def has_pages?
40
+ @items.present?
41
+ end
42
+
43
+ def pages_link_helper
44
+ return unless has_pages?
45
+
46
+ page_links = @items.each_with_index.map do |item, index|
47
+ { href: nil, ellipsis: nil, current: nil, number: nil, visually_hidden_text: nil, **item.symbolize_keys } => { href:, ellipsis:, current:, number:, visually_hidden_text: }
48
+
49
+ raise ArgumentError, "Number or ellipsis value required for item #{index}" if ellipsis.blank? && number.blank?
50
+
51
+ list_item_classes = %w[govuk-pagination__item]
52
+ list_item_classes << "govuk-pagination__item--ellipsis" if ellipsis
53
+ list_item_classes << "govuk-pagination__item--current" if current
54
+
55
+ item_aria_label = visually_hidden_text || "Page #{number}"
56
+
57
+ ga4_link = ga4_link_event(text: number, section: "Pagination list")
58
+
59
+ content_tag(:li, class: list_item_classes) do
60
+ if ellipsis
61
+ "&ctdot;".html_safe
62
+ else
63
+ content_tag(:a, number, class: "govuk-link govuk-pagination__link", href:, aria: { label: item_aria_label, current: current ? "page" : nil }, data: { ga4_link: })
64
+ end
65
+ end
66
+ end
67
+
68
+ content_tag(:ul, class: "govuk-pagination__list") do
69
+ page_links.collect { |page_link| concat(page_link) }
70
+ end
71
+ end
72
+
73
+ def arrow_link_helper(direction:)
74
+ arrow_link_options = @arrow_links[direction.to_sym]
75
+
76
+ return if arrow_link_options.blank? || !valid_link?(arrow_link_options)
77
+
78
+ { href: nil, label: nil, title: nil, icon: nil, **arrow_link_options.symbolize_keys } => { href:, label:, title:, icon: }
79
+
80
+ title ||= {
81
+ "prev": t("components.pagination.previous"),
82
+ "next": t("components.pagination.next"),
83
+ }[direction.to_sym]
84
+
85
+ section = {
86
+ prev: "Previous",
87
+ next: "Next",
88
+ }[direction.to_sym]
89
+
90
+ icon = {
91
+ prev: previous_icon,
92
+ next: next_icon,
93
+ }[direction.to_sym]
94
+
95
+ ga4_link = ga4_link_event(text: label || title, section:)
96
+
97
+ link_text_classes = %w[govuk-pagination__link-title]
98
+ link_text_classes << "govuk-pagination__link-title--decorated" if label.blank?
99
+
100
+ content_tag(:div, class: "govuk-pagination__#{direction}") do
101
+ content_tag(:a, href:, class: "govuk-link govuk-pagination__link", data: { ga4_link: }) do
102
+ concat icon if direction == "prev" || !has_pages? && direction == "next"
103
+ concat content_tag(:span, title, class: link_text_classes)
104
+ concat icon if has_pages? && direction == "next"
105
+ concat content_tag(:span, ":", class: "govuk-visually-hidden") if label.present?
106
+ concat content_tag(:span, label, class: "govuk-pagination__link-label") if label.present?
107
+ end
108
+ end
109
+ end
110
+
111
+ private
112
+
113
+ def previous_icon
114
+ '<svg class="govuk-pagination__icon govuk-pagination__icon--prev" xmlns="http://www.w3.org/2000/svg" height="13" width="15" aria-hidden="true" focusable="false" viewBox="0 0 15 13">
115
+ <path d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"></path>
116
+ </svg>'.squish.html_safe
117
+ end
118
+
119
+ def next_icon
120
+ '<svg class="govuk-pagination__icon govuk-pagination__icon--next" xmlns="http://www.w3.org/2000/svg" height="13" width="15" aria-hidden="true" focusable="false" viewBox="0 0 15 13">
121
+ <path d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"></path>
122
+ </svg>'.squish.html_safe
123
+ end
124
+
125
+ def valid_link?(link)
126
+ link.key?(:href)
127
+ end
128
+ end
129
+ end
130
+ end
@@ -124,14 +124,26 @@ module GovukPublishingComponents
124
124
  end
125
125
 
126
126
  def related_world_locations
127
- content_item_links_for("world_locations").each do |link|
128
- build_world_locations_path_for link
127
+ links = Array(@content_item.dig("links", "world_locations"))
128
+
129
+ links.map do |link|
130
+ {
131
+ path: build_world_locations_path_for(link),
132
+ text: link["title"],
133
+ locale: link["locale"],
134
+ }
129
135
  end
130
136
  end
131
137
 
132
138
  def build_world_locations_path_for(link)
133
- slug = link[:text].parameterize
134
- link[:path] ||= "/world/#{slug}/news"
139
+ if link["document_type"] == "world_location_news"
140
+ link["base_path"]
141
+ elsif link["document_type"] == "world_location" && link.dig("links", "world_location_news").any?
142
+ link.dig("links", "world_location_news", 0, "base_path")
143
+ else
144
+ slug = link["title"].parameterize
145
+ "/world/#{slug}/news"
146
+ end
135
147
  end
136
148
 
137
149
  def related_statistical_data_sets
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "62.3.0".freeze
2
+ VERSION = "63.1.0".freeze
3
3
  end
@@ -39,6 +39,7 @@ require "govuk_publishing_components/presenters/image_card_helper"
39
39
  require "govuk_publishing_components/presenters/intervention_helper"
40
40
  require "govuk_publishing_components/presenters/organisation_logo_helper"
41
41
  require "govuk_publishing_components/presenters/single_page_notification_button_helper"
42
+ require "govuk_publishing_components/presenters/pagination_helper"
42
43
 
43
44
  require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
44
45
  require "govuk_publishing_components/app_helpers/table_helper"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 62.3.0
4
+ version: 63.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -453,8 +453,6 @@ files:
453
453
  - app/assets/images/govuk_publishing_components/take-action-amber.svg
454
454
  - app/assets/images/govuk_publishing_components/take-action-green.svg
455
455
  - app/assets/images/govuk_publishing_components/take-action-red.svg
456
- - app/assets/images/govuk_publishing_components/youtube-play-icon.png
457
- - app/assets/images/govuk_publishing_components/youtube-play-icon.svg
458
456
  - app/assets/images/option-select/input-icon.svg
459
457
  - app/assets/images/select-with-search/cross-icon.svg
460
458
  - app/assets/javascripts/component_guide/accessibility-test.js
@@ -500,7 +498,6 @@ files:
500
498
  - app/assets/javascripts/govuk_publishing_components/components/file-upload.js
501
499
  - app/assets/javascripts/govuk_publishing_components/components/global-banner.js
502
500
  - app/assets/javascripts/govuk_publishing_components/components/govspeak.js
503
- - app/assets/javascripts/govuk_publishing_components/components/image-card.js
504
501
  - app/assets/javascripts/govuk_publishing_components/components/intervention.js
505
502
  - app/assets/javascripts/govuk_publishing_components/components/layout-header.js
506
503
  - app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js
@@ -599,10 +596,10 @@ files:
599
596
  - app/assets/stylesheets/govuk_publishing_components/components/_notice.scss
600
597
  - app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss
601
598
  - app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss
599
+ - app/assets/stylesheets/govuk_publishing_components/components/_pagination.scss
602
600
  - app/assets/stylesheets/govuk_publishing_components/components/_panel.scss
603
601
  - app/assets/stylesheets/govuk_publishing_components/components/_password-input.scss
604
602
  - app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss
605
- - app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss
606
603
  - app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss
607
604
  - app/assets/stylesheets/govuk_publishing_components/components/_published-dates.scss
608
605
  - app/assets/stylesheets/govuk_publishing_components/components/_radio.scss
@@ -755,10 +752,10 @@ files:
755
752
  - app/views/govuk_publishing_components/components/_notice.html.erb
756
753
  - app/views/govuk_publishing_components/components/_option_select.html.erb
757
754
  - app/views/govuk_publishing_components/components/_organisation_logo.html.erb
755
+ - app/views/govuk_publishing_components/components/_pagination.html.erb
758
756
  - app/views/govuk_publishing_components/components/_panel.html.erb
759
757
  - app/views/govuk_publishing_components/components/_password_input.html.erb
760
758
  - app/views/govuk_publishing_components/components/_phase_banner.html.erb
761
- - app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb
762
759
  - app/views/govuk_publishing_components/components/_print_link.html.erb
763
760
  - app/views/govuk_publishing_components/components/_published_dates.html.erb
764
761
  - app/views/govuk_publishing_components/components/_radio.html.erb
@@ -857,10 +854,10 @@ files:
857
854
  - app/views/govuk_publishing_components/components/docs/notice.yml
858
855
  - app/views/govuk_publishing_components/components/docs/option_select.yml
859
856
  - app/views/govuk_publishing_components/components/docs/organisation_logo.yml
857
+ - app/views/govuk_publishing_components/components/docs/pagination.yml
860
858
  - app/views/govuk_publishing_components/components/docs/panel.yml
861
859
  - app/views/govuk_publishing_components/components/docs/password_input.yml
862
860
  - app/views/govuk_publishing_components/components/docs/phase_banner.yml
863
- - app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml
864
861
  - app/views/govuk_publishing_components/components/docs/print_link.yml
865
862
  - app/views/govuk_publishing_components/components/docs/published_dates.yml
866
863
  - app/views/govuk_publishing_components/components/docs/radio.yml
@@ -1027,6 +1024,7 @@ files:
1027
1024
  - lib/govuk_publishing_components/presenters/meta_tags.rb
1028
1025
  - lib/govuk_publishing_components/presenters/organisation_logo_helper.rb
1029
1026
  - lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb
1027
+ - lib/govuk_publishing_components/presenters/pagination_helper.rb
1030
1028
  - lib/govuk_publishing_components/presenters/public_layout_helper.rb
1031
1029
  - lib/govuk_publishing_components/presenters/related_navigation_helper.rb
1032
1030
  - lib/govuk_publishing_components/presenters/schema_org.rb
@@ -2120,7 +2118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2120
2118
  - !ruby/object:Gem::Version
2121
2119
  version: '0'
2122
2120
  requirements: []
2123
- rubygems_version: 4.0.1
2121
+ rubygems_version: 4.0.2
2124
2122
  specification_version: 4
2125
2123
  summary: A gem to document components in GOV.UK frontend applications
2126
2124
  test_files: []
@@ -1,4 +0,0 @@
1
- <svg width="79" height="55" viewBox="0 0 79 55" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M39.7503 0H40.1861C44.2104 0.014681 64.6016 0.161492 70.0996 1.63938C71.7617 2.09042 73.2763 2.96959 74.492 4.18902C75.7076 5.40846 76.5818 6.92545 77.0272 8.5884C77.5217 10.448 77.8693 12.9095 78.1043 15.4493L78.1533 15.9583L78.261 17.2306L78.3001 17.7396C78.6184 22.2124 78.6575 26.4014 78.6624 27.3165V27.6835C78.6575 28.6329 78.6135 33.1057 78.261 37.7645L78.2218 38.2783L78.1777 38.7873C77.9329 41.5864 77.5706 44.366 77.0272 46.4116C76.5832 48.0752 75.7094 49.5929 74.4936 50.8126C73.2777 52.0322 71.7624 52.9109 70.0996 53.3606C64.4204 54.8874 42.8347 54.9951 39.8434 55H39.1481C37.6353 55 31.3785 54.9706 24.818 54.7455L23.9858 54.7162L23.5598 54.6966L22.7226 54.6623L21.8854 54.6281C16.4511 54.3883 11.2762 54.0017 8.8919 53.3557C7.22972 52.9065 5.71482 52.0285 4.49899 50.8097C3.28315 49.591 2.40907 48.0743 1.9643 46.4116C1.42086 44.3709 1.05857 41.5864 0.813776 38.7873L0.774609 38.2734L0.735443 37.7645C0.493822 34.4485 0.359932 31.1256 0.333984 27.801L0.333984 27.199C0.343776 26.1469 0.382943 22.5109 0.647318 18.4981L0.681589 17.994L0.696276 17.7396L0.735443 17.2306L0.843151 15.9583L0.892109 15.4493C1.12711 12.9095 1.47471 10.4431 1.96919 8.5884C2.41321 6.92478 3.28697 5.40707 4.50285 4.18743C5.71874 2.96779 7.23402 2.08907 8.8968 1.63938C11.2811 1.0032 16.456 0.611709 21.8903 0.367025L22.7226 0.33277L23.5647 0.303409L23.9858 0.288727L24.8229 0.254472C29.4823 0.104601 34.1437 0.0213994 38.8054 0.0048939H39.7503V0ZM31.6673 15.7087V39.2864L52.0193 27.5024L31.6673 15.7087Z" fill="#EA3323"/>
3
- <path d="M31.668 15.7087V39.2865L52.0199 27.5025L31.668 15.7087Z" fill="white"/>
4
- </svg>
@@ -1,19 +0,0 @@
1
- window.GOVUK = window.GOVUK || {}
2
- window.GOVUK.Modules = window.GOVUK.Modules || {};
3
-
4
- (function (Modules) {
5
- function ImageCard ($module) {
6
- this.$module = $module
7
- this.$module.youtubeLink = this.$module.querySelector('.gem-c-image-card__image-wrapper div')
8
- }
9
-
10
- ImageCard.prototype.init = function () {
11
- var ytLink = new window.GOVUK.GovspeakYoutubeLinkEnhancement(
12
- this.$module.youtubeLink,
13
- 'gem-c-govspeak__youtube-video gem-c-image-card__youtube-video-embed'
14
- )
15
- ytLink.init()
16
- }
17
-
18
- Modules.ImageCard = ImageCard
19
- })(window.GOVUK.Modules)