govuk_publishing_components 35.3.1 → 35.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7d5e0e3ab0fa8c2a8ab33e0a41c142dbc9c967f53095dae21edcbef938ba2c3
4
- data.tar.gz: 52e3130b7b3d04d05456dfb0efa86cad9f2a70a3cd06447da44a70d31a7c06d4
3
+ metadata.gz: 66ace2c61b08a0641bc1234bf1e1b34e3e2e184ad07f554bde39c60280e58dd5
4
+ data.tar.gz: fb3dbf387e8e668bf81b2b13c8c73a5152d3d4c2e570f7b2743e96f424b70680
5
5
  SHA512:
6
- metadata.gz: 5fdfcedf36b4a26d5b834d49fb1a7d4ec64de5e0c808022e6904f1de99f4294c96e125ac9c28096d04ac47ce43796b73cdb0fb288dc2242d3d39682e524d5b64
7
- data.tar.gz: c0fe259f8445f2a0f0b7e8cc72334f2fca3880dcb810bd7e2a4b09eababda3633841b49db194864828a9cca44e266c3f0742f574c1ce32b1f6a88f3bec8749b1
6
+ metadata.gz: da81d3abeeb7d15ea0c74d1f428df7a9d7856ce078a50e63c8e66da7e244dea937f6600a457592c5ebafc1615dd623a8cc81e578e2a8eae4de97e7fa8fb7b779
7
+ data.tar.gz: c2dcc61e03d0999871fca19f559833717892cb67ab16ed198eb8266fe06fe0d58a6465d65eae4e62c3aa84865732216ffeb8e224b2cb9f84fb8a2ae5ef089491
@@ -84,7 +84,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
84
84
 
85
85
  // if GA4 is enabled, set attributes on 'show all sections' for tracking using ga4-event-tracker
86
86
  if (this.$module.isGa4Enabled) {
87
- var showAllAttributesGa4 = { event_name: 'select_content', type: 'step by step', index: 0, index_total: this.$module.totalSteps }
87
+ var showAllAttributesGa4 = { event_name: 'select_content', type: 'step by step', index: 0, index_section_count: this.$module.totalSteps }
88
88
  this.$module.showOrHideAllButton.setAttribute('data-ga4-event', JSON.stringify(showAllAttributesGa4))
89
89
  }
90
90
  }
@@ -17,7 +17,6 @@ module GovukPublishingComponents
17
17
  licence-finder
18
18
  release
19
19
  search-admin
20
- service-manual-frontend
21
20
  signon
22
21
  smart-answers
23
22
  static
@@ -42,7 +42,9 @@
42
42
  tabindex: "-1",
43
43
  "aria-hidden": true,
44
44
  data: data_attributes do %>
45
- <% if attachment.document? %>
45
+ <% if attachment.thumbnail_url %>
46
+ <% image_tag(attachment.thumbnail_url, alt: "") %>
47
+ <% elsif attachment.document? %>
46
48
  <%= render "govuk_publishing_components/components/attachment/thumbnail_document" %>
47
49
  <% elsif attachment.spreadsheet? %>
48
50
  <%= render "govuk_publishing_components/components/attachment/thumbnail_spreadsheet" %>
@@ -35,6 +35,7 @@
35
35
  <div class="<%= width_class %> govuk-!-display-none-print">
36
36
  <h2 class="govuk-footer__heading govuk-heading-m"><%= section[:title] %></h2>
37
37
  <ul class="<%= list_classes.join(' ') %>">
38
+ <% index_total = section[:items].length %>
38
39
  <% section[:items].each_with_index do |item, index| %>
39
40
  <% if item[:href] && item[:text] %>
40
41
  <li class="govuk-footer__list-item">
@@ -48,7 +49,7 @@
48
49
  attributes[:rel] = "noopener" if attributes[:target] == "_blank" && !attributes[:rel]
49
50
 
50
51
  unless attributes[:data][:ga4_link]
51
- attributes[:data][:ga4_link] = layout_footer_helper.generate_ga4_link_attribute(index, ga4_section_index, section[:title])
52
+ attributes[:data][:ga4_link] = layout_footer_helper.generate_ga4_link_attribute(index, ga4_section_index, section[:title], index_total)
52
53
  end
