govuk_publishing_components 16.29.0 → 17.0.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/javascripts/govuk_publishing_components/components/cookie-banner.js +46 -23
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +8 -2
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +101 -21
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +9 -2
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +4 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +36 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +14 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +23 -23
- data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +10 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +11 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +14 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +7 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +20 -16
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +5 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss +5 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +1 -1
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +33 -25
- data/app/views/govuk_publishing_components/components/_error_summary.html.erb +4 -2
- data/app/views/govuk_publishing_components/components/_notice.html.erb +4 -1
- data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -0
- data/app/views/govuk_publishing_components/components/docs/error_summary.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/notice.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +1 -1
- data/lib/govuk_publishing_components/presenters/cookie_banner_helper.rb +0 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js +1 -1
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js.map +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js.map +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js.map +1 -1
- data/node_modules/accessible-autocomplete/package.json +3 -3
- data/node_modules/accessible-autocomplete/src/autocomplete.js +4 -2
- data/node_modules/accessible-autocomplete/src/wrapper.js +5 -1
- data/node_modules/d/CHANGELOG.md +9 -0
- data/node_modules/d/CHANGES +4 -0
- data/node_modules/d/LICENSE +12 -16
- data/node_modules/d/README.md +49 -19
- data/node_modules/d/auto-bind.js +11 -10
- data/node_modules/d/index.js +23 -24
- data/node_modules/d/lazy.js +21 -23
- data/node_modules/d/package.json +63 -16
- data/node_modules/d/test/auto-bind.js +6 -7
- data/node_modules/d/test/index.js +78 -51
- data/node_modules/d/test/lazy.js +65 -50
- data/node_modules/es6-weak-map/CHANGELOG.md +5 -0
- data/node_modules/es6-weak-map/LICENSE +12 -16
- data/node_modules/es6-weak-map/README.md +34 -19
- data/node_modules/es6-weak-map/implement.js +9 -5
- data/node_modules/es6-weak-map/index.js +2 -2
- data/node_modules/es6-weak-map/is-implemented.js +10 -9
- data/node_modules/es6-weak-map/is-native-implemented.js +3 -3
- data/node_modules/es6-weak-map/is-weak-map.js +8 -8
- data/node_modules/es6-weak-map/package.json +30 -19
- data/node_modules/es6-weak-map/polyfill.js +31 -32
- data/node_modules/es6-weak-map/test/implement.js +4 -2
- data/node_modules/es6-weak-map/test/index.js +4 -3
- data/node_modules/es6-weak-map/test/is-implemented.js +9 -8
- data/node_modules/es6-weak-map/test/is-native-implemented.js +4 -2
- data/node_modules/es6-weak-map/test/is-weak-map.js +4 -4
- data/node_modules/es6-weak-map/test/polyfill.js +13 -13
- data/node_modules/es6-weak-map/test/valid-weak-map.js +22 -9
- data/node_modules/es6-weak-map/valid-weak-map.js +5 -5
- data/node_modules/resolve/lib/async.js +1 -1
- data/node_modules/resolve/lib/node-modules-paths.js +1 -1
- data/node_modules/resolve/lib/sync.js +0 -2
- data/node_modules/resolve/package.json +13 -13
- data/node_modules/resolve/test/node-modules-paths.js +0 -22
- data/node_modules/resolve/test/resolver.js +11 -0
- data/node_modules/resolve/test/resolver_sync.js +11 -0
- data/node_modules/standard/node_modules/ms/index.js +2 -2
- data/node_modules/standard/node_modules/ms/package.json +205 -16
- data/node_modules/standard/node_modules/ms/readme.md +1 -1
- data/node_modules/type/CHANGELOG.md +62 -0
- data/node_modules/type/README.md +743 -0
- data/node_modules/type/array-length/coerce.js +10 -0
- data/node_modules/type/array-length/ensure.js +10 -0
- data/node_modules/type/array-like/ensure.js +9 -0
- data/node_modules/type/array-like/is.js +21 -0
- data/node_modules/type/array/ensure.js +9 -0
- data/node_modules/type/array/is.js +27 -0
- data/node_modules/type/date/ensure.js +9 -0
- data/node_modules/type/date/is.js +26 -0
- data/node_modules/type/error/ensure.js +9 -0
- data/node_modules/type/error/is.js +24 -0
- data/node_modules/type/finite/coerce.js +8 -0
- data/node_modules/type/finite/ensure.js +10 -0
- data/node_modules/type/function/ensure.js +9 -0
- data/node_modules/type/function/is.js +19 -0
- data/node_modules/type/integer/coerce.js +11 -0
- data/node_modules/type/integer/ensure.js +10 -0
- data/node_modules/type/iterable/ensure.js +9 -0
- data/node_modules/type/iterable/is.js +20 -0
- data/node_modules/type/lib/is-to-string-tag-supported.js +3 -0
- data/node_modules/type/lib/resolve-exception.js +21 -0
- data/node_modules/type/lib/safe-to-string.js +10 -0
- data/node_modules/type/lib/to-short-string.js +29 -0
- data/node_modules/type/natural-number/coerce.js +10 -0
- data/node_modules/type/natural-number/ensure.js +10 -0
- data/node_modules/type/number/coerce.js +14 -0
- data/node_modules/type/number/ensure.js +10 -0
- data/node_modules/type/object/ensure.js +9 -0
- data/node_modules/type/object/is.js +11 -0
- data/node_modules/type/package.json +159 -0
- data/node_modules/type/plain-function/ensure.js +9 -0
- data/node_modules/type/plain-function/is.js +11 -0
- data/node_modules/type/plain-object/ensure.js +9 -0
- data/node_modules/type/plain-object/is.js +28 -0
- data/node_modules/type/promise/ensure.js +9 -0
- data/node_modules/type/promise/is.js +27 -0
- data/node_modules/type/prototype/is.js +13 -0
- data/node_modules/type/reg-exp/ensure.js +9 -0
- data/node_modules/type/reg-exp/is.js +37 -0
- data/node_modules/type/safe-integer/coerce.js +13 -0
- data/node_modules/type/safe-integer/ensure.js +10 -0
- data/node_modules/type/string/coerce.js +23 -0
- data/node_modules/type/string/ensure.js +10 -0
- data/node_modules/type/test/_lib/arrow-function-if-supported.js +4 -0
- data/node_modules/type/test/_lib/class-if-supported.js +4 -0
- data/node_modules/type/test/array-length/coerce.js +47 -0
- data/node_modules/type/test/array-length/ensure.js +19 -0
- data/node_modules/type/test/array-like/ensure.js +24 -0
- data/node_modules/type/test/array-like/is.js +47 -0
- data/node_modules/type/test/array/ensure.js +20 -0
- data/node_modules/type/test/array/is.js +41 -0
- data/node_modules/type/test/date/ensure.js +20 -0
- data/node_modules/type/test/date/is.js +46 -0
- data/node_modules/type/test/error/ensure.js +20 -0
- data/node_modules/type/test/error/is.js +42 -0
- data/node_modules/type/test/finite/coerce.js +40 -0
- data/node_modules/type/test/finite/ensure.js +17 -0
- data/node_modules/type/test/function/ensure.js +20 -0
- data/node_modules/type/test/function/is.js +46 -0
- data/node_modules/type/test/integer/coerce.js +49 -0
- data/node_modules/type/test/integer/ensure.js +17 -0
- data/node_modules/type/test/iterable/ensure.js +24 -0
- data/node_modules/type/test/iterable/is.js +50 -0
- data/node_modules/type/test/lib/is-to-string-tag-supported.js +10 -0
- data/node_modules/type/test/lib/resolve-exception.js +39 -0
- data/node_modules/type/test/lib/safe-to-string.js +32 -0
- data/node_modules/type/test/lib/to-short-string.js +41 -0
- data/node_modules/type/test/natural-number/coerce.js +47 -0
- data/node_modules/type/test/natural-number/ensure.js +19 -0
- data/node_modules/type/test/number/coerce.js +40 -0
- data/node_modules/type/test/number/ensure.js +17 -0
- data/node_modules/type/test/object/ensure.js +20 -0
- data/node_modules/type/test/object/is.js +30 -0
- data/node_modules/type/test/plain-function/ensure.js +20 -0
- data/node_modules/type/test/plain-function/is.js +56 -0
- data/node_modules/type/test/plain-object/ensure.js +20 -0
- data/node_modules/type/test/plain-object/is.js +47 -0
- data/node_modules/type/test/promise/ensure.js +20 -0
- data/node_modules/type/test/promise/is.js +39 -0
- data/node_modules/type/test/prototype/is.js +39 -0
- data/node_modules/type/test/reg-exp/ensure.js +20 -0
- data/node_modules/type/test/reg-exp/is.js +47 -0
- data/node_modules/type/test/safe-integer/coerce.js +49 -0
- data/node_modules/type/test/safe-integer/ensure.js +19 -0
- data/node_modules/type/test/string/coerce.js +36 -0
- data/node_modules/type/test/string/ensure.js +17 -0
- data/node_modules/type/test/thenable/ensure.js +20 -0
- data/node_modules/type/test/thenable/is.js +44 -0
- data/node_modules/type/test/time-value/coerce.js +47 -0
- data/node_modules/type/test/time-value/ensure.js +17 -0
- data/node_modules/type/test/value/ensure.js +20 -0
- data/node_modules/type/test/value/is.js +29 -0
- data/node_modules/type/thenable/ensure.js +9 -0
- data/node_modules/type/thenable/is.js +9 -0
- data/node_modules/type/time-value/coerce.js +12 -0
- data/node_modules/type/time-value/ensure.js +10 -0
- data/node_modules/type/value/ensure.js +9 -0
- data/node_modules/type/value/is.js +6 -0
- metadata +118 -21
- data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-navigation.scss +0 -94
- data/node_modules/resolve/reaf +0 -0
- data/node_modules/resolve/test/shadowed_core.js +0 -38
- data/node_modules/resolve/test/shadowed_core/node_modules/util/index.js +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed1bcff194d6bc6a10597abb3bbe2124905ccc3ce57325fb6821428a5bab6146
|
4
|
+
data.tar.gz: 12ebe47472df27104c8b895c8b6508438aa1beefebe93ace51973406090a92ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eddef82c2d0e79b00a3f67b51f4ad965b0c8a706fe9ea2494f528f5ca67e7ef36bb674f2c5ff07d9dff70f14438771eba2efe5a47e69eef4384bd15c37fb752e
|
7
|
+
data.tar.gz: c8df18bbdaad629df80e26201428186515fd1f9b93d8b28c47bc9ea7adb1d68b9e2a1b1ff4bb89a422a3d9d6dafb12340a94631f0989b9ea36c963c8888f0c87
|
@@ -10,43 +10,66 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
10
10
|
this.$module.showConfirmationMessage = this.showConfirmationMessage.bind(this)
|
11
11
|
this.$module.setCookieConsent = this.setCookieConsent.bind(this)
|
12
12
|
|
13
|
-
|
13
|
+
this.$module.newCookieBanner = document.querySelector('.gem-c-cookie-banner--new')
|
14
14
|
|
15
|
-
//
|
16
|
-
|
17
|
-
|
15
|
+
// Temporary check while we have 2 banners co-existing.
|
16
|
+
// Once the new banner has been deployed, we will be able to remove code relating to the old banner
|
17
|
+
// Separating the code out like this does mean some repetition, but will make it easier to remove later
|
18
|
+
if (this.$module.newCookieBanner) {
|
19
|
+
this.setupNewCookieMessage()
|
18
20
|
} else {
|
19
|
-
this
|
20
|
-
|
21
|
-
|
22
|
-
}
|
21
|
+
this.setupCookieMessage()
|
22
|
+
}
|
23
|
+
}
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
CookieBanner.prototype.setupCookieMessage = function () {
|
26
|
+
this.$hideLink = this.$module.querySelector('a[data-hide-cookie-banner]')
|
27
|
+
if (this.$hideLink) {
|
28
|
+
this.$hideLink.addEventListener('click', this.$module.hideCookieMessage)
|
29
|
+
}
|
30
|
+
|
31
|
+
this.showCookieMessage()
|
32
|
+
}
|
28
33
|
|
29
|
-
|
34
|
+
CookieBanner.prototype.setupNewCookieMessage = function () {
|
35
|
+
this.$hideLink = this.$module.querySelector('button[data-hide-cookie-banner]')
|
36
|
+
if (this.$hideLink) {
|
37
|
+
this.$hideLink.addEventListener('click', this.$module.hideCookieMessage)
|
30
38
|
}
|
39
|
+
|
40
|
+
this.$acceptCookiesLink = this.$module.querySelector('button[data-accept-cookies]')
|
41
|
+
if (this.$acceptCookiesLink) {
|
42
|
+
this.$acceptCookiesLink.addEventListener('click', this.$module.setCookieConsent)
|
43
|
+
}
|
44
|
+
|
45
|
+
this.showNewCookieMessage()
|
31
46
|
}
|
32
47
|
|
33
48
|
CookieBanner.prototype.showCookieMessage = function () {
|
34
|
-
var
|
35
|
-
|
36
|
-
if (
|
49
|
+
var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('seen_cookie_message') !== 'true')
|
50
|
+
|
51
|
+
if (shouldHaveCookieMessage) {
|
37
52
|
this.$module.style.display = 'block'
|
38
53
|
}
|
54
|
+
}
|
55
|
+
|
56
|
+
CookieBanner.prototype.showNewCookieMessage = function () {
|
57
|
+
var newCookieBanner = document.querySelector('.gem-c-cookie-banner--new')
|
58
|
+
|
59
|
+
// Hide the cookie banner on the cookie settings page, to avoid circular journeys
|
60
|
+
if (newCookieBanner && window.location.pathname === '/help/cookies') {
|
61
|
+
this.$module.style.display = 'none'
|
62
|
+
}
|
63
|
+
|
64
|
+
var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('seen_cookie_message') !== 'true')
|
39
65
|
|
40
|
-
if (
|
66
|
+
if (shouldHaveCookieMessage) {
|
67
|
+
this.$module.style.display = 'block'
|
68
|
+
|
69
|
+
// Set the default consent cookie if it isn't already present
|
41
70
|
if (!window.GOVUK.cookie('cookie_policy')) {
|
42
71
|
window.GOVUK.setDefaultConsentCookie()
|
43
72
|
}
|
44
|
-
} else if (!newCookieBanner) {
|
45
|
-
// Remove the consent cookie if we're using the old cookie banner
|
46
|
-
// TODO: this can be removed later when we switch to the new banner
|
47
|
-
if (window.GOVUK.cookie('cookie_policy')) {
|
48
|
-
window.GOVUK.cookie('cookie_policy', null)
|
49
|
-
}
|
50
73
|
}
|
51
74
|
}
|
52
75
|
|
@@ -123,7 +123,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
123
123
|
}
|
124
124
|
|
125
125
|
function showError (error) {
|
126
|
-
|
126
|
+
var genericError = [
|
127
127
|
'<h2 class="gem-c-feedback__heading">',
|
128
128
|
' Sorry, we’re unable to receive your message right now. ',
|
129
129
|
'</h2>',
|
@@ -131,8 +131,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
131
131
|
' feedback on the <a href="/contact/govuk">contact page</a>.</p>'
|
132
132
|
].join('')
|
133
133
|
|
134
|
+
// if the response is not a 404 or 500, show the error message if it exists
|
135
|
+
// otherwise show the generic message
|
136
|
+
// this covers the 422 status the feedback application return for empty fields
|
137
|
+
// for all other, show generic error
|
134
138
|
if (typeof (error.responseJSON) !== 'undefined') {
|
135
|
-
error = typeof (error.responseJSON.message) === 'undefined' ?
|
139
|
+
error = typeof (error.responseJSON.message) === 'undefined' ? genericError : error.responseJSON.message
|
140
|
+
} else {
|
141
|
+
error = genericError
|
136
142
|
}
|
137
143
|
var $errors = that.$activeForm.find('.js-errors')
|
138
144
|
$errors.html(error).removeClass(jshiddenClass).focus()
|
@@ -3,13 +3,33 @@
|
|
3
3
|
(function () {
|
4
4
|
'use strict'
|
5
5
|
var root = this
|
6
|
-
|
6
|
+
|
7
|
+
var DEFAULT_COOKIE_CONSENT = {
|
7
8
|
'essential': true,
|
8
9
|
'settings': true,
|
9
10
|
'usage': true,
|
10
11
|
'campaigns': true
|
11
12
|
}
|
12
13
|
|
14
|
+
var COOKIE_CATEGORIES = {
|
15
|
+
'TLSversion': 'usage',
|
16
|
+
'cookie_policy': 'essential',
|
17
|
+
'govuk_not_first_visit': 'essential',
|
18
|
+
'govuk_browser_upgrade_dismisssed': 'essential',
|
19
|
+
'seen_cookie_message': 'essential',
|
20
|
+
'govuk_surveySeenUserSatisfactionSurvey': 'essential',
|
21
|
+
'govuk_takenUserSatisfactionSurvey': 'essential',
|
22
|
+
'_email-alert-frontend_session': 'essential',
|
23
|
+
'global_bar_seen': 'essential',
|
24
|
+
'licensing_session': 'essential',
|
25
|
+
'govuk_contact_referrer': 'essential',
|
26
|
+
'JS-Detection': 'usage',
|
27
|
+
'_ga': 'usage',
|
28
|
+
'_gid': 'usage',
|
29
|
+
'_gat': 'usage',
|
30
|
+
'analytics_next_page_call': 'usage'
|
31
|
+
}
|
32
|
+
|
13
33
|
if (typeof root.GOVUK === 'undefined') { root.GOVUK = {} }
|
14
34
|
|
15
35
|
/*
|
@@ -40,7 +60,7 @@
|
|
40
60
|
}
|
41
61
|
|
42
62
|
window.GOVUK.setDefaultConsentCookie = function () {
|
43
|
-
window.GOVUK.setCookie('cookie_policy', JSON.stringify(
|
63
|
+
window.GOVUK.setCookie('cookie_policy', JSON.stringify(DEFAULT_COOKIE_CONSENT))
|
44
64
|
}
|
45
65
|
|
46
66
|
window.GOVUK.approveAllCookieTypes = function () {
|
@@ -65,37 +85,97 @@
|
|
65
85
|
window.GOVUK.setCookie('cookie_policy', JSON.stringify(deniedConsent))
|
66
86
|
}
|
67
87
|
|
68
|
-
window.GOVUK.
|
69
|
-
var
|
70
|
-
var
|
88
|
+
window.GOVUK.getConsentCookie = function () {
|
89
|
+
var consentCookie = window.GOVUK.cookie('cookie_policy')
|
90
|
+
var consentCookieObj
|
71
91
|
|
72
|
-
if (
|
73
|
-
|
92
|
+
if (consentCookie) {
|
93
|
+
try {
|
94
|
+
consentCookieObj = JSON.parse(consentCookie)
|
95
|
+
} catch (err) {
|
96
|
+
return null
|
97
|
+
}
|
98
|
+
|
99
|
+
if (typeof consentCookieObj !== 'object' && consentCookieObj !== null) {
|
100
|
+
consentCookieObj = JSON.parse(consentCookieObj)
|
101
|
+
}
|
74
102
|
} else {
|
75
|
-
|
103
|
+
return null
|
104
|
+
}
|
105
|
+
|
106
|
+
return consentCookieObj
|
107
|
+
}
|
108
|
+
|
109
|
+
window.GOVUK.setConsentCookie = function (options) {
|
110
|
+
var cookieConsent = window.GOVUK.getConsentCookie()
|
111
|
+
|
112
|
+
if (!cookieConsent) {
|
113
|
+
cookieConsent = DEFAULT_COOKIE_CONSENT
|
76
114
|
}
|
77
115
|
|
78
116
|
for (var cookieType in options) {
|
79
|
-
|
117
|
+
cookieConsent[cookieType] = options[cookieType]
|
80
118
|
}
|
81
119
|
|
82
|
-
window.GOVUK.setCookie('cookie_policy', JSON.stringify(
|
120
|
+
window.GOVUK.setCookie('cookie_policy', JSON.stringify(cookieConsent))
|
83
121
|
}
|
84
122
|
|
85
|
-
window.GOVUK.
|
86
|
-
|
87
|
-
|
123
|
+
window.GOVUK.checkConsentCookieCategory = function (cookieCategory) {
|
124
|
+
var currentConsentCookie = window.GOVUK.getConsentCookie()
|
125
|
+
|
126
|
+
// If the consent cookie doesn't exist, set the default consent cookie
|
127
|
+
if (!currentConsentCookie) {
|
128
|
+
window.GOVUK.setDefaultConsentCookie()
|
129
|
+
}
|
130
|
+
|
131
|
+
currentConsentCookie = window.GOVUK.getConsentCookie()
|
132
|
+
|
133
|
+
// Sometimes currentConsentCookie is malformed in some of the tests, so we need to handle these
|
134
|
+
try {
|
135
|
+
return currentConsentCookie[cookieCategory]
|
136
|
+
} catch (e) {
|
137
|
+
console.error(e)
|
138
|
+
return false
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
window.GOVUK.checkConsentCookie = function (cookieName, cookieValue) {
|
143
|
+
// If we're setting the consent cookie OR deleting a cookie, allow by default
|
144
|
+
if (cookieName === 'cookie_policy' || (cookieValue === null || cookieValue === false)) {
|
145
|
+
return true
|
146
|
+
}
|
147
|
+
|
148
|
+
// Survey cookies are dynamically generated, so we need to check for these separately
|
149
|
+
if (cookieName.match('^govuk_surveySeen') || cookieName.match('^govuk_taken')) {
|
150
|
+
return window.GOVUK.checkConsentCookieCategory('essential')
|
88
151
|
}
|
89
|
-
|
90
|
-
if (
|
91
|
-
var
|
92
|
-
|
93
|
-
|
152
|
+
|
153
|
+
if (COOKIE_CATEGORIES[cookieName]) {
|
154
|
+
var cookieCategory = COOKIE_CATEGORIES[cookieName]
|
155
|
+
|
156
|
+
return window.GOVUK.checkConsentCookieCategory(cookieCategory)
|
157
|
+
} else {
|
158
|
+
// Deny the cookie if it is not known to us
|
159
|
+
return false
|
94
160
|
}
|
95
|
-
|
96
|
-
|
161
|
+
}
|
162
|
+
|
163
|
+
window.GOVUK.setCookie = function (name, value, options) {
|
164
|
+
if (window.GOVUK.checkConsentCookie(name, value)) {
|
165
|
+
if (typeof options === 'undefined') {
|
166
|
+
options = {}
|
167
|
+
}
|
168
|
+
var cookieString = name + '=' + value + '; path=/'
|
169
|
+
if (options.days) {
|
170
|
+
var date = new Date()
|
171
|
+
date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000))
|
172
|
+
cookieString = cookieString + '; expires=' + date.toGMTString()
|
173
|
+
}
|
174
|
+
if (document.location.protocol === 'https:') {
|
175
|
+
cookieString = cookieString + '; Secure'
|
176
|
+
}
|
177
|
+
document.cookie = cookieString
|
97
178
|
}
|
98
|
-
document.cookie = cookieString
|
99
179
|
}
|
100
180
|
|
101
181
|
window.GOVUK.getCookie = function (name) {
|
data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
CHANGED
@@ -13,10 +13,12 @@ window.GOVUK = window.GOVUK || {};
|
|
13
13
|
YoutubeLinkEnhancement.prototype.init = function () {
|
14
14
|
var $youtubeLinks = this.$element.find('a[href*="youtube.com"], a[href*="youtu.be"]')
|
15
15
|
var _this = this
|
16
|
+
|
16
17
|
$youtubeLinks.each(function () {
|
17
18
|
var $link = $(this)
|
18
|
-
|
19
|
-
|
19
|
+
// if users have disabled 'campaigns' cookie in the new cookie page settings
|
20
|
+
// we also need to disable the youtube video embed
|
21
|
+
if (_this.hasDisabledEmbed($link) || !YoutubeLinkEnhancement.campaignCookies()) {
|
20
22
|
return true
|
21
23
|
}
|
22
24
|
|
@@ -61,6 +63,11 @@ window.GOVUK = window.GOVUK || {};
|
|
61
63
|
}
|
62
64
|
}
|
63
65
|
|
66
|
+
YoutubeLinkEnhancement.campaignCookies = function () {
|
67
|
+
var cookiePolicy = window.GOVUK.getCookie('cookie_policy') ? JSON.parse(window.GOVUK.getCookie('cookie_policy')) : 'undefined'
|
68
|
+
return cookiePolicy !== 'undefined' ? cookiePolicy.campaigns : true
|
69
|
+
}
|
70
|
+
|
64
71
|
YoutubeLinkEnhancement.nextId = function () {
|
65
72
|
this.embedCount = this.embedCount || 0
|
66
73
|
this.embedCount += 1
|
@@ -24,16 +24,14 @@ $gem-quiet-button-hover-colour: darken($gem-quiet-button-colour, 5%);
|
|
24
24
|
|
25
25
|
.gem-c-button--inline {
|
26
26
|
display: block;
|
27
|
+
width: 100%;
|
27
28
|
margin-bottom: govuk-spacing(1);
|
28
|
-
|
29
|
-
@include govuk-media-query($from: mobile) {
|
30
|
-
@include box-sizing(border-box);
|
31
|
-
display: inline-block;
|
32
|
-
width: 48%;
|
33
|
-
}
|
29
|
+
vertical-align: top;
|
34
30
|
|
35
31
|
@include govuk-media-query($from: desktop) {
|
32
|
+
display: inline-block;
|
36
33
|
width: auto;
|
34
|
+
vertical-align: baseline;
|
37
35
|
}
|
38
36
|
}
|
39
37
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
$govuk-cookie-banner-background: #d5e8f3;
|
2
2
|
$govuk-cookie-banner-background-new: govuk-colour("white");
|
3
|
+
$govuk-cookie-banner-text-green: #00823b;
|
3
4
|
|
4
5
|
.js-enabled {
|
5
6
|
.gem-c-cookie-banner,
|
@@ -38,33 +39,63 @@ $govuk-cookie-banner-background-new: govuk-colour("white");
|
|
38
39
|
margin-bottom: govuk-spacing(1);
|
39
40
|
padding-right: govuk-spacing(4);
|
40
41
|
padding-bottom: govuk-spacing(2);
|
42
|
+
color: $govuk-cookie-banner-text-green;
|
41
43
|
}
|
42
44
|
|
43
45
|
.gem-c-cookie-banner__buttons {
|
44
|
-
|
46
|
+
@include govuk-clearfix;
|
45
47
|
|
46
48
|
@include govuk-media-query($from: desktop) {
|
47
49
|
display: inline-block;
|
48
50
|
}
|
49
51
|
}
|
50
52
|
|
53
|
+
.gem-c-cookie-banner__button {
|
54
|
+
display: inline-block;
|
55
|
+
width: 100%;
|
56
|
+
|
57
|
+
@include govuk-media-query($from: mobile, $until: desktop) {
|
58
|
+
width: 49%;
|
59
|
+
|
60
|
+
&.gem-c-cookie-banner__button-accept {
|
61
|
+
float: left;
|
62
|
+
}
|
63
|
+
|
64
|
+
&.gem-c-cookie-banner__button-settings {
|
65
|
+
float: right;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
@include govuk-media-query($from: desktop) {
|
70
|
+
width: auto;
|
71
|
+
}
|
72
|
+
|
73
|
+
@include govuk-media-query($until: 455px) {
|
74
|
+
width: 100%;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
51
78
|
.gem-c-cookie-banner__confirmation {
|
52
79
|
display: none;
|
53
80
|
position: relative;
|
54
|
-
padding:
|
81
|
+
padding: govuk-spacing(1);
|
55
82
|
}
|
56
83
|
|
57
84
|
.gem-c-cookie-banner__confirmation-message,
|
58
85
|
.gem-c-cookie-banner__hide-button {
|
59
86
|
display: block;
|
60
87
|
|
61
|
-
@include govuk-media-query($from:
|
88
|
+
@include govuk-media-query($from: desktop) {
|
62
89
|
display: inline-block;
|
63
90
|
}
|
64
91
|
}
|
65
92
|
|
66
93
|
.gem-c-cookie-banner__confirmation-message {
|
67
94
|
margin-right: govuk-spacing(4);
|
95
|
+
|
96
|
+
@include govuk-media-query($from: desktop) {
|
97
|
+
max-width: 90%;
|
98
|
+
}
|
68
99
|
}
|
69
100
|
|
70
101
|
.gem-c-cookie-banner__hide-button {
|
@@ -83,10 +114,10 @@ $govuk-cookie-banner-background-new: govuk-colour("white");
|
|
83
114
|
cursor: pointer;
|
84
115
|
}
|
85
116
|
|
86
|
-
@include govuk-media-query($from:
|
117
|
+
@include govuk-media-query($from: desktop) {
|
87
118
|
margin-top: govuk-spacing(0);
|
88
119
|
position: absolute;
|
89
|
-
right:
|
120
|
+
right: govuk-spacing(1);
|
90
121
|
}
|
91
122
|
}
|
92
123
|
|
@@ -1,46 +1,46 @@
|
|
1
1
|
.gem-c-heading {
|
2
2
|
@include govuk-text-colour;
|
3
|
-
@include
|
3
|
+
@include govuk-font(27, $weight: bold);
|
4
4
|
margin: 0;
|
5
5
|
}
|
6
6
|
|
7
7
|
.gem-c-heading--font-size-24 {
|
8
|
-
@include
|
8
|
+
@include govuk-font(24, $weight: bold);
|
9
9
|
}
|
10
10
|
|
11
11
|
.gem-c-heading--font-size-19 {
|
12
|
-
@include
|
12
|
+
@include govuk-font(19, $weight: bold);
|
13
13
|
}
|
14
14
|
|
15
15
|
// special case for publications and consultations pages
|
16
16
|
// separated to allow normalisation of the component for wider use
|
17
17
|
.gem-c-heading--mobile-top-margin {
|
18
|
-
margin-top:
|
19
|
-
margin-bottom:
|
18
|
+
margin-top: govuk-spacing(6);
|
19
|
+
margin-bottom: govuk-spacing(3);
|
20
20
|
|
21
|
-
@include media(tablet) {
|
21
|
+
@include govuk-media-query($from: tablet) {
|
22
22
|
margin-top: 0;
|
23
|
-
margin-bottom:
|
23
|
+
margin-bottom: govuk-spacing(6);
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
27
27
|
.gem-c-heading--padding {
|
28
|
-
padding:
|
28
|
+
padding: govuk-spacing(3) 0;
|
29
29
|
}
|
30
30
|
|
31
31
|
// margins would ideally be handled by a general model for all components
|
32
32
|
// but we don't have one yet, so this is in anticipation of that
|
33
33
|
// suggested scale is as follows, not fully implemented
|
34
|
-
//
|
35
|
-
//
|
36
|
-
//
|
37
|
-
//
|
34
|
+
// govuk-spacing(6)= 4
|
35
|
+
// govuk-spacing(4) = 3
|
36
|
+
// govuk-spacing(3) = 2
|
37
|
+
// govuk-spacing(2) = 1
|
38
38
|
.gem-c-heading--margin-bottom-4 {
|
39
|
-
margin-bottom:
|
39
|
+
margin-bottom: govuk-spacing(6);
|
40
40
|
}
|
41
41
|
|
42
42
|
.gem-c-heading--margin-bottom-2 {
|
43
|
-
margin-bottom:
|
43
|
+
margin-bottom: govuk-spacing(3);
|
44
44
|
}
|
45
45
|
|
46
46
|
// border color will default to black
|