govuk_publishing_components 64.0.0 → 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 +12 -3
- 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/views/govuk_publishing_components/applications_page/_table-content.html.erb +7 -0
- data/app/views/govuk_publishing_components/applications_page/show.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/_file_upload.html.erb +4 -0
- data/lib/govuk_publishing_components/presenters/machine_readable/faq_page_schema.rb +1 -2
- 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: 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')
|
|
@@ -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"
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<th scope="col" class="govuk-table__header sticky-table-header">Source</th>
|
|
25
25
|
<th scope="col" class="govuk-table__header sticky-table-header">Gem version</th>
|
|
26
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>
|
|
27
28
|
</tr>
|
|
28
29
|
</thead>
|
|
29
30
|
<tbody class="govuk-table__body">
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
heading_level ||= nil
|
|
19
19
|
javascript ||= false
|
|
20
20
|
|
|
21
|
+
if javascript
|
|
22
|
+
label[:data_attributes] = { ga4_hidden_input: "#{id}-input" }
|
|
23
|
+
end
|
|
24
|
+
|
|
21
25
|
css_classes = %w(gem-c-file-upload govuk-file-upload)
|
|
22
26
|
css_classes << "govuk-file-upload--error" if has_error
|
|
23
27
|
form_group_css_classes = %w(govuk-form-group)
|
|
@@ -24,8 +24,7 @@ module GovukPublishingComponents
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def questions_and_answers_markup
|
|
27
|
-
question_and_answers.select { |_, value| value[:answer].present? }
|
|
28
|
-
.map do |question, value|
|
|
27
|
+
question_and_answers.select { |_, value| value[:answer].present? }.map do |question, value|
|
|
29
28
|
q_and_a_url = section_url(value[:anchor])
|
|
30
29
|
|
|
31
30
|
{
|
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: 64.
|
|
4
|
+
version: 64.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
@@ -2115,7 +2115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
2115
2115
|
- !ruby/object:Gem::Version
|
|
2116
2116
|
version: '0'
|
|
2117
2117
|
requirements: []
|
|
2118
|
-
rubygems_version: 4.0.
|
|
2118
|
+
rubygems_version: 4.0.6
|
|
2119
2119
|
specification_version: 4
|
|
2120
2120
|
summary: A gem to document components in GOV.UK frontend applications
|
|
2121
2121
|
test_files: []
|