govuk_publishing_components 35.3.0 → 35.3.1

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: 0f87c9fa99d845d53392c5a02a8c4330f7a9557b94290a55cc18b5f169862215
4
- data.tar.gz: ee6d97596ccbc7cfc9704f95dd3b1940e6b60254fc3fe7f6c51d5d6c16d1ead4
3
+ metadata.gz: a7d5e0e3ab0fa8c2a8ab33e0a41c142dbc9c967f53095dae21edcbef938ba2c3
4
+ data.tar.gz: 52e3130b7b3d04d05456dfb0efa86cad9f2a70a3cd06447da44a70d31a7c06d4
5
5
  SHA512:
6
- metadata.gz: 635eaae4b3ce872688184197dd240be9751f6d9286680f324a876cea3d00a9bfa0b6037b5817fbf58a66d319510dcbca747ff5c7bc69e5d76a7c33cb345963cb
7
- data.tar.gz: 595feac64b2542ef4ff5cb669e7e12462cea78d250cb0d44f01312de9297379d0e2c9f4d8bff0ab75a59a3b523fd6d801df93518f4c407c600b87695c17c1ea8
6
+ metadata.gz: 5fdfcedf36b4a26d5b834d49fb1a7d4ec64de5e0c808022e6904f1de99f4294c96e125ac9c28096d04ac47ce43796b73cdb0fb288dc2242d3d39682e524d5b64
7
+ data.tar.gz: c0fe259f8445f2a0f0b7e8cc72334f2fca3880dcb810bd7e2a4b09eababda3633841b49db194864828a9cca44e266c3f0742f574c1ce32b1f6a88f3bec8749b1
@@ -87,3 +87,12 @@
87
87
  border-color: govuk-colour("black");
88
88
  }
89
89
  }
90
+
91
+ // new colour for DSIT for use until govuk-frontend#3523 has been released
92
+
93
+ .brand--department-for-science-innovation-and-technology {
94
+ &.brand__border-color,
95
+ .brand__border-color {
96
+ border-color: #045f71;
97
+ }
98
+ }
@@ -5,6 +5,9 @@
5
5
  request.query_parameters[:ga4_tracking] = ga4_tracking
6
6
  navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request)
7
7
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
8
+ show_ukraine_cta = navigation.show_ukraine_cta?
9
+ ga4_tracking_counts = OpenStruct.new(index_section_count: 0)
10
+ ga4_tracking_counts.index_section_count = 1 if show_ukraine_cta
8
11
  %>
9
12
 
10
13
  <div class="gem-c-contextual-sidebar">
@@ -18,7 +21,7 @@
18
21
  <%= render 'govuk_publishing_components/components/step_by_step_nav', navigation.step_nav_helper.sidebar %>
19
22
  <% else %>
20
23
  <%# Rendering related navigation sidebar because no step by step list %>
21
- <%= render 'govuk_publishing_components/components/related_navigation', content_item: content_item, context: :sidebar, ga4_tracking: ga4_tracking %>
24
+ <%= render 'govuk_publishing_components/components/related_navigation', content_item: content_item, context: :sidebar, ga4_tracking: ga4_tracking, ga4_tracking_counts: ga4_tracking_counts %>
22
25
  <% end %>
23
26
 
24
27
  <% if navigation.content_tagged_to_other_step_by_steps? %>
@@ -31,7 +34,7 @@
31
34
  } %>
32
35
  <% end %>
33
36
 
34
- <% if navigation.show_ukraine_cta? %>
35
- <%= render 'govuk_publishing_components/components/contextual_sidebar/ukraine_cta', content_item: content_item, ga4_tracking: ga4_tracking %>
37
+ <% if show_ukraine_cta %>
38
+ <%= render 'govuk_publishing_components/components/contextual_sidebar/ukraine_cta', content_item: content_item, ga4_tracking: ga4_tracking, ga4_tracking_counts: ga4_tracking_counts %>
36
39
  <% end %>
37
40
  </div>
@@ -5,12 +5,11 @@
5
5
  data = {}
6
6
  data[:module] = "gem-track-click"
7
7
  data[:module] << " ga4-link-tracker" if ga4_tracking
8
- %>
8
+ ga4_tracking_counts ||= OpenStruct.new(index_section_count: 0)
9
+ ga4_tracking_counts.index_section_count += related_nav_helper.index_section_count
9
10
 
10
- <%
11
11
  add_gem_component_stylesheet("related-navigation")
12
12
  %>
13
-
14
13
  <% if related_nav_helper.related_navigation? %>