53
54
  %>
54
55
  <%= link_to item[:text], item[:href], attributes %>
@@ -68,6 +69,7 @@
68
69
  <% if meta.any? %>
69
70
  <h2 class="govuk-visually-hidden"><%= t("components.layout_footer.support_links") %></h2>
70
71
  <ul class="govuk-footer__inline-list govuk-!-display-none-print" data-module="gem-track-click" data-track-links-only>
72
+ <% index_total = meta[:items].length %>
71
73
  <% meta[:items].each_with_index do |item, index| %>
72
74
  <li class="govuk-footer__inline-list-item">
73
75
  <%
@@ -78,7 +80,7 @@
78
80
  attributes[:rel] = "noopener" if attributes[:target] == "_blank" && !attributes[:rel]
79
81
 
80
82
  unless attributes[:data][:ga4_link]
81
- attributes[:data][:ga4_link] = layout_footer_helper.generate_ga4_link_attribute(index, navigation.length, "Support links")
83
+ attributes[:data][:ga4_link] = layout_footer_helper.generate_ga4_link_attribute(index, navigation.length, "Support links", index_total)
82
84
  end
83
85
  %>
84
86
  <%= link_to item[:text], item[:href], attributes %>
@@ -111,7 +113,7 @@
111
113
  "index_section_count": layout_footer_helper.ga4_index_section_count.to_s,
112
114
  },
113
115
  "text": "Open Government Licence v3.0",
114
- "index_total": layout_footer_helper.ga4_index_total.to_s,
116
+ "index_total": "1",
115
117
  "type": "footer",
116
118
  }.to_json %>"
117
119
  >
@@ -136,7 +138,7 @@
136
138
  "index_section_count": layout_footer_helper.ga4_index_section_count.to_s,
137
139
  },
138
140
  "text": "© Crown copyright",
139
- "index_total": layout_footer_helper.ga4_index_total.to_s,
141
+ "index_total": "1",
140
142
  "type": "footer",
141
143
  }.to_json %>"
142
144
  >
@@ -16,12 +16,6 @@
16
16
  show_search_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "search")
17
17
  hide_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => "navigation")
18
18
  show_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "navigation")
19
-
20
- navigation_links_length = 1 # GOVUK Logo makes this start from 1
21
- navigation_links_columns.each do | column |
22
- navigation_links_length = navigation_links_length + column[:menu_contents].length
23
- end
24
- navigation_links_length = navigation_links_length + popular_links.length
25
19
  %>
26
20
  <header role="banner" class="gem-c-layout-super-navigation-header" data-module="gem-track-click ga4-event-tracker ga4-link-tracker" data-track-links-only data-ga4-expandable>
27
21
  <div class="gem-c-layout-super-navigation-header__container govuk-clearfix">
@@ -46,7 +40,7 @@
46
40
  "index": {
47
41
  "index_section": 0,
48
42
  },
49
- "index_total": navigation_links_length
43
+ "index_total": 1
50
44
  }.to_json %>"
51
45
  >
52
46
  <span class="govuk-header__logotype">
@@ -225,6 +219,7 @@
225
219
  <%= column[:label] %>
226
220
  </h3>
227
221
  <ul class="gem-c-layout-super-navigation-header__navigation-second-items gem-c-layout-super-navigation-header__navigation-second-items--<%= column[:label].downcase.sub(" ", "-") %>">
222
+ <% index_total = column[:menu_contents].length %>
228
223
  <% column[:menu_contents].each_with_index do | item, index | %>
229
224
  <%
230
225
  has_description = item[:description].present?
@@ -249,7 +244,7 @@
249
244
  "index_link": index + 1,
250
245
  "index_section_count": 4,
251
246
  },
252
- "index_total": navigation_links_length,
247
+ "index_total": index_total,
253
248
  "section": column[:label],
254
249
  }
255
250
  }
@@ -302,6 +297,7 @@
302
297
  <div class="govuk-grid-column-full">
303
298
  <h3 class="govuk-heading-m"><%= popular_links_heading %></h3>
304
299
  <ul class="govuk-list">
