govuk_publishing_components 61.1.0 → 61.1.2
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/images/govuk_publishing_components/draft-watermark.png +0 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +38 -19
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +7 -0
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 869c49b5907a5d053b4e0322c0655b49f3bea3b8e256edec51480aedddbec809
|
4
|
+
data.tar.gz: db4734d7a920ab7f778ab6aac9318f01bbac14ddd6bc7af13be4d00c3ed2b861
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a11f4dee2a31598a64669e23d5c93c1bfd5f061e7db809ae21b52c3cb2a5a4ee1285fb1545950fc1ca923911c9c02f21cd8e35bf7507d3e0d53f0d668324e7
|
7
|
+
data.tar.gz: 2227822f9fbd3d105765f0bd04c8d64d0971de7fda6f6230ebf8f3024dbfd328ddfa6f5ac93694d684b11262a13bdb12bbd7100e87fda079e454a8728738c12d
|
Binary file
|
@@ -110,16 +110,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
110
110
|
|
111
111
|
var isTextField = inputTypes.indexOf(inputType) !== -1 || inputNodename === 'TEXTAREA'
|
112
112
|
var conditionalField = elem.closest('.govuk-checkboxes__conditional')
|
113
|
-
var conditionalCheckbox = conditionalField &&
|
113
|
+
var conditionalCheckbox = conditionalField && this.module.querySelector('[aria-controls="' + conditionalField.id + '"]')
|
114
114
|
var conditionalCheckboxChecked = conditionalCheckbox && conditionalCheckbox.checked
|
115
115
|
|
116
|
-
|
117
|
-
var conditionalCheckboxLabel = conditionalField.querySelector('[for="' + conditionalCheckbox.id + '"]')
|
118
|
-
|
119
|
-
if (conditionalCheckboxLabel) {
|
120
|
-
input.parentSection = conditionalCheckboxLabel.innerText
|
121
|
-
}
|
122
|
-
}
|
116
|
+
var isDateField = elem.closest('.govuk-date-input')
|
123
117
|
|
124
118
|
if (conditionalCheckbox && !conditionalCheckboxChecked) {
|
125
119
|
// don't include conditional field if condition not checked
|
@@ -141,10 +135,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
141
135
|
}
|
142
136
|
} else if (inputNodename === 'SELECT' && elem.querySelectorAll('option:checked')) {
|
143
137
|
var selectedOptions = Array.from(elem.querySelectorAll('option:checked')).map(function (element) { return element.text })
|
144
|
-
|
138
|
+
|
139
|
+
if (selectedOptions.length === 1 && !elem.value.length) {
|
140
|
+
// if placeholder value in select, do not include as not filled in
|
141
|
+
inputs.splice(i, 1)
|
142
|
+
} else {
|
143
|
+
input.answer = this.useSelectCount && selectedOptions.length > 1 ? selectedOptions.length : selectedOptions.join(',')
|
144
|
+
}
|
145
145
|
} else if (isTextField && elem.value) {
|
146
146
|
if (this.includeTextInputValues || elem.hasAttribute('data-ga4-form-include-input')) {
|
147
|
-
if (this.useTextCount) {
|
147
|
+
if (this.useTextCount && !isDateField) {
|
148
148
|
input.answer = elem.value.length
|
149
149
|
} else {
|
150
150
|
var PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()
|
@@ -163,6 +163,32 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
163
163
|
// remove the input from those gathered as it has no value
|
164
164
|
inputs.splice(i, 1)
|
165
165
|
}
|
166
|
+
|
167
|
+
var parentFieldset
|
168
|
+
var parentLegend
|
169
|
+
|
170
|
+
if (conditionalField && conditionalCheckboxChecked) {
|
171
|
+
parentFieldset = conditionalField.closest('fieldset')
|
172
|
+
parentLegend = parentFieldset && parentFieldset.querySelector('legend')
|
173
|
+
|
174
|
+
if (parentLegend) {
|
175
|
+
input.section = parentLegend.innerText + ' - ' + input.section
|
176
|
+
}
|
177
|
+
} else if (isDateField) {
|
178
|
+
var dateFieldset = elem.closest('.govuk-date-input').closest('fieldset')
|
179
|
+
var dateLegend = dateFieldset && dateFieldset.querySelector('legend')
|
180
|
+
|
181
|
+
parentFieldset = dateFieldset.parentNode.closest('fieldset')
|
182
|
+
|
183
|
+
if (dateLegend) {
|
184
|
+
input.section = dateLegend.innerText + ' - ' + input.section
|
185
|
+
}
|
186
|
+
|
187
|
+
if (parentFieldset) {
|
188
|
+
parentLegend = parentFieldset.querySelector('legend')
|
189
|
+
input.section = parentLegend.innerText + ' - ' + input.section
|
190
|
+
}
|
191
|
+
}
|
166
192
|
}
|
167
193
|
return inputs
|
168
194
|
}
|
@@ -176,17 +202,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
176
202
|
if (answer) {
|
177
203
|
if (this.recordJson) {
|
178
204
|
var fieldSection = data[i].section
|
179
|
-
var parentFieldSection = data[i].parentSection
|
180
205
|
|
181
206
|
if (fieldSection) {
|
182
|
-
|
183
|
-
|
184
|
-
answers[parentFieldSection][fieldSection] = answers[parentFieldSection][fieldSection] || ''
|
185
|
-
answers[parentFieldSection][fieldSection] += ((answers[parentFieldSection][fieldSection] ? ',' : '') + answer)
|
186
|
-
} else {
|
187
|
-
answers[fieldSection] = answers[fieldSection] || ''
|
188
|
-
answers[fieldSection] += ((answers[fieldSection] ? ',' : '') + answer)
|
189
|
-
}
|
207
|
+
answers[fieldSection] = answers[fieldSection] ? (answers[fieldSection] + ',') : ''
|
208
|
+
answers[fieldSection] += answer
|
190
209
|
}
|
191
210
|
} else {
|
192
211
|
answers.push(answer)
|
@@ -4,6 +4,13 @@
|
|
4
4
|
font-family: $govuk-font-family;
|
5
5
|
}
|
6
6
|
|
7
|
+
.gem-c-layout-for-public--draft {
|
8
|
+
background-image: url("govuk_publishing_components/draft-watermark.png");
|
9
|
+
background-repeat: repeat-y;
|
10
|
+
background-position: 50% 0;
|
11
|
+
background-size: contain;
|
12
|
+
}
|
13
|
+
|
7
14
|
.gem-c-layout-for-public-account-menu {
|
8
15
|
margin: 0 0 govuk-spacing(6) 0;
|
9
16
|
padding: 0;
|
@@ -27,7 +27,7 @@
|
|
27
27
|
omit_account_phase_banner ||= false
|
28
28
|
|
29
29
|
body_css_classes = %w(gem-c-layout-for-public govuk-template__body)
|
30
|
-
body_css_classes << "draft" if draft_watermark
|
30
|
+
body_css_classes << "gem-c-layout-for-public--draft" if draft_watermark
|
31
31
|
body_css_classes << "global-banner-present" if global_banner.present?
|
32
32
|
-%>
|
33
33
|
<!DOCTYPE html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 61.1.
|
4
|
+
version: 61.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
@@ -427,6 +427,7 @@ files:
|
|
427
427
|
- app/assets/images/govuk_publishing_components/crests/ukaea_crest_18px_x2.png
|
428
428
|
- app/assets/images/govuk_publishing_components/crests/ukho_18px_x2.png
|
429
429
|
- app/assets/images/govuk_publishing_components/crests/wales_crest_18px_x2.png
|
430
|
+
- app/assets/images/govuk_publishing_components/draft-watermark.png
|
430
431
|
- app/assets/images/govuk_publishing_components/favicon-development.png
|
431
432
|
- app/assets/images/govuk_publishing_components/favicon-example.png
|
432
433
|
- app/assets/images/govuk_publishing_components/favicon-integration.png
|