15
14
  <% random = SecureRandom.hex(4) %>
16
15
  <%= tag.div(class: "gem-c-related-navigation", data: data) do %>
@@ -30,7 +29,6 @@
30
29
  <% end %>
31
30
 
32
31
  <% section_index = 0 %>
33
-
34
32
  <% related_nav_helper.related_navigation.each do |section_title, links| %>
35
33
  <% next unless links.any? %>
36
34
 
@@ -42,6 +40,7 @@
42
40
  section_title: section_title,
43
41
  links: links,
44
42
  section_index: section_index,
43
+ section_count: ga4_tracking_counts.index_section_count,
45
44
  random: random,
46
45
  ga4_tracking: ga4_tracking %>
47
46
  <% end %>
@@ -8,13 +8,19 @@
8
8
  <%= tag.div class: "gem-c-contextual-sidebar__cta gem-c-contextual-sidebar__cta--ukraine", data: { module: data_module } do %>
9
9
  <%= tag.h2 title, class: "gem-c-contextual-sidebar__heading govuk-heading-s" %>
10
10
  <%= tag.ul class: "gem-c-contextual-sidebar__list" do %>
11
+ <% index_total = t("components.related_navigation.ukraine.links").length %>
11
12
  <% t("components.related_navigation.ukraine.links").each_with_index do |link, index| %>
12
13
  <%= tag.li class: "gem-c-contextual-sidebar__text govuk-body" do %>
13
14
  <%
14
15
  ga4_attributes = {
15
16
  event_name: "navigation",
16
17
  type: "related content",
17
- index: "1.#{index + 1}",
18
+ index: {
19
+ index_section: "#{ga4_tracking_counts.index_section_count}",
20
+ index_link: "#{index + 1}",
21
+ index_section_count: "#{ga4_tracking_counts.index_section_count}",
22
+ },
23
+ index_total: "#{index_total}",
18
24
  section: title,
19
25
  } if ga4_tracking
20
26
  %>
@@ -24,17 +24,23 @@
24
24
  <% end %>
25
25
 
26
26
  <ul class="gem-c-related-navigation__link-list">
27
- <% constructed_link_array = [] %>
28
-
29
- <% section_link_limit = related_nav_helper.calculate_section_link_limit(links) %>
30
-
27
+ <%
28
+ constructed_link_array = []
29
+ section_link_limit = related_nav_helper.calculate_section_link_limit(links)
30
+ index_total = links.length
31
+ %>
31
32
  <% links.each.with_index(1) do |link, index| %>
32
33
  <%
33
34
  link_class = "govuk-link #{related_nav_helper.section_css_class("govuk-link gem-c-related-navigation__section-link", section_title, link: link, link_is_inline: (index >= section_link_limit))}"
34
35
  ga4_attributes = {
35
36
  event_name: "navigation",
36
37
  type: "related content",
37
- index: "#{section_index}.#{index}",
38
+ index: {
39
+ index_section: "#{section_index}",
40
+ index_link: "#{index}",
41
+ index_section_count: "#{section_count}",
42
+ },
43
+ index_total: "#{index_total}",
38
44
  section: ga4_heading_text,
39
45
  } if ga4_tracking
40
46
  link_element = link_to(
@@ -16,12 +16,16 @@ module GovukPublishingComponents
16
16
  "UK Mission to the European Union" => "uk-mission-to-the-eu",
17
17
  }.freeze
18
18
 
19
+ attr_reader :related_navigation, :index_section_count
20
+
19
21
  def initialize(options = {})
20
22
  @content_item = options.fetch(:content_item) { raise ArgumentError, "missing argument: content_item" }
21
23
  @context = options.fetch(:context, nil)
24
+ @related_navigation = related_navigation_contents
25
+ @index_section_count = section_count
22
26
  end
23
27
 
24
- def related_navigation
28
+ def related_navigation_contents
25
29
  case @context.try(:to_sym)
26
30
  when :sidebar
27
31
  {
@@ -53,6 +57,10 @@ module GovukPublishingComponents
53
57
  end
54
58
  end
55
59
 
60
+ def section_count
61
+ @related_navigation.select { |_, links| links.any? }.length
62
+ end
63
+
56
64
  def construct_section_text(section, underscores_to_spaces)
57
65
  unless section == "related_items"
58
66
  defaults = [I18n.t("components.related_navigation.#{section}")]
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.3.0".freeze
2
+ VERSION = "35.3.1".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.0
4
+ version: 35.3.1
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-17 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config