govuk_publishing_components 34.12.0 → 34.14.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/config/govuk_publishing_components_manifest.js +75 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-auto-tracker.js +4 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +31 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +1 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/_individual_component_support.scss +10 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_date-input.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_details.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_devolved-nations.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_file-upload.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_hint.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_inset-text.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_label.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_modal-dialogue.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_select.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_show-password.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_signup-link.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_single-page-notification-button.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_skip-link.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_summary-list.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -0
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_attachment.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_attachment_link.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_back_link.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_big_number.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_button.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_cards.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_character_count.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +7 -4
- data/app/views/govuk_publishing_components/components/_contextual_guidance.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -2
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_date_input.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_details.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_document_list.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_error_alert.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_error_message.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_error_summary.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_fieldset.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_file_upload.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_govspeak.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/_govspeak_html_publication.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_heading.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_hint.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +5 -3
- data/app/views/govuk_publishing_components/components/_input.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_inset_text.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_inverse_header.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_label.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_lead_paragraph.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_notice.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_panel.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +6 -1
- data/app/views/govuk_publishing_components/components/_print_link.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_radio.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +4 -0
- data/app/views/govuk_publishing_components/components/_reorderable_list.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_search.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_select.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_show_password.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_signup_link.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_skip_link.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +12 -2
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +21 -8
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_success_alert.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_table.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_tabs.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_textarea.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_title.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_warning_text.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +13 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +11 -0
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +10 -0
- data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +86 -0
- data/lib/govuk_publishing_components/config.rb +3 -0
- data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +3 -2
- data/lib/govuk_publishing_components/presenters/breadcrumbs.rb +3 -1
- data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +2 -1
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +1 -1
- data/lib/govuk_publishing_components/railtie.rb +7 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +3 -0
- metadata +5 -2
@@ -1,12 +1,17 @@
|
|
1
1
|
<%
|
2
|
+
add_gem_component_stylesheet("step-by-step-nav-related")
|
3
|
+
ga4_tracking ||= false
|
2
4
|
links ||= []
|
3
5
|
pretitle ||= t("components.step_by_step_nav_related.part_of")
|
4
6
|
always_display_as_list ||= false
|
7
|
+
classes = %w(gem-c-step-nav-related)
|
8
|
+
classes << "gem-c-step-nav-related--singular" if links.length == 1
|
9
|
+
data = {}
|
10
|
+
data[:module] = "gem-track-click"
|
11
|
+
data[:module] << " ga4-link-tracker" if ga4_tracking
|
5
12
|
%>
|
6
13
|
<% if links.any? %>
|
7
|
-
|
8
|
-
class="gem-c-step-nav-related <%= "gem-c-step-nav-related--singular" if links.length == 1 %>"
|
9
|
-
data-module="gem-track-click">
|
14
|
+
<%= tag.div(class: classes, data: data) do %>
|
10
15
|
<h2 class="gem-c-step-nav-related__heading">
|
11
16
|
<span class="gem-c-step-nav-related__pretitle"><%= pretitle %></span>
|
12
17
|
<% if links.length == 1 && !always_display_as_list %>
|
@@ -17,14 +22,18 @@
|
|
17
22
|
data-track-label="<%= links[0][:href] %>"
|
18
23
|
data-track-dimension="<%= links[0][:text] %>"
|
19
24
|
data-track-dimension-index="29"
|
20
|
-
data-track-options='{"dimension96" : "<%= links[0][:tracking_id] %>" }'
|
25
|
+
data-track-options='{"dimension96" : "<%= links[0][:tracking_id] %>" }'
|
26
|
+
<% if ga4_tracking %>
|
27
|
+
data-ga4-link='{"event_name":"navigation", "type":"related content", "index":{"index_link": "1"}, "index_total":"1"}'
|
28
|
+
<% end %>
|
29
|
+
>
|
21
30
|
<%= links[0][:text] %>
|
22
31
|
</a>
|
23
32
|
</h2>
|
24
33
|
<% else %>
|
25
34
|
</h2>
|
26
35
|
<ul class="gem-c-step-nav-related__links">
|
27
|
-
<% links.
|
36
|
+
<% links.each_with_index do |link, index| %>
|
28
37
|
<li class="gem-c-step-nav-related__link-item">
|
29
38
|
<a href="<%= link[:href] %>"
|
30
39
|
class="govuk-link"
|
@@ -33,12 +42,16 @@
|
|
33
42
|
data-track-label="<%= link[:href] %>"
|
34
43
|
data-track-dimension="<%= link[:text] %>"
|
35
44
|
data-track-dimension-index="29"
|
36
|
-
data-track-options='{"dimension96" : "<%= link[:tracking_id] %>" }'
|
45
|
+
data-track-options='{"dimension96" : "<%= link[:tracking_id] %>" }'
|
46
|
+
<% if ga4_tracking %>
|
47
|
+
data-ga4-link='{"event_name":"navigation", "type":"related content", "index":{"index_link": "<%= index + 1 %>"}, "index_total": "<%= links.length %>"}'
|
48
|
+
<% end %>
|
49
|
+
>
|
37
50
|
<%= link[:text] %>
|
38
51
|
</a>
|
39
52
|
</li>
|
40
53
|
<% end %>
|
41
54
|
</ul>
|
42
55
|
<% end %>
|
43
|
-
|
44
|
-
<% end %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
@@ -1,4 +1,6 @@
|
|
1
1
|
<%
|
2
|
+
add_gem_component_stylesheet("table")
|
3
|
+
|
2
4
|
caption ||= nil
|
3
5
|
head ||= []
|
4
6
|
rows ||= []
|
@@ -16,7 +18,7 @@
|
|
16
18
|
<%= GovukPublishingComponents::AppHelpers::TableHelper.helper(self, caption, {
|
17
19
|
sortable: sortable,
|
18
20
|
filterable: filterable,
|
19
|
-
caption_classes: caption_classes,
|
21
|
+
caption_classes: caption_classes,
|
20
22
|
table_id: table_id
|
21
23
|
}) do |t| %>
|
22
24
|
|
@@ -32,3 +32,16 @@ examples:
|
|
32
32
|
inverse: true
|
33
33
|
context:
|
34
34
|
dark_background: true
|
35
|
+
with_ga4_tracking:
|
36
|
+
description: |
|
37
|
+
Adds GA4 tracking to the step by step nav header component when it is rendered as a breadcrumb. See the
|
38
|
+
[ga4-link-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
|
39
|
+
Note: tracking on regular breadcrumbs is enabled by default and does not require activating.
|
40
|
+
data:
|
41
|
+
ga4_tracking: true
|
42
|
+
content_item:
|
43
|
+
title: "A content item"
|
44
|
+
links:
|
45
|
+
part_of_step_navs:
|
46
|
+
- title: "Learn to drive a car: step by step"
|
47
|
+
base_path: "/micropigs-vs-micropugs"
|
@@ -157,3 +157,14 @@ examples:
|
|
157
157
|
- text: Arrange the funeral
|
158
158
|
href: "/after-a-death/arrange-the-funeral"
|
159
159
|
optional: false
|
160
|
+
with_ga4_tracking_on_part_of_step_by_step_heading(s):
|
161
|
+
description: Adds Google Analytics 4 tracking to the "Part of" step by step heading(s) in the sidebar. Currently only the Related Navigation component, Step by Step navigation component and Ukraine CTA accept this option.
|
162
|
+
data:
|
163
|
+
ga4_tracking: true
|
164
|
+
content_item:
|
165
|
+
links:
|
166
|
+
part_of_step_navs:
|
167
|
+
- title: "Choosing a micropig or micropug: step by step"
|
168
|
+
base_path: "/micropigs-vs-micropugs"
|
169
|
+
- title: "Walk your micropig: step by step"
|
170
|
+
base_path: "/porgs-step-by-step"
|
@@ -51,3 +51,9 @@ examples:
|
|
51
51
|
tracking_action: "customTrackingAction"
|
52
52
|
tracking_label: "customTrackingLabel"
|
53
53
|
tracking_dimension_enabled: false
|
54
|
+
with_ga4_tracking:
|
55
|
+
description: The ga4_tracking boolean allows you to add Google Analytics 4 (GA4) tracking to your component. Setting this to true will add the `ga4-link-tracker` module to your component. The JavaScript will then add a `data-ga4-link` attribute which contains a JSON object with data relevant to our tracking. See the [ga4-link-tracker docs](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
|
56
|
+
data:
|
57
|
+
ga4_tracking: true
|
58
|
+
title: 'Learn to drive a motorbike: step by step'
|
59
|
+
path: /learn-to-drive-a-motorbike
|
@@ -76,3 +76,13 @@ examples:
|
|
76
76
|
text: 'Learn to drive a motorbike: step by step'
|
77
77
|
}
|
78
78
|
]
|
79
|
+
with_ga4_tracking:
|
80
|
+
description: The ga4_tracking boolean allows you to add Google Analytics 4 (GA4) tracking to your component. Setting this to true will add the `ga4-link-tracker` module to your component. The JavaScript will then add a `data-ga4-link` attribute which contains a JSON object with data relevant to our tracking. See the [ga4-link-tracker docs](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
|
81
|
+
data:
|
82
|
+
ga4_tracking: true
|
83
|
+
links: [
|
84
|
+
{
|
85
|
+
href: '#',
|
86
|
+
text: 'With ga4 tracking'
|
87
|
+
}
|
88
|
+
]
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module AppHelpers
|
3
|
+
module AssetHelper
|
4
|
+
# This is a list of all the components that have stylesheets - so a new
|
5
|
+
# component needs to be added to this list rather than being laboriously
|
6
|
+
# added and removed from every single rendering application.
|
7
|
+
COMPONENT_CSS_PATHS = Dir.glob("#{GovukPublishingComponents::Config.gem_directory}/app/assets/stylesheets/govuk_publishing_components/components/_*.scss").map { |path|
|
8
|
+
filename = path.split("/").last
|
9
|
+
component_name = filename.sub("_", "").sub(".scss", "")
|
10
|
+
"govuk_publishing_components/components/_#{component_name}.css"
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
# This list includes components already included in Static; taken from
|
14
|
+
# https://github.com/alphagov/static/blob/198a598682df40ce4a2c3c286c06244297c18cf0/app/assets/stylesheets/application.scss
|
15
|
+
|
16
|
+
# This is used to dedupe stylesheets.
|
17
|
+
STATIC_STYLESHEET_LIST = %w[
|
18
|
+
govuk_publishing_components/components/_breadcrumbs.css
|
19
|
+
govuk_publishing_components/components/_button.css
|
20
|
+
govuk_publishing_components/components/_error-message.css
|
21
|
+
govuk_publishing_components/components/_heading.css
|
22
|
+
govuk_publishing_components/components/_hint.css
|
23
|
+
govuk_publishing_components/components/_input.css
|
24
|
+
govuk_publishing_components/components/_label.css
|
25
|
+
govuk_publishing_components/components/_search.css
|
26
|
+
govuk_publishing_components/components/_skip-link.css
|
27
|
+
govuk_publishing_components/components/_textarea.css
|
28
|
+
govuk_publishing_components/components/_title.css
|
29
|
+
|
30
|
+
govuk_publishing_components/components/_cookie-banner.css
|
31
|
+
govuk_publishing_components/components/_feedback.css
|
32
|
+
govuk_publishing_components/components/_layout-footer.css
|
33
|
+
govuk_publishing_components/components/_layout-for-public.css
|
34
|
+
govuk_publishing_components/components/_layout-header.css
|
35
|
+
govuk_publishing_components/components/_layout-super-navigation-header.css
|
36
|
+
].freeze
|
37
|
+
|
38
|
+
def add_stylesheet_path(component_path)
|
39
|
+
unless is_already_used?(component_path)
|
40
|
+
all_component_stylesheets_being_used << component_path
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Used to add a component that exists in the gem to the list
|
45
|
+
def add_gem_component_stylesheet(gem_component)
|
46
|
+
add_stylesheet_path("govuk_publishing_components/components/_#{gem_component}.css")
|
47
|
+
end
|
48
|
+
|
49
|
+
# Used to add a component that exists in the application to the list
|
50
|
+
def add_app_component_stylesheet(app_component)
|
51
|
+
add_stylesheet_path("components/_#{app_component}.css")
|
52
|
+
end
|
53
|
+
|
54
|
+
# Some applications have view-specific stylesheets - use this method
|
55
|
+
# to add them to the list
|
56
|
+
def add_view_stylesheet(view_component)
|
57
|
+
add_stylesheet_path("views/_#{view_component}.css")
|
58
|
+
end
|
59
|
+
|
60
|
+
def all_component_stylesheets_being_used
|
61
|
+
@all_component_stylesheets_being_used ||= []
|
62
|
+
end
|
63
|
+
|
64
|
+
def render_component_stylesheets
|
65
|
+
list_of_stylesheets = all_component_stylesheets_being_used.map do |component|
|
66
|
+
stylesheet_link_tag(component, integrity: false)
|
67
|
+
end
|
68
|
+
raw(list_of_stylesheets.join(""))
|
69
|
+
end
|
70
|
+
|
71
|
+
def get_component_css_paths
|
72
|
+
COMPONENT_CSS_PATHS
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def is_already_used?(component)
|
78
|
+
if GovukPublishingComponents::Config.exclude_css_from_static
|
79
|
+
all_component_stylesheets_being_used.include?(component) || STATIC_STYLESHEET_LIST.include?(component)
|
80
|
+
else
|
81
|
+
all_component_stylesheets_being_used.include?(component)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -15,6 +15,9 @@ module GovukPublishingComponents
|
|
15
15
|
mattr_accessor :application_javascript
|
16
16
|
self.application_javascript = "application"
|
17
17
|
|
18
|
+
mattr_accessor :exclude_css_from_static
|
19
|
+
self.exclude_css_from_static = true
|
20
|
+
|
18
21
|
def self.component_directory_name
|
19
22
|
APP_COMPONENT_DIRECTORY
|
20
23
|
end
|
@@ -3,10 +3,11 @@ module GovukPublishingComponents
|
|
3
3
|
class BreadcrumbSelector
|
4
4
|
attr_reader :content_item, :request, :prioritise_taxon_breadcrumbs
|
5
5
|
|
6
|
-
def initialize(content_item, request, prioritise_taxon_breadcrumbs)
|
6
|
+
def initialize(content_item, request, prioritise_taxon_breadcrumbs, ga4_tracking)
|
7
7
|
@content_item = content_item
|
8
8
|
@request = request
|
9
9
|
@prioritise_taxon_breadcrumbs = prioritise_taxon_breadcrumbs
|
10
|
+
@ga4_tracking = ga4_tracking
|
10
11
|
end
|
11
12
|
|
12
13
|
def breadcrumbs
|
@@ -37,7 +38,7 @@ module GovukPublishingComponents
|
|
37
38
|
elsif navigation.content_tagged_to_current_step_by_step?
|
38
39
|
{
|
39
40
|
step_by_step: true,
|
40
|
-
breadcrumbs: navigation.step_nav_helper.header,
|
41
|
+
breadcrumbs: navigation.step_nav_helper.header(@ga4_tracking),
|
41
42
|
}
|
42
43
|
elsif navigation.content_is_tagged_to_a_live_taxon? && prioritise_taxon_breadcrumbs
|
43
44
|
{
|
@@ -82,12 +82,13 @@ module GovukPublishingComponents
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
def header
|
85
|
+
def header(ga4_tracking)
|
86
86
|
if show_header?
|
87
87
|
{
|
88
88
|
title: current_step_nav.title,
|
89
89
|
path: current_step_nav.base_path,
|
90
90
|
tracking_id: current_step_nav.content_id,
|
91
|
+
ga4_tracking: ga4_tracking,
|
91
92
|
}
|
92
93
|
else
|
93
94
|
{}
|
@@ -69,7 +69,7 @@ module GovukPublishingComponents
|
|
69
69
|
# Force English so we can still understand what is being tracked if translated.
|
70
70
|
underscores_to_spaces = true
|
71
71
|
underscores_to_spaces = false if section == "related_content"
|
72
|
-
I18n.with_locale(
|
72
|
+
I18n.with_locale(:en) do
|
73
73
|
construct_section_text(section, underscores_to_spaces)
|
74
74
|
end
|
75
75
|
end
|
@@ -40,6 +40,9 @@ require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
|
|
40
40
|
require "govuk_publishing_components/app_helpers/table_helper"
|
41
41
|
require "govuk_publishing_components/app_helpers/brand_helper"
|
42
42
|
require "govuk_publishing_components/app_helpers/environment"
|
43
|
+
require "govuk_publishing_components/app_helpers/asset_helper"
|
44
|
+
|
45
|
+
require "govuk_publishing_components/railtie" if defined?(Rails::Railtie)
|
43
46
|
|
44
47
|
# Add i18n paths and views for usage outside of a Rails app
|
45
48
|
I18n.load_path.unshift(
|
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: 34.
|
4
|
+
version: 34.14.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: 2023-
|
11
|
+
date: 2023-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -525,6 +525,7 @@ files:
|
|
525
525
|
- app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js
|
526
526
|
- app/assets/stylesheets/component_guide/application.scss
|
527
527
|
- app/assets/stylesheets/govuk_publishing_components/_all_components.scss
|
528
|
+
- app/assets/stylesheets/govuk_publishing_components/_individual_component_support.scss
|
528
529
|
- app/assets/stylesheets/govuk_publishing_components/component_support.scss
|
529
530
|
- app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss
|
530
531
|
- app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss
|
@@ -905,6 +906,7 @@ files:
|
|
905
906
|
- lib/generators/govuk_publishing_components/templates/_component.scss
|
906
907
|
- lib/generators/govuk_publishing_components/templates/component.yml.erb
|
907
908
|
- lib/govuk_publishing_components.rb
|
909
|
+
- lib/govuk_publishing_components/app_helpers/asset_helper.rb
|
908
910
|
- lib/govuk_publishing_components/app_helpers/brand_helper.rb
|
909
911
|
- lib/govuk_publishing_components/app_helpers/environment.rb
|
910
912
|
- lib/govuk_publishing_components/app_helpers/table_helper.rb
|
@@ -957,6 +959,7 @@ files:
|
|
957
959
|
- lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
|
958
960
|
- lib/govuk_publishing_components/presenters/subscription_links_helper.rb
|
959
961
|
- lib/govuk_publishing_components/presenters/translation_nav_helper.rb
|
962
|
+
- lib/govuk_publishing_components/railtie.rb
|
960
963
|
- lib/govuk_publishing_components/version.rb
|
961
964
|
- node_modules/axe-core/LICENSE
|
962
965
|
- node_modules/axe-core/README.md
|