govuk_publishing_components 25.3.0 → 25.3.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/javascripts/govuk_publishing_components/analytics/track-click.js +6 -4
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +10 -6
- data/app/assets/stylesheets/component_guide/application.scss +0 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +4 -9
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +1 -1
- data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +3 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7604846e82e7d5741665c02447fd53ed8b8e144b93764dffaedf745a4751a4
|
4
|
+
data.tar.gz: bcb4e7566730869377d7c1570acc4dce95200267a3d3f79567d82a266d878d61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40cf20a95a9129391d7395f71421ebfcf38656427a2b2f6f9e309164513751080bbb5eee944633c5d42a4ab7051ac1a26215fce1e97f45d0c97bff5017dcb602
|
7
|
+
data.tar.gz: 3c2673f73683ca6375a62ec8c94ac7ee79bfd9a965cff5ba008d56f93a3c3fff41c473f2f9e79b74d0f2ba40fa23c093b805a782375b5030b1dc3eddd87404d2
|
@@ -24,24 +24,26 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
24
24
|
|
25
25
|
GemTrackClick.prototype.handleClick = function (target) {
|
26
26
|
var options = { transport: 'beacon' }
|
27
|
-
var
|
27
|
+
var linkUrl
|
28
28
|
|
29
29
|
// if clicked element hasn't got the right attributes, look for a parent that matches
|
30
30
|
if (!target.hasAttribute('data-track-category') && !target.hasAttribute('data-track-action')) {
|
31
|
-
|
31
|
+
linkUrl = target.getAttribute('href')
|
32
32
|
target = target.closest('[data-track-category][data-track-action]')
|
33
33
|
}
|
34
34
|
|
35
35
|
if (target) {
|
36
36
|
var category = target.getAttribute('data-track-category')
|
37
37
|
var action = target.getAttribute('data-track-action')
|
38
|
-
var label = target.getAttribute('data-track-label')
|
38
|
+
var label = target.getAttribute('data-track-label') || linkUrl
|
39
39
|
var value = target.getAttribute('data-track-value')
|
40
40
|
var dimension = target.getAttribute('data-track-dimension')
|
41
41
|
var dimensionIndex = target.getAttribute('data-track-dimension-index')
|
42
42
|
var extraOptions = target.getAttribute('data-track-options')
|
43
43
|
|
44
|
-
|
44
|
+
if (label) {
|
45
|
+
options.label = label
|
46
|
+
}
|
45
47
|
|
46
48
|
if (value) {
|
47
49
|
options.value = value
|
@@ -27,11 +27,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
27
27
|
|
28
28
|
this.$acceptCookiesButton = this.$module.querySelector('button[data-accept-cookies]')
|
29
29
|
if (this.$acceptCookiesButton) {
|
30
|
+
this.$acceptCookiesButton.style.display = 'block'
|
30
31
|
this.$acceptCookiesButton.addEventListener('click', this.$module.setCookieConsent)
|
31
32
|
}
|
32
33
|
|
33
34
|
this.$rejectCookiesButton = this.$module.querySelector('button[data-reject-cookies]')
|
34
35
|
if (this.$rejectCookiesButton) {
|
36
|
+
this.$rejectCookiesButton.style.display = 'block'
|
35
37
|
this.$rejectCookiesButton.addEventListener('click', this.$module.rejectCookieConsent)
|
36
38
|
}
|
37
39
|
|
@@ -44,7 +46,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
44
46
|
var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('cookies_preferences_set') !== 'true')
|
45
47
|
|
46
48
|
if (shouldHaveCookieMessage) {
|
47
|
-
this.$module.
|
49
|
+
this.$module.style.display = 'block'
|
48
50
|
|
49
51
|
// Set the default consent cookie if it isn't already present
|
50
52
|
if (!window.GOVUK.cookie('cookies_policy')) {
|
@@ -53,16 +55,17 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
53
55
|
|
54
56
|
window.GOVUK.deleteUnconsentedCookies()
|
55
57
|
} else {
|
56
|
-
this.$module.
|
58
|
+
this.$module.style.display = 'none'
|
57
59
|
}
|
58
60
|
} else {
|
59
|
-
this.$module.
|
61
|
+
this.$module.style.display = 'none'
|
60
62
|
}
|
61
63
|
}
|
62
64
|
|
63
65
|
CookieBanner.prototype.hideCookieMessage = function (event) {
|
64
66
|
if (this.$module) {
|
65
|
-
this.$module.
|
67
|
+
this.$module.hidden = true
|
68
|
+
this.$module.style.display = 'none'
|
66
69
|
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
67
70
|
}
|
68
71
|
|
@@ -98,8 +101,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
98
101
|
CookieBanner.prototype.showConfirmationMessage = function () {
|
99
102
|
this.$cookieBannerMainContent = document.querySelector('.js-banner-wrapper')
|
100
103
|
|
101
|
-
this.$cookieBannerMainContent.
|
102
|
-
this.$module.cookieBannerConfirmationMessage.
|
104
|
+
this.$cookieBannerMainContent.hidden = true
|
105
|
+
this.$module.cookieBannerConfirmationMessage.style.display = 'block'
|
106
|
+
this.$module.cookieBannerConfirmationMessage.hidden = false
|
103
107
|
}
|
104
108
|
|
105
109
|
CookieBanner.prototype.isInCookiesPage = function () {
|
@@ -1,10 +1,9 @@
|
|
1
1
|
@import "govuk/components/cookie-banner/cookie-banner";
|
2
2
|
$govuk-cookie-banner-background: govuk-colour("light-grey", "grey-4");
|
3
3
|
|
4
|
-
.
|
5
|
-
|
6
|
-
|
7
|
-
display: none;
|
4
|
+
.js-enabled {
|
5
|
+
.gem-c-cookie-banner {
|
6
|
+
display: none; // shown with JS, always on for non-JS
|
8
7
|
}
|
9
8
|
}
|
10
9
|
|
@@ -15,13 +14,9 @@ $govuk-cookie-banner-background: govuk-colour("light-grey", "grey-4");
|
|
15
14
|
// can't be used without js so implement there
|
16
15
|
.gem-c-cookie-banner .gem-c-button {
|
17
16
|
display: none;
|
18
|
-
|
19
|
-
.js-enabled & {
|
20
|
-
display: block;
|
21
|
-
}
|
22
17
|
}
|
23
18
|
|
24
|
-
.gem-c-cookie-banner__confirmation
|
19
|
+
.gem-c-cookie-banner__confirmation {
|
25
20
|
display: none;
|
26
21
|
position: relative;
|
27
22
|
padding: govuk-spacing(1);
|
@@ -29,7 +29,7 @@
|
|
29
29
|
css_classes = %w(gem-c-cookie-banner govuk-clearfix)
|
30
30
|
css_classes << "gem-c-cookie-banner--services" if services_cookies
|
31
31
|
%>
|
32
|
-
<div id="<%= id %>" class="<%= css_classes.join(' ') %>" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet
|
32
|
+
<div id="<%= id %>" class="<%= css_classes.join(' ') %>" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet>
|
33
33
|
<div class="govuk-cookie-banner js-banner-wrapper" role="region" aria-label="<%= title %>">
|
34
34
|
<div class="gem-c-cookie-banner__message govuk-cookie-banner__message govuk-width-container">
|
35
35
|
<div class="govuk-grid-row">
|