govuk_publishing_components 36.0.3 → 36.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/models/govuk_publishing_components/audit_applications.rb +1 -1
- data/app/views/govuk_publishing_components/components/_file_upload.html.erb +18 -1
- data/app/views/govuk_publishing_components/components/docs/file_upload.yml +11 -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: 2a1b48c8e40b95414bf80c8315e867f24d29686de682e051b3f85cd7ab0a88b2
|
4
|
+
data.tar.gz: dcfa431c373237617dbed7ef353377047874cb3ec7778126db4d5000393fdfb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b35385b4123f674488ea177d7e2761d6f0c8847af76a3e00d932ee0c8bdbb3536c788fd77db99a31a736982204f4140ba1f2667ca957cc73603f6f132846dfc5
|
7
|
+
data.tar.gz: f941bbaebaca0c3ed5a91955a1befe12637861b1bde2a65a6c0ef8f65072f27c8d85755452960df8d8913041fef037081faf15fc07780b0eb3c6c644032e3d74
|
@@ -161,7 +161,7 @@ module GovukPublishingComponents
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def clean_file_path(file)
|
164
|
-
file[/(?<=#{Regexp.escape(@path.to_s)}\/)[\/
|
164
|
+
file[/(?<=#{Regexp.escape(@path.to_s)}\/)[\/0-9a-zA-Z_-]+.[0-9a-zA-Z+.]+/]
|
165
165
|
end
|
166
166
|
|
167
167
|
def clean_file_name(name)
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
add_gem_component_stylesheet("file-upload")
|
3
3
|
|
4
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
5
|
+
|
4
6
|
id ||= "file-upload-#{SecureRandom.hex(4)}"
|
5
7
|
value ||= nil
|
6
8
|
accept ||= nil
|
@@ -13,6 +15,8 @@
|
|
13
15
|
has_error = error_message || error_items.any?
|
14
16
|
hint_id = "hint-#{SecureRandom.hex(4)}"
|
15
17
|
error_id = "error-#{SecureRandom.hex(4)}"
|
18
|
+
heading_size = false unless shared_helper.valid_heading_size?(heading_size)
|
19
|
+
heading_level ||= nil
|
16
20
|
|
17
21
|
css_classes = %w(gem-c-file-upload govuk-file-upload)
|
18
22
|
css_classes << "govuk-file-upload--error" if has_error
|
@@ -30,7 +34,20 @@
|
|
30
34
|
|
31
35
|
<%= content_tag :div, class: form_group_css_classes do %>
|
32
36
|
<% if label %>
|
33
|
-
|
37
|
+
<% label_markup = capture do %>
|
38
|
+
<%= render "govuk_publishing_components/components/label", {
|
39
|
+
html_for: id,
|
40
|
+
heading_size: heading_size
|
41
|
+
}.merge(label.symbolize_keys) %>
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
<% if heading_level %>
|
45
|
+
<%= content_tag(shared_helper.get_heading_level, class: "govuk-label-wrapper") do %>
|
46
|
+
<%= label_markup %>
|
47
|
+
<% end %>
|
48
|
+
<% else %>
|
49
|
+
<%= label_markup %>
|
50
|
+
<% end %>
|
34
51
|
<% end %>
|
35
52
|
|
36
53
|
<% if hint %>
|
@@ -48,3 +48,14 @@ examples:
|
|
48
48
|
text: "Upload an image"
|
49
49
|
name: "file-upload-specific"
|
50
50
|
accept: "image/*"
|
51
|
+
with_label_as_heading:
|
52
|
+
description: |
|
53
|
+
Wraps the label in a heading tag. Valid options are `1` to `6`. To adjust the size of the label/heading, use the `heading_size` option. Valid options are `s`, `m`, `l` and `xl`.
|
54
|
+
|
55
|
+
Based on the [heading/label pattern](https://design-system.service.gov.uk/patterns/question-pages/) in the GOV.UK Design System.
|
56
|
+
data:
|
57
|
+
label:
|
58
|
+
text: "This is a heading 1 and a label"
|
59
|
+
name: "name"
|
60
|
+
heading_level: 1
|
61
|
+
heading_size: "l"
|