govuk_design_system_formbuilder 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f19999243a8facc30d8e8fafd20687d0ea16d3ef4efd5092372d421d93c6f0c
|
4
|
+
data.tar.gz: 5d56211f506af018681452b17ec94748248a15371785de25b533b4faf636525c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef480806a30d168360266e4fef1f8268a3d7afb9dfe5f304d10d1035b2be71c4b79924b7e284649c35034ea30d0d6559ba773cf09b4856ce6067e634f8bc0e65
|
7
|
+
data.tar.gz: dce945b2a97735b5d7a877c3faa5695cad5857b095393dcfea5ad6f9e3dce7e0fe2ce16600d89a5635816f1b7ec43725f7ad914602f91f1a2ef89b5b53018571
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/fde73b5dc9476197281b/test_coverage)](https://codeclimate.com/github/DFE-Digital/govuk_design_system_formbuilder/test_coverage)
|
8
8
|
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=DFE-Digital/govuk_design_system_formbuilder)](https://dependabot.com)
|
9
9
|
[![GitHub license](https://img.shields.io/github/license/DFE-Digital/govuk_design_system_formbuilder)](https://github.com/DFE-Digital/govuk_design_system_formbuilder/blob/master/LICENSE)
|
10
|
-
[![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.
|
10
|
+
[![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.10.1-brightgreen)](https://design-system.service.gov.uk)
|
11
11
|
|
12
12
|
This library provides an easy-to-use form builder for the [GOV.UK Design System](https://design-system.service.gov.uk/).
|
13
13
|
|
@@ -456,6 +456,7 @@ module GOVUKDesignSystemFormBuilder
|
|
456
456
|
# @param inline [Boolean] controls whether the radio buttons are displayed inline or not
|
457
457
|
# @param small [Boolean] controls whether small radio buttons are used instead of regular-sized ones
|
458
458
|
# @param bold_labels [Boolean] controls whether the radio button labels are bold
|
459
|
+
# @param include_hidden [Boolean] controls whether a hidden field is inserted to allow for empty submissions
|
459
460
|
# @param classes [Array,String] Classes to add to the radio button container.
|
460
461
|
# @option legend text [String] the fieldset legend's text content
|
461
462
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
@@ -500,7 +501,7 @@ module GOVUKDesignSystemFormBuilder
|
|
500
501
|
# :name,
|
501
502
|
# legend: -> { tag.h3('Which category do you belong to?') }
|
502
503
|
#
|
503
|
-
def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method = nil, hint_method = nil, hint: {}, legend: {}, caption: {}, inline: false, small: false, bold_labels: false, classes: nil, form_group: {}, &block)
|
504
|
+
def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method = nil, hint_method = nil, hint: {}, legend: {}, caption: {}, inline: false, small: false, bold_labels: false, classes: nil, include_hidden: false, form_group: {}, &block)
|
504
505
|
Elements::Radios::Collection.new(
|
505
506
|
self,
|
506
507
|
object_name,
|
@@ -517,6 +518,7 @@ module GOVUKDesignSystemFormBuilder
|
|
517
518
|
bold_labels: bold_labels,
|
518
519
|
classes: classes,
|
519
520
|
form_group: form_group,
|
521
|
+
include_hidden: include_hidden,
|
520
522
|
&block
|
521
523
|
).html
|
522
524
|
end
|
@@ -850,7 +852,7 @@ module GOVUKDesignSystemFormBuilder
|
|
850
852
|
# @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
|
851
853
|
# @option caption kwargs [Hash] additional arguments are applied as attributes on the caption +span+ element
|
852
854
|
# @param omit_day [Boolean] do not render a day input, only capture month and year
|
853
|
-
# @param wildcards [Boolean] add an 'X' to the
|
855
|
+
# @param wildcards [Boolean] add an 'X' to the day and month patterns so users can add approximate dates
|
854
856
|
# @param form_group [Hash] configures the form group
|
855
857
|
# @option form_group classes [Array,String] sets the form group's classes
|
856
858
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
@@ -6,27 +6,28 @@ module GOVUKDesignSystemFormBuilder
|
|
6
6
|
include Traits::Hint
|
7
7
|
include Traits::Supplemental
|
8
8
|
|
9
|
-
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint_method:, hint:, legend:, caption:, inline:, small:, bold_labels:, classes:, form_group:, &block)
|
9
|
+
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint_method:, hint:, legend:, caption:, inline:, small:, bold_labels:, classes:, form_group:, include_hidden:, &block)
|
10
10
|
super(builder, object_name, attribute_name, &block)
|
11
11
|
|
12
|
-
@collection
|
13
|
-
@value_method
|
14
|
-
@text_method
|
15
|
-
@hint_method
|
16
|
-
@inline
|
17
|
-
@small
|
18
|
-
@legend
|
19
|
-
@caption
|
20
|
-
@hint
|
21
|
-
@classes
|
22
|
-
@form_group
|
23
|
-
@
|
12
|
+
@collection = collection
|
13
|
+
@value_method = value_method
|
14
|
+
@text_method = text_method
|
15
|
+
@hint_method = hint_method
|
16
|
+
@inline = inline
|
17
|
+
@small = small
|
18
|
+
@legend = legend
|
19
|
+
@caption = caption
|
20
|
+
@hint = hint
|
21
|
+
@classes = classes
|
22
|
+
@form_group = form_group
|
23
|
+
@include_hidden = include_hidden
|
24
|
+
@bold_labels = hint_method.present? || bold_labels
|
24
25
|
end
|
25
26
|
|
26
27
|
def html
|
27
28
|
Containers::FormGroup.new(@builder, @object_name, @attribute_name, **@form_group).html do
|
28
29
|
Containers::Fieldset.new(@builder, @object_name, @attribute_name, **fieldset_options).html do
|
29
|
-
safe_join([supplemental_content, hint_element, error_element, radios])
|
30
|
+
safe_join([hidden_field, supplemental_content, hint_element, error_element, radios])
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
@@ -47,6 +48,12 @@ module GOVUKDesignSystemFormBuilder
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
51
|
+
def hidden_field
|
52
|
+
return unless @include_hidden
|
53
|
+
|
54
|
+
@builder.hidden_field(@attribute_name, value: "")
|
55
|
+
end
|
56
|
+
|
50
57
|
def collection
|
51
58
|
@collection.map.with_index do |item, i|
|
52
59
|
Elements::Radios::CollectionRadioButton.new(@builder, @object_name, @attribute_name, item, **collection_options(i)).html
|
metadata
CHANGED
@@ -1,57 +1,75 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_design_system_formbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.1.0
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '6.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 6.1.0
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '6.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activemodel
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 6.1.0
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
42
|
+
version: '6.1'
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 6.1.0
|
38
50
|
- - ">="
|
39
51
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
52
|
+
version: '6.1'
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: activesupport
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 6.1.0
|
45
60
|
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
62
|
+
version: '6.1'
|
48
63
|
type: :runtime
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 6.1.0
|
52
70
|
- - ">="
|
53
71
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
72
|
+
version: '6.1'
|
55
73
|
- !ruby/object:Gem::Dependency
|
56
74
|
name: rubocop-govuk
|
57
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,14 +194,14 @@ dependencies:
|
|
176
194
|
requirements:
|
177
195
|
- - "~>"
|
178
196
|
- !ruby/object:Gem::Version
|
179
|
-
version: 3.
|
197
|
+
version: 3.25.0
|
180
198
|
type: :development
|
181
199
|
prerelease: false
|
182
200
|
version_requirements: !ruby/object:Gem::Requirement
|
183
201
|
requirements:
|
184
202
|
- - "~>"
|
185
203
|
- !ruby/object:Gem::Version
|
186
|
-
version: 3.
|
204
|
+
version: 3.25.0
|
187
205
|
- !ruby/object:Gem::Dependency
|
188
206
|
name: rubypants
|
189
207
|
requirement: !ruby/object:Gem::Requirement
|