govuk_publishing_components 37.1.0 → 37.1.1
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.
- checksums.yaml +4 -4
- data/app/assets/config/govuk_publishing_components_manifest.js +0 -2
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +5 -0
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +7 -3
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -5
- data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +5 -1
- data/lib/govuk_publishing_components/presenters/absolute_links_helper.rb +20 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6371bbc7ca91fdd7a004050d47b2f09ac4d55244a8c7475692022e87af313b80
|
|
4
|
+
data.tar.gz: aa375ef7ebb426df626123c3832df1b926b562633c36d8af8202a82cff4d1f65
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bc4e2777a12f8a6e6a68de36a0d4bb92d6d5f97e2b16e1a07eb264285c0a5f97c2b0b0d205946c570436368dc7319da9c5796de4c97a700939e3be39f27b120
|
|
7
|
+
data.tar.gz: 24472468c3ebe08a695d1a1f3b03f7e2a21a1850257d8ca0a121663a1ff3d9176de1421746c0e292b589d7f08f7127ec1670946349e2e830ebb080cd1964e9a8
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
classes = %w(gem-c-layout-footer govuk-footer)
|
|
8
8
|
classes << "gem-c-layout-footer--border" if with_border
|
|
9
9
|
layout_footer_helper = GovukPublishingComponents::Presenters::LayoutFooterHelper.new(navigation, meta)
|
|
10
|
+
absolute_links_helper = GovukPublishingComponents::Presenters::AbsoluteLinksHelper.new()
|
|
10
11
|
%>
|
|
11
12
|
<%= tag.footer class: classes, role: "contentinfo", 'data-module': "ga4-link-tracker" do %>
|
|
12
13
|
<div class="govuk-width-container">
|
|
@@ -51,6 +52,8 @@
|
|
|
51
52
|
unless attributes[:data][:ga4_link]
|
|
52
53
|
attributes[:data][:ga4_link] = layout_footer_helper.generate_ga4_link_attribute(index, ga4_section_index, section[:title], index_total)
|
|
53
54
|
end
|
|
55
|
+
|
|
56
|
+
item[:href] = absolute_links_helper.make_url_absolute(item[:href])
|
|
54
57
|
%>
|
|
55
58
|
<%= link_to item[:text], item[:href], attributes %>
|
|
56
59
|
</li>
|
|
@@ -82,6 +85,8 @@
|
|
|
82
85
|
unless attributes[:data][:ga4_link]
|
|
83
86
|
attributes[:data][:ga4_link] = layout_footer_helper.generate_ga4_link_attribute(index, navigation.length, "Support links", index_total)
|
|
84
87
|
end
|
|
88
|
+
|
|
89
|
+
item[:href] = absolute_links_helper.make_url_absolute(item[:href])
|
|
85
90
|
%>
|
|
86
91
|
<%= link_to item[:text], item[:href], attributes %>
|
|
87
92
|
</li>
|
data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb
CHANGED
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
|
|
71
71
|
popular_links_heading_classes = %w(govuk-heading-m)
|
|
72
72
|
popular_links_heading_classes << "gem-c-layout-super-navigation-header__popular-links-heading--large-navbar" if large_navbar
|
|
73
|
+
|
|
74
|
+
absolute_links_helper = GovukPublishingComponents::Presenters::AbsoluteLinksHelper.new()
|
|
73
75
|
%>
|
|
74
76
|
<%= content_tag("header",
|
|
75
77
|
{
|
|
@@ -311,9 +313,10 @@
|
|
|
311
313
|
link_classes = %w[govuk-link gem-c-layout-super-navigation-header__navigation-second-item-link]
|
|
312
314
|
link_classes << "gem-c-layout-super-navigation-header__navigation-second-item-link--with-description" if has_description
|
|
313
315
|
tracking_label = column[:label].downcase.gsub(/\s+/, "")
|
|
316
|
+
link_href = absolute_links_helper.make_url_absolute(item[:href])
|
|
314
317
|
%>
|
|
315
318
|
<li class="gem-c-layout-super-navigation-header__dropdown-list-item">
|
|
316
|
-
<%= link_to item[:label],
|
|
319
|
+
<%= link_to item[:label], link_href, {
|
|
317
320
|
class: link_classes,
|
|
318
321
|
data: {
|
|
319
322
|
track_action: "#{tracking_label}Link",
|
|
@@ -360,7 +363,7 @@
|
|
|
360
363
|
data-ga4-form='{ "event_name": "search", "type": "header menu bar", "section": "Search GOV.UK", "action": "search", "url": "/search/all" }'
|
|
361
364
|
data-ga4-form-include-text
|
|
362
365
|
data-ga4-form-no-answer-undefined
|
|
363
|
-
action="/search"
|
|
366
|
+
action="<%= absolute_links_helper.make_url_absolute('/search') %>"
|
|
364
367
|
method="get"
|
|
365
368
|
role="search"
|
|
366
369
|
aria-label="Site-wide"
|
|
@@ -394,7 +397,8 @@
|
|
|
394
397
|
<% index_total = popular_links.length %>
|
|
395
398
|
<% popular_links.each_with_index do | popular_link, index | %>
|
|
396
399
|
<li class="gem-c-layout-super-navigation-header__popular-item">
|
|
397
|
-
|
|
400
|
+
<% link_href = absolute_links_helper.make_url_absolute(popular_link[:href]) %>
|
|
401
|
+
<%= link_to popular_link[:label], link_href, {
|
|
398
402
|
class: [
|
|
399
403
|
"govuk-link",
|
|
400
404
|
"gem-c-layout-super-navigation-header__popular-link",
|
|
@@ -65,11 +65,7 @@
|
|
|
65
65
|
class="gem-c-metadata__definition-link govuk-!-display-none-print js-see-all-updates-link"
|
|
66
66
|
data-track-category="content-history"
|
|
67
67
|
data-track-action="see-all-updates-link-clicked"
|
|
68
|
-
data-track-label="history"
|
|
69
|
-
<% unless disable_ga4 %>
|
|
70
|
-
data-module="ga4-link-tracker"
|
|
71
|
-
data-ga4-link="<%= ga4_object %>"
|
|
72
|
-
<% end%>>
|
|
68
|
+
data-track-label="history">
|
|
73
69
|
<%= t("components.metadata.see_all_updates") %>
|
|
74
70
|
</a>
|
|
75
71
|
<% end %>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
<%
|
|
2
|
+
absolute_links_helper = GovukPublishingComponents::Presenters::AbsoluteLinksHelper.new()
|
|
3
|
+
%>
|
|
4
|
+
|
|
5
|
+
<form action="<%= absolute_links_helper.make_url_absolute('/contact/govuk/problem_reports') %>"
|
|
2
6
|
id="something-is-wrong"
|
|
3
7
|
class="gem-c-feedback__form js-feedback-form"
|
|
4
8
|
data-track-category="Onsite Feedback"
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
<%
|
|
2
|
+
absolute_links_helper = GovukPublishingComponents::Presenters::AbsoluteLinksHelper.new()
|
|
3
|
+
%>
|
|
4
|
+
|
|
5
|
+
<form action="<%= absolute_links_helper.make_url_absolute('/contact/govuk/email-survey-signup') %>"
|
|
2
6
|
id="page-is-not-useful"
|
|
3
7
|
class="gem-c-feedback__form gem-c-feedback__form--email gem-c-feedback__js-show js-feedback-form"
|
|
4
8
|
data-track-category="yesNoFeedbackForm"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module GovukPublishingComponents
|
|
2
|
+
module Presenters
|
|
3
|
+
class AbsoluteLinksHelper
|
|
4
|
+
def make_url_absolute(href)
|
|
5
|
+
# If the URL is already absolute do nothing
|
|
6
|
+
unless href.start_with?("/")
|
|
7
|
+
return href
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
host = ENV["VIRTUAL_HOST"] || Plek.new.website_root
|
|
11
|
+
|
|
12
|
+
unless host.start_with?("http://", "https://", "//")
|
|
13
|
+
host = "//#{host}" # '//' preserves the current protocol, we shouldn't force https as that would break dev environments
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
"#{host}#{href}"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -7,6 +7,7 @@ require "govuk_publishing_components/engine"
|
|
|
7
7
|
require "govuk_publishing_components/version"
|
|
8
8
|
require "govuk_publishing_components/presenters/shared_helper"
|
|
9
9
|
require "govuk_publishing_components/presenters/component_wrapper_helper"
|
|
10
|
+
require "govuk_publishing_components/presenters/absolute_links_helper"
|
|
10
11
|
require "govuk_publishing_components/presenters/accordion_helper"
|
|
11
12
|
require "govuk_publishing_components/presenters/attachment_helper"
|
|
12
13
|
require "govuk_publishing_components/presenters/big_number_helper"
|
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: 37.1.
|
|
4
|
+
version: 37.1.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-12-
|
|
11
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: govuk_app_config
|
|
@@ -943,6 +943,7 @@ files:
|
|
|
943
943
|
- lib/govuk_publishing_components/config.rb
|
|
944
944
|
- lib/govuk_publishing_components/engine.rb
|
|
945
945
|
- lib/govuk_publishing_components/minitest/component_guide_test.rb
|
|
946
|
+
- lib/govuk_publishing_components/presenters/absolute_links_helper.rb
|
|
946
947
|
- lib/govuk_publishing_components/presenters/accordion_helper.rb
|
|
947
948
|
- lib/govuk_publishing_components/presenters/attachment_helper.rb
|
|
948
949
|
- lib/govuk_publishing_components/presenters/big_number_helper.rb
|
|
@@ -1496,7 +1497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1496
1497
|
- !ruby/object:Gem::Version
|
|
1497
1498
|
version: '0'
|
|
1498
1499
|
requirements: []
|
|
1499
|
-
rubygems_version: 3.
|
|
1500
|
+
rubygems_version: 3.5.1
|
|
1500
1501
|
signing_key:
|
|
1501
1502
|
specification_version: 4
|
|
1502
1503
|
summary: A gem to document components in GOV.UK frontend applications
|