govuk_publishing_components 24.13.3 → 24.13.4
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/javascripts/govuk_publishing_components/analytics/analytics.js +3 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +2 -0
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +5 -3
- data/app/assets/javascripts/govuk_publishing_components/components/contextual-guidance.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js +9 -9
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +3 -3
- data/app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js +5 -3
- data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +49 -7
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +15 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48d13ec5bd03475381c42cb9e3fbdb32118e851c82a2021462994e0af0cbe042
|
4
|
+
data.tar.gz: 30b3eaa8d62c9fe6eab0c48b65667329e9ae99d955f584cd37009dc59daeb254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83f0878e78d24711ed4fa7694d4becac691474370c29b33b355faed6dc98b98619af4f22bb6d3bdd70a787c510d93ac3cf8659d78ff7b009a3a46bbce93a9a50
|
7
|
+
data.tar.gz: 919f5697fbba2e55d2709e24750af0f3d3d07836958c0a09ece0cba6a5ee8e4634e58b99230303eb6ce88f467e5a4e99ced6a3bf3de527fb7ef1b4c2e7fd344a
|
@@ -41,7 +41,9 @@
|
|
41
41
|
// we ignore the possibility of there being campaign variables in the
|
42
42
|
// anchor because we wouldn't know how to detect and parse them if they
|
43
43
|
// were present
|
44
|
-
|
44
|
+
// IE can't access window.location.origin, so we have to do this slightly complex thing
|
45
|
+
var root = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '')
|
46
|
+
return this.pii.stripPIIFromString(location.href.substring(root.length).split('#')[0])
|
45
47
|
}
|
46
48
|
|
47
49
|
Analytics.prototype.trackPageview = function (path, title, options) {
|
@@ -33,7 +33,9 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
|
|
33
33
|
if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
|
34
34
|
// Where checkboxes are manipulated externally in finders, `suppressAnalytics`
|
35
35
|
// is passed to prevent duplicate GA events.
|
36
|
-
|
36
|
+
// use Oliver Steele's Nested Object Access Pattern https://hackernoon.com/accessing-nested-objects-in-javascript-f02f1bd6387f
|
37
|
+
var allowAnalytics = ((event || {}).detail || {}).suppressAnalytics !== true
|
38
|
+
if (allowAnalytics) {
|
37
39
|
var $checkbox = event.target
|
38
40
|
var category = $checkbox.getAttribute('data-track-category')
|
39
41
|
if (category) {
|
@@ -100,11 +102,11 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
|
|
100
102
|
var $exclusiveOption = $checkboxes.querySelector('input[type=checkbox][data-exclusive]')
|
101
103
|
var $nonExclusiveOptions = $checkboxes.querySelectorAll('input[type=checkbox]:not([data-exclusive])')
|
102
104
|
|
103
|
-
if ($currentCheckbox.
|
105
|
+
if ($currentCheckbox.getAttribute('data-exclusive') === 'true' && $currentCheckbox.checked === true) {
|
104
106
|
for (var i = 0; i < $nonExclusiveOptions.length; i++) {
|
105
107
|
$nonExclusiveOptions[i].checked = false
|
106
108
|
}
|
107
|
-
} else if ($currentCheckbox.
|
109
|
+
} else if ($currentCheckbox.getAttribute('data-exclusive') !== 'true' && $currentCheckbox.checked === true) {
|
108
110
|
if ($exclusiveOption) {
|
109
111
|
$exclusiveOption.checked = false
|
110
112
|
}
|
@@ -15,7 +15,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
15
15
|
|
16
16
|
ContextualGuidance.prototype.handleFocus = function (event) {
|
17
17
|
this.hideAllGuidance()
|
18
|
-
if (!event.target.
|
18
|
+
if (!event.target.getAttribute('data-contextual-guidance-hide-only')) {
|
19
19
|
this.$guidance.style.display = 'block'
|
20
20
|
}
|
21
21
|
}
|
@@ -26,14 +26,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
26
26
|
}
|
27
27
|
|
28
28
|
var boundOnClickUpButton = this.onClickUpButton.bind(this)
|
29
|
-
this.$upButtons.
|
30
|
-
|
31
|
-
}
|
29
|
+
for (var u = 0; u < this.$upButtons.length; u++) {
|
30
|
+
this.$upButtons[u].addEventListener('click', boundOnClickUpButton)
|
31
|
+
}
|
32
32
|
|
33
33
|
var boundOnClickDownButton = this.onClickDownButton.bind(this)
|
34
|
-
this.$downButtons.
|
35
|
-
|
36
|
-
}
|
34
|
+
for (var d = 0; d < this.$downButtons.length; d++) {
|
35
|
+
this.$downButtons[d].addEventListener('click', boundOnClickDownButton)
|
36
|
+
}
|
37
37
|
}
|
38
38
|
|
39
39
|
ReorderableList.prototype.setupResponsiveChecks = function () {
|
@@ -85,9 +85,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
85
85
|
|
86
86
|
ReorderableList.prototype.updateOrderIndexes = function () {
|
87
87
|
var $orderInputs = this.$module.querySelectorAll('.gem-c-reorderable-list__actions input')
|
88
|
-
$orderInputs.
|
89
|
-
|
90
|
-
}
|
88
|
+
for (var i = 0; i < $orderInputs.length; i++) {
|
89
|
+
$orderInputs[i].setAttribute('value', i + 1)
|
90
|
+
}
|
91
91
|
}
|
92
92
|
|
93
93
|
ReorderableList.prototype.triggerEvent = function (element, eventName) {
|
@@ -462,11 +462,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
462
462
|
var allCharts = document.querySelectorAll('table.js-barchart-table')
|
463
463
|
var id = null
|
464
464
|
|
465
|
-
|
466
|
-
if (
|
465
|
+
for (var i = 0; i < allCharts.length; i++) {
|
466
|
+
if (allCharts[i] === module) {
|
467
467
|
id = i
|
468
468
|
}
|
469
|
-
}
|
469
|
+
}
|
470
470
|
|
471
471
|
return id
|
472
472
|
}
|
@@ -2,15 +2,17 @@
|
|
2
2
|
'use strict'
|
3
3
|
window.GOVUK = window.GOVUK || {}
|
4
4
|
|
5
|
-
window.GOVUK.triggerEvent = function (element, eventName) {
|
6
|
-
var params =
|
5
|
+
window.GOVUK.triggerEvent = function (element, eventName, parameters) {
|
6
|
+
var params = parameters || {}
|
7
|
+
params.bubbles = true
|
8
|
+
params.cancelable = true
|
7
9
|
var event
|
8
10
|
|
9
11
|
if (typeof window.CustomEvent === 'function') {
|
10
12
|
event = new window.CustomEvent(eventName, params)
|
11
13
|
} else {
|
12
14
|
event = document.createEvent('CustomEvent')
|
13
|
-
event.initCustomEvent(eventName, params.bubbles, params.cancelable,
|
15
|
+
event.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail)
|
14
16
|
}
|
15
17
|
|
16
18
|
element.dispatchEvent(event)
|
@@ -5,37 +5,79 @@
|
|
5
5
|
<nav id="proposition-menu" class="no-proposition-name gem-c-government-navigation" aria-label="Departments and policy navigation">
|
6
6
|
<ul id="proposition-links">
|
7
7
|
<li>
|
8
|
-
<a class="<%= 'active' if active == 'departments' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
8
|
+
<a class="<%= 'active' if active == 'departments' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
9
|
+
data-track-category="headerClicked"
|
10
|
+
data-track-action="departmentsLink"
|
11
|
+
data-track-label="/government/organisations"
|
12
|
+
data-track-dimension="<%= t("components.government_navigation.departments") %>"
|
13
|
+
data-track-dimension-index="29"
|
14
|
+
href="/government/organisations">
|
9
15
|
<%= t("components.government_navigation.departments") %>
|
10
16
|
</a>
|
11
17
|
</li>
|
12
18
|
<li>
|
13
|
-
<a class="<%= 'active' if active == 'worldwide' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
19
|
+
<a class="<%= 'active' if active == 'worldwide' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
20
|
+
data-track-category="headerClicked"
|
21
|
+
data-track-action="worldwideLink"
|
22
|
+
data-track-label="/world"
|
23
|
+
data-track-dimension="<%= t("components.government_navigation.worldwide") %>"
|
24
|
+
data-track-dimension-index="29"
|
25
|
+
href="/world">
|
14
26
|
<%= t("components.government_navigation.worldwide") %>
|
15
27
|
</a>
|
16
28
|
</li>
|
17
29
|
<li>
|
18
|
-
<a class="<%= 'active' if active == 'how-government-works' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
30
|
+
<a class="<%= 'active' if active == 'how-government-works' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
31
|
+
data-track-category="headerClicked"
|
32
|
+
data-track-action="governmentactivityLink"
|
33
|
+
data-track-label="/government/how-government-works"
|
34
|
+
data-track-dimension="<%= t("components.government_navigation.how-government-works") %>"
|
35
|
+
data-track-dimension-index="29"
|
36
|
+
href="/government/how-government-works">
|
19
37
|
<%= t("components.government_navigation.how-government-works") %>
|
20
38
|
</a>
|
21
39
|
</li>
|
22
40
|
<li>
|
23
|
-
<a class="<%= 'active' if active == 'get-involved' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
41
|
+
<a class="<%= 'active' if active == 'get-involved' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
42
|
+
data-track-category="headerClicked"
|
43
|
+
data-track-action="governmentactivityLink"
|
44
|
+
data-track-label="/government/get-involved"
|
45
|
+
data-track-dimension="<%= t("components.government_navigation.get-involved") %>"
|
46
|
+
data-track-dimension-index="29"
|
47
|
+
href="/government/get-involved">
|
24
48
|
<%= t("components.government_navigation.get-involved") %>
|
25
49
|
</a>
|
26
50
|
</li>
|
27
51
|
<li class="clear-child">
|
28
|
-
<a class="<%= 'active' if active == 'consultations' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
52
|
+
<a class="<%= 'active' if active == 'consultations' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
53
|
+
data-track-category="headerClicked"
|
54
|
+
data-track-action="governmentactivityLink"
|
55
|
+
data-track-label="/government/get-involved"
|
56
|
+
data-track-dimension="<%= t("components.government_navigation.consultations") %>"
|
57
|
+
data-track-dimension-index="29"
|
58
|
+
href="<%= CGI::escapeHTML('/search/policy-papers-and-consultations?content_store_document_type[]=open_consultations&content_store_document_type[]=closed_consultations') %>">
|
29
59
|
<%= t("components.government_navigation.consultations") %>
|
30
60
|
</a>
|
31
61
|
</li>
|
32
62
|
<li>
|
33
|
-
<a class="<%= 'active' if active == 'statistics' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
63
|
+
<a class="<%= 'active' if active == 'statistics' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
64
|
+
data-track-category="headerClicked"
|
65
|
+
data-track-action="governmentactivityLink"
|
66
|
+
data-track-label="/government/research-and-statistics"
|
67
|
+
data-track-dimension="<%= t("components.government_navigation.statistics") %>"
|
68
|
+
data-track-dimension-index="29"
|
69
|
+
href="/search/research-and-statistics">
|
34
70
|
<%= t("components.government_navigation.statistics") %>
|
35
71
|
</a>
|
36
72
|
</li>
|
37
73
|
<li>
|
38
|
-
<a class="<%= 'active' if active == 'announcements' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
74
|
+
<a class="<%= 'active' if active == 'announcements' %> govuk-link govuk-link--no-underline govuk-link--inverse"
|
75
|
+
data-track-category="headerClicked"
|
76
|
+
data-track-action="governmentactivityLink"
|
77
|
+
data-track-label="/search/news-and-communications"
|
78
|
+
data-track-dimension="<%= t("components.government_navigation.news_and_communications") %>"
|
79
|
+
data-track-dimension-index="29"
|
80
|
+
href="/search/news-and-communications">
|
39
81
|
<%= t("components.government_navigation.news_and_communications") %>
|
40
82
|
</a>
|
41
83
|
</li>
|
@@ -11,6 +11,12 @@ module GovukPublishingComponents
|
|
11
11
|
transition_period: "d6c2de5d-ef90-45d1-82d4-5f2438369eea",
|
12
12
|
}.freeze
|
13
13
|
|
14
|
+
BREXIT_TAXONS = {
|
15
|
+
brexit: "d6c2de5d-ef90-45d1-82d4-5f2438369eea",
|
16
|
+
brexit_business: "634fd193-8039-4a70-a059-919c34ff4bfc",
|
17
|
+
brexit_citizen: "614b2e65-56ac-4f8d-bb9c-d1a14167ba25",
|
18
|
+
}.freeze
|
19
|
+
|
14
20
|
# Returns the highest priority taxon that has a content_id matching those in PRIORITY_TAXONS
|
15
21
|
def self.call(content_item, query_parameters = nil)
|
16
22
|
new(content_item, query_parameters).breadcrumbs
|
@@ -35,7 +41,7 @@ module GovukPublishingComponents
|
|
35
41
|
title: taxon["title"],
|
36
42
|
path: taxon["base_path"],
|
37
43
|
tracking_category: "breadcrumbClicked",
|
38
|
-
tracking_action:
|
44
|
+
tracking_action: tracking_action,
|
39
45
|
tracking_label: content_item["base_path"],
|
40
46
|
tracking_dimension_enabled: false,
|
41
47
|
}
|
@@ -71,6 +77,14 @@ module GovukPublishingComponents
|
|
71
77
|
def preferred_priority_taxon
|
72
78
|
query_parameters["priority-taxon"] if query_parameters
|
73
79
|
end
|
80
|
+
|
81
|
+
def tracking_action
|
82
|
+
action = %w[superBreadcrumb]
|
83
|
+
action << "Brexitbusiness" if taxon["content_id"] == BREXIT_TAXONS[:brexit_business]
|
84
|
+
action << "Brexitcitizen" if taxon["content_id"] == BREXIT_TAXONS[:brexit_business]
|
85
|
+
action << "Brexitbusinessandcitizen" if taxon["content_id"] == BREXIT_TAXONS[:brexit]
|
86
|
+
action.join(" ")
|
87
|
+
end
|
74
88
|
end
|
75
89
|
end
|
76
90
|
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: 24.13.
|
4
|
+
version: 24.13.4
|
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: 2021-06-
|
11
|
+
date: 2021-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|