300
+ <% index_total = popular_links.length %>
305
301
  <% popular_links.each_with_index do | popular_link, index | %>
306
302
  <li class="gem-c-layout-super-navigation-header__popular-item">
307
303
  <%= link_to popular_link[:label], popular_link[:href], {
@@ -323,7 +319,7 @@
323
319
  "index_link": index + 1,
324
320
  "index_section_count": 4,
325
321
  },
326
- "index_total": navigation_links_length,
322
+ "index_total": index_total,
327
323
  "section": popular_links_heading,
328
324
  }
329
325
  }
@@ -168,3 +168,12 @@ examples:
168
168
  filename: department-for-transport-information-asset-register.csv
169
169
  content_type: text/csv
170
170
  file_size: 20000
171
+ with_custom_thumbnail:
172
+ data:
173
+ attachment:
174
+ title: "Department for Transport, temporary snow ploughs: guidance note"
175
+ url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
176
+ filename: temporary-snow-ploughs.pdf
177
+ content_type: application/pdf
178
+ file_size: 20000
179
+ thumbnail_url: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/791567/thumbnail_the_government_financial_reporting_review_web.pdf.png"
@@ -12,6 +12,10 @@ module GovukPublishingComponents
12
12
  @attachment_data = attachment_data.with_indifferent_access
13
13
  end
14
14
 
15
+ def thumbnail_url
16
+ @attachment_data[:thumbnail_url]
17
+ end
18
+
15
19
  def title
16
20
  attachment_data.fetch(:title)
17
21
  end
@@ -1,35 +1,25 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class LayoutFooterHelper
4
- attr_reader :ga4_index_total, :ga4_index_section_count, :ga4_ogl_link_index_section, :ga4_copyright_link_index_section
4
+ attr_reader :ga4_index_section_count, :ga4_ogl_link_index_section, :ga4_copyright_link_index_section
5
5
 
6
6
  def initialize(footer_navigation_section, footer_meta_section)
7
- @ga4_index_total = 0
8
- @ga4_index_section_count = 0
7
+ @ga4_index_section_count = footer_navigation_section.length
9
8
  @amount_of_meta_sections = 0
10
9
 
11
- footer_navigation_section.each do |section|
12
- @ga4_index_section_count += 1
13
- if section[:items]
14
- @ga4_index_total += section[:items].length
15
- end
16
- end
17
-
18
10
  if footer_meta_section.any?
19
11
  @amount_of_meta_sections = 1
20
12
  @ga4_index_section_count += 1
21
- @ga4_index_total += footer_meta_section[:items].length
22
13
  end
23
14
 
24
- # For our GOVUK footer links, we need to add 2 to the index_total and index_section_count. This is due to the "Open Government License" and "Crown Copyright" links being defined separately to the rest of our footer links.
25
- @ga4_index_total += 2
15
+ # For our GOVUK footer links, we need to add 2 to the index_section_count. This is due to the "Open Government License" and "Crown Copyright" links being defined separately to the rest of our footer links.
26
16
  @ga4_index_section_count += 2
27
17
 
28
18
  @ga4_ogl_link_index_section = footer_navigation_section.length + @amount_of_meta_sections + 1
29
- @ga4_copyright_link_index_section = footer_navigation_section.length + @amount_of_meta_sections + 2
19
+ @ga4_copyright_link_index_section = @ga4_ogl_link_index_section + 1
30
20
  end
31
21
 
32
- def generate_ga4_link_attribute(index_link, index_section, section)
22
+ def generate_ga4_link_attribute(index_link, index_section, section, index_total)
33
23
  {
34
24
  "event_name": "navigation",
35
25
  "type": "footer",
@@ -38,7 +28,7 @@ module GovukPublishingComponents
38
28
  "index_section": (index_section + 1).to_s,
39
29
  "index_section_count": @ga4_index_section_count.to_s,
40
30
  },
41
- "index-total": @ga4_index_total.to_s,
31
+ "index_total": index_total.to_s,
42
32
  "section": section,
43
33
  }
44
34
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.3.1".freeze
2
+ VERSION = "35.3.2".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: 35.3.1
4
+ version: 35.3.2
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: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config