govuk_publishing_components 63.3.1 → 64.1.0
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-ga4/ga4-form-change-tracker.js +8 -2
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +14 -3
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +8 -34
- data/app/assets/javascripts/govuk_publishing_components/dependencies.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/domain-config.js +5 -10
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js +4 -15
- data/app/controllers/govuk_publishing_components/application_controller.rb +0 -5
- data/app/controllers/govuk_publishing_components/applications_page_controller.rb +1 -0
- data/app/models/govuk_publishing_components/applications_page.rb +12 -7
- data/app/models/govuk_publishing_components/audit_applications.rb +0 -4
- data/app/models/govuk_publishing_components/audit_comparer.rb +1 -4
- data/app/views/govuk_publishing_components/applications_page/_table-content.html.erb +7 -0
- data/app/views/govuk_publishing_components/applications_page/show.html.erb +1 -1
- data/app/views/govuk_publishing_components/audit/_applications.html.erb +0 -8
- data/app/views/govuk_publishing_components/audit/show.html.erb +1 -6
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_action_link.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_add_another.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_app_promo_banner.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_attachment.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_attachment_link.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_back_link.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_back_to_top_link.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_big_number.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_button.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_cards.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_character_count.html.erb +0 -3
- data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_contents_list_with_body.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_contextual_guidance.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_cross_service_header.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_date_input.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_details.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_document_list.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_error_alert.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_error_message.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_error_summary.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_feedback.html.erb +0 -3
- data/app/views/govuk_publishing_components/components/_fieldset.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_figure.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_file_upload.html.erb +4 -3
- data/app/views/govuk_publishing_components/components/_glance_metric.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_global_banner.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_govspeak.html.erb +0 -5
- data/app/views/govuk_publishing_components/components/_govspeak_html_publication.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_heading.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_hint.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_input.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_inset_text.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_inverse_header.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_label.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_lead_paragraph.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_notice.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_option_select.html.erb +0 -3
- data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_pagination.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_panel.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_password_input.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_print_link.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_published_dates.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_radio.html.erb +0 -3
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_reorderable_list.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_search.html.erb +0 -3
- data/app/views/govuk_publishing_components/components/_search_with_autocomplete.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_secondary_navigation.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_select.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_select_with_search.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_service_navigation.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_signup_link.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_skip_link.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_success_alert.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_summary_banner.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_summary_card.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_table.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_tabs.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_tag.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_textarea.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/_warning_text.html.erb +0 -2
- data/app/views/govuk_publishing_components/components/docs/govspeak_html_publication.yml +0 -2
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +4 -7
- data/lib/govuk_publishing_components/config.rb +0 -6
- data/lib/govuk_publishing_components/presenters/machine_readable/faq_page_schema.rb +1 -2
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +0 -2
- data/lib/govuk_publishing_components/presenters/organisation_logo_helper.rb +11 -13
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +0 -5
- metadata +2 -10
- data/app/assets/javascripts/govuk_publishing_components/single-consent-functions.js +0 -59
- data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +0 -78
- data/node_modules/govuk-single-consent/README.md +0 -157
- data/node_modules/govuk-single-consent/dist/singleconsent.cjs.js +0 -419
- data/node_modules/govuk-single-consent/dist/singleconsent.esm.js +0 -417
- data/node_modules/govuk-single-consent/dist/singleconsent.iife.js +0 -431
- data/node_modules/govuk-single-consent/dist/singleconsent.iife.min.js +0 -1
- data/node_modules/govuk-single-consent/package.json +0 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a36e502c34c34ff4f3d4f3c68b2bdc3c73d2e0063e0681113d6fa86419256a1
|
|
4
|
+
data.tar.gz: e7687186a40332b5fd8466c08bc37eaf061383053d571873b32efb1b19fe2140
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e0e05ae52393e75403160be9fe4243b498d47f9241ef4245d75aad760093c614a9a6c636fa7b256deb1fb785a020f020142df49a06eb79710955689a71ec981
|
|
7
|
+
data.tar.gz: 0146075f678ac78ee120d4bc495dc7a2251f93b93fd8c0a04478654f29d185151a97fe906db961ee0e46629cd43186031a4474ab95387fe211beca4432c9d2f4
|
data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-change-tracker.js
CHANGED
|
@@ -110,13 +110,19 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
110
110
|
let text
|
|
111
111
|
|
|
112
112
|
if (checkableValue) {
|
|
113
|
+
const fieldset = checkableValue.closest('fieldset') || null
|
|
114
|
+
const redactedFieldset = fieldset && fieldset.dataset.ga4Redact
|
|
115
|
+
|
|
113
116
|
// radio, check, option can have `:checked` pseudo-class
|
|
114
117
|
if (!checkableValue.matches(':checked')) {
|
|
115
118
|
action = 'remove'
|
|
116
119
|
}
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
if (redactedFieldset && !checkableValue.dataset.ga4RedactPermit) {
|
|
122
|
+
text = '[REDACTED]'
|
|
123
|
+
} else {
|
|
124
|
+
text = checkableValue.innerText || this.module.querySelector(`label[for='${window.CSS.escape(id)}']`).innerText
|
|
125
|
+
}
|
|
120
126
|
|
|
121
127
|
if (text) {
|
|
122
128
|
text = text.replace(/\r?\n|\r/g, ' ')
|
|
@@ -83,12 +83,17 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
83
83
|
for (var i = 0; i < labels.length; i++) {
|
|
84
84
|
var label = labels[i]
|
|
85
85
|
var labelFor = label.getAttribute('for')
|
|
86
|
+
var hiddenInput = label.getAttribute('data-ga4-hidden-input')
|
|
86
87
|
var input = false
|
|
87
|
-
|
|
88
|
+
|
|
89
|
+
if (hiddenInput) {
|
|
90
|
+
input = this.module.querySelector('[id="' + hiddenInput + '"]')
|
|
91
|
+
} else if (labelFor) {
|
|
88
92
|
input = this.module.querySelector('[id="' + labelFor + '"]')
|
|
89
93
|
} else {
|
|
90
94
|
input = label.querySelector('input')
|
|
91
95
|
}
|
|
96
|
+
|
|
92
97
|
inputs.push({
|
|
93
98
|
input: input,
|
|
94
99
|
label: label
|
|
@@ -122,9 +127,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
122
127
|
// don't include conditional field control in text
|
|
123
128
|
inputs.splice(i, 1)
|
|
124
129
|
} else if (elem.checked) {
|
|
125
|
-
|
|
130
|
+
var fieldset = elem.closest('fieldset') || null
|
|
126
131
|
|
|
127
|
-
|
|
132
|
+
if (fieldset.dataset.ga4Redact && !elem.dataset.ga4RedactPermit) {
|
|
133
|
+
input.answer = '[REDACTED]'
|
|
134
|
+
} else {
|
|
135
|
+
input.answer = labelText
|
|
136
|
+
}
|
|
128
137
|
|
|
129
138
|
if (fieldset) {
|
|
130
139
|
var legend = fieldset.querySelector('legend')
|
|
@@ -159,6 +168,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
159
168
|
this.redacted = true
|
|
160
169
|
}
|
|
161
170
|
}
|
|
171
|
+
} else if (inputType === 'file') {
|
|
172
|
+
input.answer = elem.files.length + ' files chosen'
|
|
162
173
|
} else {
|
|
163
174
|
// remove the input from those gathered as it has no value
|
|
164
175
|
inputs.splice(i, 1)
|
|
@@ -15,12 +15,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
15
15
|
this.$module.setCookieConsent = this.setCookieConsent.bind(this)
|
|
16
16
|
this.$module.rejectCookieConsent = this.rejectCookieConsent.bind(this)
|
|
17
17
|
this.setupCookieMessage()
|
|
18
|
-
|
|
19
|
-
if (window.GOVUK.useSingleConsentApi) {
|
|
20
|
-
window.addEventListener('hide-cookie-banner', this.$module.hideCookieMessage)
|
|
21
|
-
window.addEventListener('show-cookie-banner', this.$module.showCookieMessage)
|
|
22
|
-
window.GOVUK.singleConsent.init()
|
|
23
|
-
}
|
|
24
18
|
}
|
|
25
19
|
|
|
26
20
|
CookieBanner.prototype.setupCookieMessage = function () {
|
|
@@ -41,13 +35,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
41
35
|
this.$rejectCookiesButton.addEventListener('click', this.$module.rejectCookieConsent)
|
|
42
36
|
}
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
this.showCookieMessage()
|
|
46
|
-
}
|
|
38
|
+
this.showCookieMessage()
|
|
47
39
|
}
|
|
48
40
|
|
|
49
41
|
CookieBanner.prototype.showCookieMessage = function () {
|
|
50
|
-
window.removeEventListener('show-cookie-banner', this.$module.showCookieMessage)
|
|
51
42
|
// Show the cookie banner if not in the cookie settings page or in an iframe
|
|
52
43
|
if (!this.isInCookiesPage() && !this.isInIframe()) {
|
|
53
44
|
var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('cookies_preferences_set') !== 'true')
|
|
@@ -57,9 +48,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
57
48
|
|
|
58
49
|
// Set the default consent cookie if it isn't already present
|
|
59
50
|
if (!window.GOVUK.cookie('cookies_policy')) {
|
|
60
|
-
|
|
61
|
-
window.GOVUK.setDefaultConsentCookie()
|
|
62
|
-
}
|
|
51
|
+
window.GOVUK.setDefaultConsentCookie()
|
|
63
52
|
}
|
|
64
53
|
|
|
65
54
|
window.GOVUK.deleteUnconsentedCookies()
|
|
@@ -68,12 +57,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
68
57
|
}
|
|
69
58
|
|
|
70
59
|
CookieBanner.prototype.hideCookieMessage = function (event) {
|
|
71
|
-
window.removeEventListener('hide-cookie-banner', this.$module.hideCookieMessage)
|
|
72
60
|
if (this.$module) {
|
|
73
61
|
this.$module.hidden = true
|
|
74
|
-
|
|
75
|
-
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
|
76
|
-
}
|
|
62
|
+
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
|
77
63
|
}
|
|
78
64
|
|
|
79
65
|
if (event.target) {
|
|
@@ -85,31 +71,19 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
85
71
|
if (this.$acceptCookiesButton.getAttribute('data-cookie-types') === 'all') {
|
|
86
72
|
this.$module.querySelector('.gem-c-cookie-banner__confirmation-message--accepted').hidden = false
|
|
87
73
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} else {
|
|
91
|
-
window.GOVUK.approveAllCookieTypes()
|
|
92
|
-
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
|
93
|
-
}
|
|
94
|
-
|
|
74
|
+
window.GOVUK.approveAllCookieTypes()
|
|
75
|
+
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
|
95
76
|
this.$module.showConfirmationMessage()
|
|
96
77
|
this.$module.cookieBannerConfirmationMessage.focus()
|
|
97
|
-
|
|
98
|
-
if (!window.GOVUK.useSingleConsentApi) {
|
|
99
|
-
window.GOVUK.triggerEvent(window, 'cookie-consent')
|
|
100
|
-
}
|
|
78
|
+
window.GOVUK.triggerEvent(window, 'cookie-consent')
|
|
101
79
|
}
|
|
102
80
|
|
|
103
81
|
CookieBanner.prototype.rejectCookieConsent = function () {
|
|
104
82
|
this.$module.querySelector('.gem-c-cookie-banner__confirmation-message--rejected').hidden = false
|
|
105
83
|
this.$module.showConfirmationMessage()
|
|
106
84
|
this.$module.cookieBannerConfirmationMessage.focus()
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} else {
|
|
110
|
-
window.GOVUK.setDefaultConsentCookie()
|
|
111
|
-
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
|
112
|
-
}
|
|
85
|
+
window.GOVUK.setDefaultConsentCookie()
|
|
86
|
+
window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
|
|
113
87
|
}
|
|
114
88
|
|
|
115
89
|
CookieBanner.prototype.showConfirmationMessage = function () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-env */
|
|
2
2
|
|
|
3
3
|
// This adds in javascript that initialises components and dependencies
|
|
4
|
-
//
|
|
4
|
+
// in public frontend applications.
|
|
5
5
|
// = require ./modules.js
|
|
6
6
|
|
|
7
7
|
document.addEventListener('DOMContentLoaded', function () {
|
|
@@ -13,8 +13,7 @@ window.GOVUK.vars.domains = [
|
|
|
13
13
|
initialiseGA4: true,
|
|
14
14
|
id: 'GTM-MG7HG5W',
|
|
15
15
|
auth: 'bRiZ-jiEHtw6hHpGd6dF9w',
|
|
16
|
-
preview: 'env-3'
|
|
17
|
-
consentApiUrl: 'staging'
|
|
16
|
+
preview: 'env-3'
|
|
18
17
|
},
|
|
19
18
|
{
|
|
20
19
|
name: 'production',
|
|
@@ -24,8 +23,7 @@ window.GOVUK.vars.domains = [
|
|
|
24
23
|
'assets.publishing.service.gov.uk'
|
|
25
24
|
],
|
|
26
25
|
initialiseGA4: true,
|
|
27
|
-
id: 'GTM-MG7HG5W'
|
|
28
|
-
consentApiUrl: 'production'
|
|
26
|
+
id: 'GTM-MG7HG5W'
|
|
29
27
|
},
|
|
30
28
|
{
|
|
31
29
|
name: 'staging',
|
|
@@ -37,8 +35,7 @@ window.GOVUK.vars.domains = [
|
|
|
37
35
|
initialiseGA4: true,
|
|
38
36
|
id: 'GTM-MG7HG5W',
|
|
39
37
|
auth: 'oJWs562CxSIjZKn_GlB5Bw',
|
|
40
|
-
preview: 'env-5'
|
|
41
|
-
consentApiUrl: 'staging'
|
|
38
|
+
preview: 'env-5'
|
|
42
39
|
},
|
|
43
40
|
{
|
|
44
41
|
name: 'integration',
|
|
@@ -50,8 +47,7 @@ window.GOVUK.vars.domains = [
|
|
|
50
47
|
initialiseGA4: true,
|
|
51
48
|
id: 'GTM-MG7HG5W',
|
|
52
49
|
auth: 'C7iYdcsOlYgGmiUJjZKrHQ',
|
|
53
|
-
preview: 'env-4'
|
|
54
|
-
consentApiUrl: 'staging'
|
|
50
|
+
preview: 'env-4'
|
|
55
51
|
},
|
|
56
52
|
{
|
|
57
53
|
name: 'devdocs',
|
|
@@ -59,7 +55,6 @@ window.GOVUK.vars.domains = [
|
|
|
59
55
|
'docs.publishing.service.gov.uk'
|
|
60
56
|
],
|
|
61
57
|
initialiseGA4: true,
|
|
62
|
-
id: 'GTM-TNKCK97'
|
|
63
|
-
consentApiUrl: 'production'
|
|
58
|
+
id: 'GTM-TNKCK97'
|
|
64
59
|
}
|
|
65
60
|
]
|
|
@@ -12,18 +12,12 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
12
12
|
document.querySelector('form[data-module=cookie-settings]')
|
|
13
13
|
.addEventListener('submit', this.$module.submitSettingsForm)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
window.GOVUK.singleConsent.init(this.setInitialFormValues.bind(this))
|
|
17
|
-
} else {
|
|
18
|
-
this.setInitialFormValues()
|
|
19
|
-
}
|
|
15
|
+
this.setInitialFormValues()
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
CookieSettings.prototype.setInitialFormValues = function () {
|
|
23
19
|
if (!window.GOVUK.cookie('cookies_policy')) {
|
|
24
|
-
|
|
25
|
-
window.GOVUK.setDefaultConsentCookie()
|
|
26
|
-
}
|
|
20
|
+
window.GOVUK.setDefaultConsentCookie()
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
var currentConsentCookie = window.GOVUK.cookie('cookies_policy')
|
|
@@ -68,13 +62,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
|
68
62
|
}
|
|
69
63
|
}
|
|
70
64
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} else {
|
|
74
|
-
window.GOVUK.setConsentCookie(options)
|
|
75
|
-
window.GOVUK.setCookie('cookies_preferences_set', true, { days: 365 })
|
|
76
|
-
}
|
|
77
|
-
|
|
65
|
+
window.GOVUK.setConsentCookie(options)
|
|
66
|
+
window.GOVUK.setCookie('cookies_preferences_set', true, { days: 365 })
|
|
78
67
|
this.showConfirmationMessage()
|
|
79
68
|
return false
|
|
80
69
|
}
|
|
@@ -3,16 +3,11 @@ module GovukPublishingComponents
|
|
|
3
3
|
helper ::Rails.application.helpers
|
|
4
4
|
protect_from_forgery with: :exception
|
|
5
5
|
before_action :set_x_frame_options_header
|
|
6
|
-
before_action :set_disable_slimmer_header
|
|
7
6
|
|
|
8
7
|
private
|
|
9
8
|
|
|
10
9
|
def set_x_frame_options_header
|
|
11
10
|
response.headers["X-Frame-Options"] = "ALLOWALL"
|
|
12
11
|
end
|
|
13
|
-
|
|
14
|
-
def set_disable_slimmer_header
|
|
15
|
-
response.headers["X-Slimmer-Skip"] = "true"
|
|
16
|
-
end
|
|
17
12
|
end
|
|
18
13
|
end
|
|
@@ -5,7 +5,8 @@ module GovukPublishingComponents
|
|
|
5
5
|
def initialize(application)
|
|
6
6
|
@application = application
|
|
7
7
|
@dir = get_directory
|
|
8
|
-
@gemfilelock =
|
|
8
|
+
@gemfilelock = get_file("Gemfile.lock")
|
|
9
|
+
@rubyfile = get_file(".ruby-version")
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def readable_name
|
|
@@ -20,6 +21,10 @@ module GovukPublishingComponents
|
|
|
20
21
|
parse_file(@gemfilelock, /sass-embedded \(([^)>=~ ]+)\)/)
|
|
21
22
|
end
|
|
22
23
|
|
|
24
|
+
def ruby_version
|
|
25
|
+
@rubyfile.strip if @rubyfile
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
private
|
|
24
29
|
|
|
25
30
|
def get_directory
|
|
@@ -27,20 +32,20 @@ module GovukPublishingComponents
|
|
|
27
32
|
Dir.exist?(app_dir) ? app_dir : false
|
|
28
33
|
end
|
|
29
34
|
|
|
30
|
-
def
|
|
31
|
-
@dir ?
|
|
35
|
+
def get_file(name)
|
|
36
|
+
@dir ? get_local_file(name) : get_remote_file(name)
|
|
32
37
|
end
|
|
33
38
|
|
|
34
|
-
def
|
|
35
|
-
lockfile = "#{@dir}
|
|
39
|
+
def get_local_file(name)
|
|
40
|
+
lockfile = "#{@dir}/#{name}"
|
|
36
41
|
return unless File.file?(lockfile)
|
|
37
42
|
|
|
38
43
|
@source = "local"
|
|
39
44
|
File.read(lockfile)
|
|
40
45
|
end
|
|
41
46
|
|
|
42
|
-
def
|
|
43
|
-
uri = URI("https://raw.githubusercontent.com/alphagov/#{@application}/main
|
|
47
|
+
def get_remote_file(name)
|
|
48
|
+
uri = URI("https://raw.githubusercontent.com/alphagov/#{@application}/main/#{name}")
|
|
44
49
|
result = Net::HTTP.get_response(uri)
|
|
45
50
|
if result.is_a?(Net::HTTPSuccess)
|
|
46
51
|
@source = "remote"
|
|
@@ -19,8 +19,6 @@ module GovukPublishingComponents
|
|
|
19
19
|
find_components = /(?<=govuk_publishing_components\/components\/)[a-zA-Z_-]+(?=['"])/
|
|
20
20
|
|
|
21
21
|
@find_all_stylesheets = /@import ["']{1}govuk_publishing_components\/all_components/ # if using the all stylesheets option
|
|
22
|
-
@find_individual_asset_model = /render_component_stylesheets/ # if using per page component asset loading
|
|
23
|
-
@uses_individual_asset_model = false
|
|
24
22
|
find_stylesheets = /(?<=@import ["']{1}govuk_publishing_components\/components\/)(?!print\/)+[a-zA-Z_-]+(?=['"])/
|
|
25
23
|
|
|
26
24
|
@find_all_javascripts = /\/\/ *= require govuk_publishing_components\/all_components/
|
|
@@ -80,7 +78,6 @@ module GovukPublishingComponents
|
|
|
80
78
|
jquery_references: @jquery_references.flatten.uniq.sort,
|
|
81
79
|
component_locations: @component_locations,
|
|
82
80
|
helper_references: @helper_references,
|
|
83
|
-
uses_individual_asset_model: @uses_individual_asset_model,
|
|
84
81
|
application_components: application_components || [],
|
|
85
82
|
}
|
|
86
83
|
end
|
|
@@ -144,7 +141,6 @@ module GovukPublishingComponents
|
|
|
144
141
|
return %w[all] if src.match(@find_all_stylesheets) && type == "stylesheet"
|
|
145
142
|
return %w[all] if src.match(@find_all_javascripts) && type == "javascript"
|
|
146
143
|
|
|
147
|
-
@uses_individual_asset_model = true if src.match(@find_individual_asset_model) && type == "template"
|
|
148
144
|
matches = src.scan(find)
|
|
149
145
|
return [] unless matches.any?
|
|
150
146
|
|
|
@@ -23,7 +23,6 @@ module GovukPublishingComponents
|
|
|
23
23
|
|
|
24
24
|
results.each do |result|
|
|
25
25
|
if result[:application_found]
|
|
26
|
-
@current_uses_individual_asset_model = result[:uses_individual_asset_model]
|
|
27
26
|
templates = result[:components_found].find { |c| c[:location] == "template" }
|
|
28
27
|
stylesheets = result[:components_found].find { |c| c[:location] == "stylesheet" }
|
|
29
28
|
javascripts = result[:components_found].find { |c| c[:location] == "javascript" }
|
|
@@ -69,7 +68,6 @@ module GovukPublishingComponents
|
|
|
69
68
|
jquery_references: result[:jquery_references],
|
|
70
69
|
component_locations: result[:component_locations],
|
|
71
70
|
helper_references: result[:helper_references],
|
|
72
|
-
uses_individual_asset_model: result[:uses_individual_asset_model],
|
|
73
71
|
application_components: result[:application_components],
|
|
74
72
|
}
|
|
75
73
|
else
|
|
@@ -127,8 +125,7 @@ module GovukPublishingComponents
|
|
|
127
125
|
asset_in_gem = false
|
|
128
126
|
end
|
|
129
127
|
|
|
130
|
-
|
|
131
|
-
raise_warning = asset_in_gem && !suppress_warning
|
|
128
|
+
raise_warning = asset_in_gem
|
|
132
129
|
|
|
133
130
|
# this raises a warning if the asset exists and isn't included in the application
|
|
134
131
|
warnings << create_warning(component, "Included in #{first_location} but not #{second_location}") if raise_warning
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<% content_for :title, "Applications consistency" %>
|
|
2
|
-
<% add_gem_component_stylesheet("table") %>
|
|
3
2
|
|
|
4
3
|
<%= render "govuk_publishing_components/components/back_link", {
|
|
5
4
|
href: "/component-guide",
|
|
@@ -25,6 +24,7 @@
|
|
|
25
24
|
<th scope="col" class="govuk-table__header sticky-table-header">Source</th>
|
|
26
25
|
<th scope="col" class="govuk-table__header sticky-table-header">Gem version</th>
|
|
27
26
|
<th scope="col" class="govuk-table__header sticky-table-header">Sass version</th>
|
|
27
|
+
<th scope="col" class="govuk-table__header sticky-table-header">Ruby version</th>
|
|
28
28
|
</tr>
|
|
29
29
|
</thead>
|
|
30
30
|
<tbody class="govuk-table__body">
|
|
@@ -37,12 +37,6 @@
|
|
|
37
37
|
<% github_link = "https://github.com/alphagov/" + application[:dir] + "/blob/main/" %>
|
|
38
38
|
|
|
39
39
|
<% if @other_applications %>
|
|
40
|
-
<% if application[:uses_individual_asset_model] %>
|
|
41
|
-
<%= render "govuk_publishing_components/components/warning_text", {
|
|
42
|
-
text: raw("This application uses <a class=\"govuk-link\" href=\"https://github.com/alphagov/govuk_publishing_components/blob/main/docs/set-up-individual-component-css-loading.md\">per page asset loading</a> for components. Warnings about missing stylesheets have been suppressed."),
|
|
43
|
-
} %>
|
|
44
|
-
<% end %>
|
|
45
|
-
|
|
46
40
|
<% application[:warnings].each do |warning| %>
|
|
47
41
|
<p class="govuk-body">
|
|
48
42
|
<strong class="govuk-tag">Warn</strong>
|
|
@@ -67,8 +61,6 @@
|
|
|
67
61
|
<% content = capture do %>
|
|
68
62
|
<% if item[:value].length > 0 %>
|
|
69
63
|
<%= item[:value].join(", ") %>
|
|
70
|
-
<% elsif application[:uses_individual_asset_model] && item[:name] == "In stylesheets" %>
|
|
71
|
-
Uses per page component asset loading
|
|
72
64
|
<% else %>
|
|
73
65
|
None
|
|
74
66
|
<% end %>
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
<%
|
|
2
|
-
add_gem_component_stylesheet("table")
|
|
3
|
-
add_gem_component_stylesheet("select")
|
|
4
|
-
add_gem_component_stylesheet("summary-list")
|
|
5
|
-
content_for :title, "Component audit"
|
|
6
|
-
%>
|
|
1
|
+
<% content_for :title, "Component audit" %>
|
|
7
2
|
|
|
8
3
|
<%= render "govuk_publishing_components/components/back_link", {
|
|
9
4
|
href: "/component-guide",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% content_for :title, "#{@component_example.name} example - #{@component_doc.name} component" %>
|
|
2
2
|
<% content_for :application_stylesheet do %>
|
|
3
|
-
<% if @component_doc.source == "application"
|
|
3
|
+
<% if @component_doc.source == "application" %>
|
|
4
4
|
<%= render "application_stylesheet" %>
|
|
5
5
|
<% end %>
|
|
6
6
|
<% end %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% content_for :title, "#{@component_doc.name} component" %>
|
|
2
2
|
<% content_for :application_stylesheet do %>
|
|
3
|
-
<% if @component_doc.source == "application"
|
|
3
|
+
<% if @component_doc.source == "application" %>
|
|
4
4
|
<%= render "application_stylesheet" %>
|
|
5
5
|
<% end %>
|
|
6
6
|
<% end %>
|