govuk_design_system_formbuilder 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/lib/govuk_design_system_formbuilder/base.rb +13 -2
- data/lib/govuk_design_system_formbuilder/builder.rb +39 -16
- data/lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/fieldset.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/supplemental.rb +24 -0
- data/lib/govuk_design_system_formbuilder/elements/check_boxes/collection.rb +3 -4
- data/lib/govuk_design_system_formbuilder/elements/check_boxes/collection_check_box.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/date.rb +3 -4
- data/lib/govuk_design_system_formbuilder/elements/error_summary.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/file.rb +4 -3
- data/lib/govuk_design_system_formbuilder/elements/input.rb +17 -7
- data/lib/govuk_design_system_formbuilder/elements/label.rb +13 -6
- data/lib/govuk_design_system_formbuilder/elements/radios/collection.rb +7 -6
- data/lib/govuk_design_system_formbuilder/elements/radios/collection_radio_button.rb +7 -2
- data/lib/govuk_design_system_formbuilder/elements/select.rb +5 -6
- data/lib/govuk_design_system_formbuilder/elements/submit.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/text_area.rb +10 -4
- data/lib/govuk_design_system_formbuilder/version.rb +1 -1
- data/lib/govuk_design_system_formbuilder.rb +2 -1
- metadata +108 -10
- data/Rakefile +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '038b9fbda5b650e3f3a0b954180f2e1d6ad0f78292e35b5ada83a105383e63a1'
|
4
|
+
data.tar.gz: baf3d3ec5d4a8eb9626ce905eec6581391c039078fd3b4f61658f5e7f89406f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 887c07fd7dfdef6d704cd12ce43fd3acf151896b761046bb1f6dbbc547f6dd06a76b0566faf0ba31f1abf912a3381aff319de80f55727e8e6b683a63cce5573b
|
7
|
+
data.tar.gz: 9905f1671e4603866744256b1595b43a220eac1bdbfc890c414de6972051bd6a34960b6b04165a3ec5050ea9709b052c12fa27b16dfc91876345e324ef542178
|
data/README.md
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
[![Build Status](https://travis-ci.com/DFE-Digital/govuk_design_system_formbuilder.svg?branch=master)](https://travis-ci.com/DFE-Digital/govuk_design_system_formbuilder)
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/fde73b5dc9476197281b/maintainability)](https://codeclimate.com/github/DFE-Digital/govuk_design_system_formbuilder/maintainability)
|
5
5
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/fde73b5dc9476197281b/test_coverage)](https://codeclimate.com/github/DFE-Digital/govuk_design_system_formbuilder/test_coverage)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/govuk_design_system_formbuilder.svg)](https://badge.fury.io/rb/govuk_design_system_formbuilder)
|
7
|
+
[![Netlify Status](https://api.netlify.com/api/v1/badges/d4c50b8d-6ca3-4797-9ab3-6e0731c72b44/deploy-status)](https://app.netlify.com/sites/govuk-form-builder/deploys)
|
6
8
|
|
7
9
|
This gem provides a easy-to-use form builder that generates forms that are
|
8
|
-
fully-compliant with version 3 of the [GOV.UK Design System](https://design-system.service.gov.uk/),
|
10
|
+
fully-compliant with version 3.2.0 of the [GOV.UK Design System](https://design-system.service.gov.uk/),
|
9
11
|
minimising the amount of markup you need to write.
|
10
12
|
|
11
13
|
The latest version of this gem that supports GOV.UK Design System version 2 is
|
@@ -13,14 +15,15 @@ The latest version of this gem that supports GOV.UK Design System version 2 is
|
|
13
15
|
|
14
16
|
In addition to the basic markup, the more-advanced functionality of the Design
|
15
17
|
System is exposed via the API. Adding [JavaScript-enhanced word count
|
16
|
-
checking](https://
|
18
|
+
checking](https://govuk-form-builder.netlify.com/form-elements/text-area/)
|
17
19
|
to text areas or [setting the size and weight of
|
18
|
-
labels](https://
|
20
|
+
labels](https://govuk-form-builder.netlify.com/introduction/labels-hints-and-legends/)
|
19
21
|
on text fields requires only a single argument.
|
20
22
|
|
21
23
|
If you're still not sure what a form builder is or how it works, don't worry!
|
22
24
|
[This screencast](https://www.youtube.com/watch?v=PhoFZ0qXAlA) should give you
|
23
|
-
an idea of what's on offer
|
25
|
+
an idea of what's on offer and [the official guide](https://govuk-form-builder.netlify.com) goes
|
26
|
+
into a bit more depth on how everything works 😅
|
24
27
|
|
25
28
|
## What's included
|
26
29
|
|
@@ -32,8 +35,9 @@ an idea of what's on offer 😅
|
|
32
35
|
* Additional params for programmatically adding hints to check box and radio
|
33
36
|
button collections
|
34
37
|
* No external dependencies
|
35
|
-
* [Extensive documentation](https://www.rubydoc.info/gems/govuk_design_system_formbuilder/GOVUKDesignSystemFormBuilder/Builder)
|
36
38
|
* An exhaustive test suite
|
39
|
+
* [Extensive documentation](https://www.rubydoc.info/gems/govuk_design_system_formbuilder/GOVUKDesignSystemFormBuilder/Builder)
|
40
|
+
* [A full guide](https://govuk-form-builder.netlify.com/)
|
37
41
|
|
38
42
|
## Installation
|
39
43
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
class Base
|
3
|
-
def initialize(builder, object_name, attribute_name)
|
3
|
+
def initialize(builder, object_name, attribute_name, &block)
|
4
4
|
@builder = builder
|
5
5
|
@object_name = object_name
|
6
6
|
@attribute_name = attribute_name
|
7
|
+
@block_content = @builder.capture { block.call } if block_given?
|
7
8
|
end
|
8
9
|
|
9
10
|
def hint_element
|
@@ -18,6 +19,10 @@ module GOVUKDesignSystemFormBuilder
|
|
18
19
|
@label_element ||= Elements::Label.new(@builder, @object_name, @attribute_name, **@label)
|
19
20
|
end
|
20
21
|
|
22
|
+
def supplemental_content
|
23
|
+
@supplemental_content ||= Containers::Supplemental.new(@builder, @object_name, @attribute_name, @block_content)
|
24
|
+
end
|
25
|
+
|
21
26
|
# returns the id value used for the input
|
22
27
|
#
|
23
28
|
# @note field_id is overridden so that the error summary can link to the
|
@@ -40,7 +45,7 @@ module GOVUKDesignSystemFormBuilder
|
|
40
45
|
end
|
41
46
|
|
42
47
|
def hint_id
|
43
|
-
return nil
|
48
|
+
return nil unless @hint_text.present?
|
44
49
|
|
45
50
|
build_id('hint')
|
46
51
|
end
|
@@ -55,6 +60,12 @@ module GOVUKDesignSystemFormBuilder
|
|
55
60
|
build_id('conditional')
|
56
61
|
end
|
57
62
|
|
63
|
+
def supplemental_id
|
64
|
+
return nil unless @block_content.present?
|
65
|
+
|
66
|
+
build_id('supplemental')
|
67
|
+
end
|
68
|
+
|
58
69
|
def has_errors?
|
59
70
|
@builder.object.errors.any? &&
|
60
71
|
@builder.object.errors.messages.dig(@attribute_name).present?
|
@@ -10,7 +10,9 @@ module GOVUKDesignSystemFormBuilder
|
|
10
10
|
# @option label text [String] the label text
|
11
11
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
12
12
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
13
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
13
14
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
15
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
14
16
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
15
17
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
16
18
|
#
|
@@ -20,8 +22,8 @@ module GOVUKDesignSystemFormBuilder
|
|
20
22
|
# hint_text: 'It says it on your birth certificate',
|
21
23
|
# required: true,
|
22
24
|
# placeholder: 'Ralph Wiggum'
|
23
|
-
def govuk_text_field(attribute_name, hint_text: nil, label: {}, width:
|
24
|
-
Elements::Input.new(self, object_name, attribute_name, attribute_type: :text, hint_text: hint_text, label: label, width: width, **args).html
|
25
|
+
def govuk_text_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
|
26
|
+
Elements::Input.new(self, object_name, attribute_name, attribute_type: :text, hint_text: hint_text, label: label, width: width, **args, &block).html
|
25
27
|
end
|
26
28
|
|
27
29
|
# Generates a input of type +tel+
|
@@ -34,7 +36,9 @@ module GOVUKDesignSystemFormBuilder
|
|
34
36
|
# @option label text [String] the label text
|
35
37
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
36
38
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
39
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
37
40
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
41
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
38
42
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
39
43
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
40
44
|
# @see https://design-system.service.gov.uk/patterns/telephone-numbers/ GOV.UK Telephone number patterns
|
@@ -45,8 +49,8 @@ module GOVUKDesignSystemFormBuilder
|
|
45
49
|
# hint_text: 'Include the dialling code',
|
46
50
|
# required: true,
|
47
51
|
# placeholder: '0123 456 789'
|
48
|
-
def govuk_phone_field(attribute_name, hint_text: nil, label: {}, width:
|
49
|
-
Elements::Input.new(self, object_name, attribute_name, attribute_type: :phone, hint_text: hint_text, label: label, width: width, **args).html
|
52
|
+
def govuk_phone_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
|
53
|
+
Elements::Input.new(self, object_name, attribute_name, attribute_type: :phone, hint_text: hint_text, label: label, width: width, **args, &block).html
|
50
54
|
end
|
51
55
|
|
52
56
|
# Generates a input of type +email+
|
@@ -59,7 +63,9 @@ module GOVUKDesignSystemFormBuilder
|
|
59
63
|
# @option label text [String] the label text
|
60
64
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
61
65
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
66
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
62
67
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
68
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
63
69
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
64
70
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
65
71
|
# @see https://design-system.service.gov.uk/patterns/email-addresses/ GOV.UK Email address patterns
|
@@ -68,8 +74,8 @@ module GOVUKDesignSystemFormBuilder
|
|
68
74
|
# = f.govuk_email_field :email_address,
|
69
75
|
# label: { text: 'Enter your email address' },
|
70
76
|
# placeholder: 'ralph.wiggum@springfield.edu'
|
71
|
-
def govuk_email_field(attribute_name, hint_text: nil, label: {}, width:
|
72
|
-
Elements::Input.new(self, object_name, attribute_name, attribute_type: :email, hint_text: hint_text, label: label, width: width, **args).html
|
77
|
+
def govuk_email_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
|
78
|
+
Elements::Input.new(self, object_name, attribute_name, attribute_type: :email, hint_text: hint_text, label: label, width: width, **args, &block).html
|
73
79
|
end
|
74
80
|
|
75
81
|
# Generates a input of type +url+
|
@@ -82,7 +88,9 @@ module GOVUKDesignSystemFormBuilder
|
|
82
88
|
# @option label text [String] the label text
|
83
89
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
84
90
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
91
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
85
92
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
93
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
86
94
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
87
95
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
88
96
|
#
|
@@ -91,8 +99,8 @@ module GOVUKDesignSystemFormBuilder
|
|
91
99
|
# label: { text: 'Enter your favourite website' },
|
92
100
|
# placeholder: 'https://www.gov.uk',
|
93
101
|
# autocomplete: 'url'
|
94
|
-
def govuk_url_field(attribute_name, hint_text: nil, label: {}, width:
|
95
|
-
Elements::Input.new(self, object_name, attribute_name, attribute_type: :url, hint_text: hint_text, label: label, width: width, **args).html
|
102
|
+
def govuk_url_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
|
103
|
+
Elements::Input.new(self, object_name, attribute_name, attribute_type: :url, hint_text: hint_text, label: label, width: width, **args, &block).html
|
96
104
|
end
|
97
105
|
|
98
106
|
# Generates a input of type +number+
|
@@ -105,7 +113,9 @@ module GOVUKDesignSystemFormBuilder
|
|
105
113
|
# @option label text [String] the label text
|
106
114
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
107
115
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
116
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
108
117
|
# @option args [Hash] args additional arguments are applied as attributes to the +input+ element
|
118
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
109
119
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
110
120
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
111
121
|
#
|
@@ -116,8 +126,8 @@ module GOVUKDesignSystemFormBuilder
|
|
116
126
|
# min: 80,
|
117
127
|
# max: 150,
|
118
128
|
# step: 5
|
119
|
-
def govuk_number_field(attribute_name, hint_text: nil, label: {}, width:
|
120
|
-
Elements::Input.new(self, object_name, attribute_name, attribute_type: :number, hint_text: hint_text, label: label, width: width, **args).html
|
129
|
+
def govuk_number_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
|
130
|
+
Elements::Input.new(self, object_name, attribute_name, attribute_type: :number, hint_text: hint_text, label: label, width: width, **args, &block).html
|
121
131
|
end
|
122
132
|
|
123
133
|
# Generates a +textarea+ element with a label, optional hint. Also offers
|
@@ -130,11 +140,13 @@ module GOVUKDesignSystemFormBuilder
|
|
130
140
|
# @option label text [String] the label text
|
131
141
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
132
142
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
143
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
133
144
|
# @param max_words [Integer] adds the GOV.UK max word count
|
134
145
|
# @param max_chars [Integer] adds the GOV.UK max characters count
|
135
146
|
# @param threshold [Integer] only show the +max_words+ and +max_chars+ warnings once a threshold (percentage) is reached
|
136
147
|
# @param rows [Integer] sets the initial number of rows
|
137
148
|
# @option args [Hash] args additional arguments are applied as attributes to the +textarea+ element
|
149
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
138
150
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
139
151
|
# @see https://design-system.service.gov.uk/components/character-count GOV.UK character count component
|
140
152
|
# @note Setting +max_chars+ or +max_words+ will add a caption beneath the +textarea+ with a live count of words
|
@@ -145,8 +157,8 @@ module GOVUKDesignSystemFormBuilder
|
|
145
157
|
# label: { text: 'Tell us about your work history' },
|
146
158
|
# rows: 8,
|
147
159
|
# max_words: 300
|
148
|
-
def govuk_text_area(attribute_name, hint_text: nil, label: {}, max_words: nil, max_chars: nil, rows: 5, threshold: nil, **args)
|
149
|
-
Elements::TextArea.new(self, object_name, attribute_name, hint_text: hint_text, label: label, max_words: max_words, max_chars: max_chars, rows: rows, threshold: threshold, **args).html
|
160
|
+
def govuk_text_area(attribute_name, hint_text: nil, label: {}, max_words: nil, max_chars: nil, rows: 5, threshold: nil, **args, &block)
|
161
|
+
Elements::TextArea.new(self, object_name, attribute_name, hint_text: hint_text, label: label, max_words: max_words, max_chars: max_chars, rows: rows, threshold: threshold, **args, &block).html
|
150
162
|
end
|
151
163
|
|
152
164
|
# Generates a +select+ element containing +option+ for each member in the provided collection
|
@@ -159,6 +171,8 @@ module GOVUKDesignSystemFormBuilder
|
|
159
171
|
# @option label text [String] the label text
|
160
172
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
161
173
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
174
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
175
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
162
176
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
163
177
|
def govuk_collection_select(attribute_name, collection, value_method, text_method, options: {}, html_options: {}, hint_text: nil, label: {}, &block)
|
164
178
|
Elements::Select.new(
|
@@ -178,9 +192,13 @@ module GOVUKDesignSystemFormBuilder
|
|
178
192
|
|
179
193
|
# Generates a radio button for each item in the supplied collection
|
180
194
|
#
|
181
|
-
# @note Unlike the Rails
|
195
|
+
# @note Unlike the Rails +#collection_radio_buttons+ helper, this version can also insert
|
182
196
|
# hints per item in the collection by supplying a +:hint_method+
|
183
197
|
#
|
198
|
+
# @note +:bold_labels+, while false by default, is set to true when a
|
199
|
+
# +:hint_method+ is provided. This is done to make the label stand out more
|
200
|
+
# from the hint.
|
201
|
+
#
|
184
202
|
# @param attribute_name [Symbol] The name of the attribute
|
185
203
|
# @param collection [Enumerable<Object>] Options to be added to the +select+ element
|
186
204
|
# @param value_method [Symbol] The method called against each member of the collection to provide the value
|
@@ -190,6 +208,7 @@ module GOVUKDesignSystemFormBuilder
|
|
190
208
|
# @param legend [Hash] options for configuring the legend
|
191
209
|
# @param inline [Boolean] controls whether the radio buttons are displayed inline or not
|
192
210
|
# @param small [Boolean] controls whether small radio buttons are used instead of regular-sized ones
|
211
|
+
# @param bold_labels [Boolean] controls whether the radio button labels are bold
|
193
212
|
# @option legend text [String] the fieldset legend's text content
|
194
213
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
195
214
|
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+, defaults to +h1+
|
@@ -210,7 +229,7 @@ module GOVUKDesignSystemFormBuilder
|
|
210
229
|
# legend: { text: 'Pick your favourite colour', size: 'm' },
|
211
230
|
# hint_text: 'If you cannot find the exact match choose something close',
|
212
231
|
# inline: false
|
213
|
-
def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {
|
232
|
+
def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {}, inline: false, small: false, bold_labels: false, &block)
|
214
233
|
Elements::Radios::Collection.new(
|
215
234
|
self,
|
216
235
|
object_name,
|
@@ -223,6 +242,7 @@ module GOVUKDesignSystemFormBuilder
|
|
223
242
|
legend: legend,
|
224
243
|
inline: inline,
|
225
244
|
small: small,
|
245
|
+
bold_labels: bold_labels,
|
226
246
|
&block
|
227
247
|
).html
|
228
248
|
end
|
@@ -377,6 +397,7 @@ module GOVUKDesignSystemFormBuilder
|
|
377
397
|
# @option label text [String] the label text
|
378
398
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
379
399
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
400
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
380
401
|
# @param multiple [Boolean] controls whether the check box is part of a collection or represents a single attribute
|
381
402
|
# @param block [Block] any HTML passed in will form the contents of the fieldset
|
382
403
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
@@ -504,8 +525,10 @@ module GOVUKDesignSystemFormBuilder
|
|
504
525
|
# @option label text [String] the label text
|
505
526
|
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
506
527
|
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
528
|
+
# @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
|
507
529
|
# @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
|
508
530
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
531
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
509
532
|
#
|
510
533
|
# @example A photo upload field with file type specifier
|
511
534
|
# = f.govuk_file_field :photo, label: { text: 'Upload your photo' }, accept: 'image/*'
|
@@ -516,8 +539,8 @@ module GOVUKDesignSystemFormBuilder
|
|
516
539
|
# @note Remember to set +multipart: true+ when creating a form with file
|
517
540
|
# uploads, {https://guides.rubyonrails.org/form_helpers.html#uploading-files see
|
518
541
|
# the Rails documentation} for more information
|
519
|
-
def govuk_file_field(attribute_name, label: {}, hint_text: nil, **args)
|
520
|
-
Elements::File.new(self, object_name, attribute_name, label: label, hint_text: hint_text, **args).html
|
542
|
+
def govuk_file_field(attribute_name, label: {}, hint_text: nil, **args, &block)
|
543
|
+
Elements::File.new(self, object_name, attribute_name, label: label, hint_text: hint_text, **args, &block).html
|
521
544
|
end
|
522
545
|
end
|
523
546
|
end
|
@@ -2,7 +2,7 @@ module GOVUKDesignSystemFormBuilder
|
|
2
2
|
module Containers
|
3
3
|
class CheckBoxesFieldset < GOVUKDesignSystemFormBuilder::Base
|
4
4
|
def initialize(builder, object_name, attribute_name, hint_text:, legend:, small:, &block)
|
5
|
-
super(builder, object_name, attribute_name)
|
5
|
+
super(builder, object_name, attribute_name, &block)
|
6
6
|
|
7
7
|
@legend = legend
|
8
8
|
@hint_text = hint_text
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Containers
|
3
3
|
class Fieldset < GOVUKDesignSystemFormBuilder::Base
|
4
|
-
LEGEND_DEFAULTS = { text: nil, tag: 'h1', size: '
|
4
|
+
LEGEND_DEFAULTS = { text: nil, tag: 'h1', size: 'm' }.freeze
|
5
5
|
LEGEND_SIZES = %w(xl l m s).freeze
|
6
6
|
|
7
7
|
def initialize(builder, legend: {}, described_by: nil)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module GOVUKDesignSystemFormBuilder
|
2
|
+
module Containers
|
3
|
+
class Supplemental < GOVUKDesignSystemFormBuilder::Base
|
4
|
+
def initialize(builder, object_name, attribute_name, content)
|
5
|
+
@builder = builder
|
6
|
+
@object_name = object_name
|
7
|
+
@attribute_name = attribute_name
|
8
|
+
@content = content
|
9
|
+
end
|
10
|
+
|
11
|
+
def html
|
12
|
+
return nil unless @content.present?
|
13
|
+
|
14
|
+
@builder.content_tag('div', id: supplemental_id) do
|
15
|
+
@content
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def supplemental_id
|
20
|
+
build_id('supplemental')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -3,7 +3,7 @@ module GOVUKDesignSystemFormBuilder
|
|
3
3
|
module CheckBoxes
|
4
4
|
class Collection < GOVUKDesignSystemFormBuilder::Base
|
5
5
|
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint_method: nil, hint_text:, legend:, small:, &block)
|
6
|
-
super(builder, object_name, attribute_name)
|
6
|
+
super(builder, object_name, attribute_name, &block)
|
7
7
|
|
8
8
|
@collection = collection
|
9
9
|
@value_method = value_method
|
@@ -12,17 +12,16 @@ module GOVUKDesignSystemFormBuilder
|
|
12
12
|
@small = small
|
13
13
|
@legend = legend
|
14
14
|
@hint_text = hint_text
|
15
|
-
@block_content = @builder.capture { block.call } if block_given?
|
16
15
|
end
|
17
16
|
|
18
17
|
def html
|
19
18
|
Containers::FormGroup.new(@builder, @object_name, @attribute_name).html do
|
20
|
-
Containers::Fieldset.new(@builder, legend: @legend, described_by: [
|
19
|
+
Containers::Fieldset.new(@builder, legend: @legend, described_by: [error_id, hint_id, supplemental_id]).html do
|
21
20
|
@builder.safe_join(
|
22
21
|
[
|
23
22
|
hint_element.html,
|
24
23
|
error_element.html,
|
25
|
-
|
24
|
+
supplemental_content.html,
|
26
25
|
Containers::CheckBoxes.new(@builder, small: @small).html do
|
27
26
|
build_collection
|
28
27
|
end
|
@@ -18,7 +18,7 @@ module GOVUKDesignSystemFormBuilder
|
|
18
18
|
@checkbox.check_box(
|
19
19
|
id: field_id(link_errors: @link_errors),
|
20
20
|
class: "govuk-checkboxes__input",
|
21
|
-
aria: { describedby:
|
21
|
+
aria: { describedby: hint_id }
|
22
22
|
),
|
23
23
|
label_element.html,
|
24
24
|
hint_element.html
|
@@ -52,7 +52,7 @@ module GOVUKDesignSystemFormBuilder
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def hint_element
|
55
|
-
@hint_element ||= Elements::Hint.new(@builder, @object_name, @attribute_name, @hint_text, checkbox: true)
|
55
|
+
@hint_element ||= Elements::Hint.new(@builder, @object_name, @attribute_name, @hint_text, @value, checkbox: true)
|
56
56
|
end
|
57
57
|
|
58
58
|
def conditional_classes
|
@@ -4,21 +4,20 @@ module GOVUKDesignSystemFormBuilder
|
|
4
4
|
SEGMENTS = { day: '3i', month: '2i', year: '1i' }.freeze
|
5
5
|
|
6
6
|
def initialize(builder, object_name, attribute_name, legend:, hint_text:, date_of_birth: false, &block)
|
7
|
-
super(builder, object_name, attribute_name)
|
7
|
+
super(builder, object_name, attribute_name, &block)
|
8
8
|
@legend = legend
|
9
9
|
@hint_text = hint_text
|
10
10
|
@date_of_birth = date_of_birth
|
11
|
-
@block_content = @builder.capture { block.call } if block_given?
|
12
11
|
end
|
13
12
|
|
14
13
|
def html
|
15
14
|
Containers::FormGroup.new(@builder, @object_name, @attribute_name).html do
|
16
|
-
Containers::Fieldset.new(@builder, legend: @legend, described_by: [
|
15
|
+
Containers::Fieldset.new(@builder, legend: @legend, described_by: [error_id, hint_id, supplemental_id]).html do
|
17
16
|
@builder.safe_join(
|
18
17
|
[
|
19
18
|
hint_element.html,
|
20
19
|
error_element.html,
|
21
|
-
|
20
|
+
supplemental_content.html,
|
22
21
|
@builder.content_tag('div', class: 'govuk-date-input') do
|
23
22
|
@builder.safe_join(
|
24
23
|
[
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Elements
|
3
3
|
class File < GOVUKDesignSystemFormBuilder::Base
|
4
|
-
def initialize(builder, object_name, attribute_name, hint_text:, label:, **extra_args)
|
5
|
-
super(builder, object_name, attribute_name)
|
4
|
+
def initialize(builder, object_name, attribute_name, hint_text:, label:, **extra_args, &block)
|
5
|
+
super(builder, object_name, attribute_name, &block)
|
6
6
|
|
7
7
|
@label = label
|
8
8
|
@hint_text = hint_text
|
@@ -16,11 +16,12 @@ module GOVUKDesignSystemFormBuilder
|
|
16
16
|
label_element.html,
|
17
17
|
hint_element.html,
|
18
18
|
error_element.html,
|
19
|
+
supplemental_content.html,
|
19
20
|
@builder.file_field(
|
20
21
|
@attribute_name,
|
21
22
|
id: field_id(link_errors: true),
|
22
23
|
class: file_classes,
|
23
|
-
aria: { describedby: described_by(
|
24
|
+
aria: { describedby: described_by(hint_id, error_id, supplemental_id) },
|
24
25
|
**@extra_args
|
25
26
|
)
|
26
27
|
]
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Elements
|
3
3
|
class Input < GOVUKDesignSystemFormBuilder::Base
|
4
|
-
def initialize(builder, object_name, attribute_name, attribute_type:, hint_text:, label:, width:, **extra_args)
|
5
|
-
super(builder, object_name, attribute_name)
|
4
|
+
def initialize(builder, object_name, attribute_name, attribute_type:, hint_text:, label:, width:, **extra_args, &block)
|
5
|
+
super(builder, object_name, attribute_name, &block)
|
6
6
|
|
7
7
|
@width = width
|
8
8
|
@extra_args = extra_args
|
@@ -17,13 +17,20 @@ module GOVUKDesignSystemFormBuilder
|
|
17
17
|
[
|
18
18
|
label_element.html,
|
19
19
|
hint_element.html,
|
20
|
+
supplemental_content.html,
|
20
21
|
error_element.html,
|
21
22
|
@builder.send(
|
22
23
|
@builder_method,
|
23
24
|
@attribute_name,
|
24
25
|
id: field_id(link_errors: true),
|
25
26
|
class: input_classes,
|
26
|
-
aria: {
|
27
|
+
aria: {
|
28
|
+
describedby: described_by(
|
29
|
+
hint_id,
|
30
|
+
error_id,
|
31
|
+
supplemental_id
|
32
|
+
)
|
33
|
+
},
|
27
34
|
**@extra_args
|
28
35
|
)
|
29
36
|
]
|
@@ -34,16 +41,19 @@ module GOVUKDesignSystemFormBuilder
|
|
34
41
|
private
|
35
42
|
|
36
43
|
def input_classes
|
37
|
-
%w(govuk-input).
|
38
|
-
|
39
|
-
|
40
|
-
|
44
|
+
%w(govuk-input).push(width_classes, error_classes).compact
|
45
|
+
end
|
46
|
+
|
47
|
+
def error_classes
|
48
|
+
('govuk-input--error') if has_errors?
|
41
49
|
end
|
42
50
|
|
43
51
|
def width_classes
|
44
52
|
return if @width.blank?
|
45
53
|
|
46
54
|
case @width
|
55
|
+
when nil then nil
|
56
|
+
|
47
57
|
# fixed (character) widths
|
48
58
|
when 20 then 'govuk-input--width-20'
|
49
59
|
when 10 then 'govuk-input--width-10'
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Elements
|
3
3
|
class Label < GOVUKDesignSystemFormBuilder::Base
|
4
|
-
def initialize(builder, object_name, attribute_name, text: nil, value: nil, size: nil, radio: false, checkbox: false, tag: nil)
|
4
|
+
def initialize(builder, object_name, attribute_name, text: nil, value: nil, size: nil, hidden: false, radio: false, checkbox: false, tag: nil)
|
5
5
|
super(builder, object_name, attribute_name)
|
6
6
|
|
7
|
-
@text = label_text(text)
|
7
|
+
@text = label_text(text, hidden)
|
8
8
|
@value = value # used by field_id
|
9
9
|
@size_class = label_size_class(size)
|
10
10
|
@radio_class = radio_class(radio)
|
@@ -27,15 +27,22 @@ module GOVUKDesignSystemFormBuilder
|
|
27
27
|
def build_label
|
28
28
|
@builder.label(
|
29
29
|
@attribute_name,
|
30
|
-
@text,
|
31
30
|
value: @value,
|
32
31
|
for: field_id(link_errors: true),
|
33
32
|
class: %w(govuk-label).push(@size_class, @weight_class, @radio_class, @checkbox_class).compact
|
34
|
-
)
|
33
|
+
) do
|
34
|
+
@text
|
35
|
+
end
|
35
36
|
end
|
36
37
|
|
37
|
-
def label_text(option_text)
|
38
|
-
[option_text, @value, @attribute_name.capitalize].compact.first
|
38
|
+
def label_text(option_text, hidden)
|
39
|
+
text = [option_text, @value, @attribute_name.capitalize].compact.first
|
40
|
+
|
41
|
+
if hidden
|
42
|
+
@builder.tag.span(text, class: %w(govuk-visually-hidden))
|
43
|
+
else
|
44
|
+
@builder.raw(text)
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
def radio_class(radio)
|
@@ -2,8 +2,8 @@ module GOVUKDesignSystemFormBuilder
|
|
2
2
|
module Elements
|
3
3
|
module Radios
|
4
4
|
class Collection < GOVUKDesignSystemFormBuilder::Base
|
5
|
-
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint_method:, hint_text:, legend:, inline:, small:, &block)
|
6
|
-
super(builder, object_name, attribute_name)
|
5
|
+
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint_method:, hint_text:, legend:, inline:, small:, bold_labels:, &block)
|
6
|
+
super(builder, object_name, attribute_name, &block)
|
7
7
|
|
8
8
|
@collection = collection
|
9
9
|
@value_method = value_method
|
@@ -13,17 +13,17 @@ module GOVUKDesignSystemFormBuilder
|
|
13
13
|
@small = small
|
14
14
|
@legend = legend
|
15
15
|
@hint_text = hint_text
|
16
|
-
@
|
16
|
+
@bold_labels = hint_method.present? || bold_labels
|
17
17
|
end
|
18
18
|
|
19
19
|
def html
|
20
20
|
Containers::FormGroup.new(@builder, @object_name, @attribute_name).html do
|
21
|
-
Containers::Fieldset.new(@builder, legend: @legend, described_by: [
|
21
|
+
Containers::Fieldset.new(@builder, legend: @legend, described_by: [error_id, hint_id, supplemental_id]).html do
|
22
22
|
@builder.safe_join(
|
23
23
|
[
|
24
24
|
hint_element.html,
|
25
25
|
error_element.html,
|
26
|
-
|
26
|
+
supplemental_content.html,
|
27
27
|
Containers::Radios.new(@builder, inline: @inline, small: @small).html do
|
28
28
|
@builder.safe_join(build_collection)
|
29
29
|
end
|
@@ -45,7 +45,8 @@ module GOVUKDesignSystemFormBuilder
|
|
45
45
|
value_method: @value_method,
|
46
46
|
text_method: @text_method,
|
47
47
|
hint_method: @hint_method,
|
48
|
-
link_errors: has_errors? && i.zero
|
48
|
+
link_errors: has_errors? && i.zero?,
|
49
|
+
bold_labels: @bold_labels
|
49
50
|
).html
|
50
51
|
end
|
51
52
|
end
|
@@ -6,13 +6,14 @@ module GOVUKDesignSystemFormBuilder
|
|
6
6
|
# error summary requires that the id of the first radio is linked-to from the corresponding
|
7
7
|
# error message. As when the summary is built what happens later in the form is unknown, we
|
8
8
|
# need to control this to ensure the link is generated correctly
|
9
|
-
def initialize(builder, object_name, attribute_name, item, value_method:, text_method:, hint_method:, link_errors: false)
|
9
|
+
def initialize(builder, object_name, attribute_name, item, value_method:, text_method:, hint_method:, link_errors: false, bold_labels:)
|
10
10
|
super(builder, object_name, attribute_name)
|
11
11
|
@item = item
|
12
12
|
@value = item.send(value_method)
|
13
13
|
@text = item.send(text_method)
|
14
14
|
@hint_text = item.send(hint_method) if hint_method.present?
|
15
15
|
@link_errors = link_errors
|
16
|
+
@bold_labels = bold_labels
|
16
17
|
end
|
17
18
|
|
18
19
|
def html
|
@@ -40,7 +41,11 @@ module GOVUKDesignSystemFormBuilder
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def label_element
|
43
|
-
@label_element ||= Elements::Label.new(@builder, @object_name, @attribute_name, text: @text, value: @value, radio: true)
|
44
|
+
@label_element ||= Elements::Label.new(@builder, @object_name, @attribute_name, text: @text, value: @value, radio: true, size: label_size)
|
45
|
+
end
|
46
|
+
|
47
|
+
def label_size
|
48
|
+
@bold_labels.present? ? 's' : nil
|
44
49
|
end
|
45
50
|
end
|
46
51
|
end
|
@@ -2,7 +2,7 @@ module GOVUKDesignSystemFormBuilder
|
|
2
2
|
module Elements
|
3
3
|
class Select < GOVUKDesignSystemFormBuilder::Base
|
4
4
|
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, options: {}, html_options: {}, hint_text:, label:, &block)
|
5
|
-
super(builder, object_name, attribute_name)
|
5
|
+
super(builder, object_name, attribute_name, &block)
|
6
6
|
|
7
7
|
@collection = collection
|
8
8
|
@value_method = value_method
|
@@ -11,7 +11,6 @@ module GOVUKDesignSystemFormBuilder
|
|
11
11
|
@html_options = html_options
|
12
12
|
@label = label
|
13
13
|
@hint_text = hint_text
|
14
|
-
@block_content = @builder.capture { block.call } if block_given?
|
15
14
|
end
|
16
15
|
|
17
16
|
def html
|
@@ -21,14 +20,14 @@ module GOVUKDesignSystemFormBuilder
|
|
21
20
|
label_element.html,
|
22
21
|
hint_element.html,
|
23
22
|
error_element.html,
|
24
|
-
|
23
|
+
supplemental_content.html,
|
25
24
|
@builder.collection_select(
|
26
25
|
@attribute_name,
|
27
26
|
@collection,
|
28
27
|
@value_method,
|
29
28
|
@text_method,
|
30
29
|
@options,
|
31
|
-
build_html_options
|
30
|
+
build_html_options
|
32
31
|
)
|
33
32
|
]
|
34
33
|
)
|
@@ -37,11 +36,11 @@ module GOVUKDesignSystemFormBuilder
|
|
37
36
|
|
38
37
|
private
|
39
38
|
|
40
|
-
def build_html_options
|
39
|
+
def build_html_options
|
41
40
|
@html_options.deep_merge(
|
42
41
|
id: field_id(link_errors: true),
|
43
42
|
class: select_classes,
|
44
|
-
aria: { describedby: described_by(
|
43
|
+
aria: { describedby: described_by(hint_id, error_id, supplemental_id) }
|
45
44
|
)
|
46
45
|
end
|
47
46
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Elements
|
3
3
|
class TextArea < Base
|
4
|
-
def initialize(builder, object_name, attribute_name, hint_text:, label:, rows:, max_words:, max_chars:, threshold:, **extra_args)
|
5
|
-
super(builder, object_name, attribute_name)
|
4
|
+
def initialize(builder, object_name, attribute_name, hint_text:, label:, rows:, max_words:, max_chars:, threshold:, **extra_args, &block)
|
5
|
+
super(builder, object_name, attribute_name, &block)
|
6
6
|
@label = label
|
7
7
|
@hint_text = hint_text
|
8
8
|
@extra_args = extra_args
|
@@ -17,12 +17,18 @@ module GOVUKDesignSystemFormBuilder
|
|
17
17
|
Containers::FormGroup.new(@builder, @object_name, @attribute_name).html do
|
18
18
|
@builder.safe_join(
|
19
19
|
[
|
20
|
-
[label_element, hint_element, error_element].map(&:html),
|
20
|
+
[label_element, hint_element, error_element, supplemental_content].map(&:html),
|
21
21
|
@builder.text_area(
|
22
22
|
@attribute_name,
|
23
23
|
id: field_id(link_errors: true),
|
24
24
|
class: govuk_textarea_classes,
|
25
|
-
aria: {
|
25
|
+
aria: {
|
26
|
+
describedby: described_by(
|
27
|
+
hint_id,
|
28
|
+
error_id,
|
29
|
+
supplemental_id
|
30
|
+
)
|
31
|
+
},
|
26
32
|
**@extra_args.merge(rows: @rows)
|
27
33
|
)
|
28
34
|
].flatten.compact
|
@@ -31,10 +31,11 @@ require 'govuk_design_system_formbuilder/containers/radios'
|
|
31
31
|
require 'govuk_design_system_formbuilder/containers/radio_buttons_fieldset'
|
32
32
|
require 'govuk_design_system_formbuilder/containers/check_boxes'
|
33
33
|
require 'govuk_design_system_formbuilder/containers/character_count'
|
34
|
+
require 'govuk_design_system_formbuilder/containers/supplemental'
|
34
35
|
|
35
36
|
module GOVUKDesignSystemFormBuilder
|
36
37
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
37
|
-
delegate :content_tag, :tag, :safe_join, :safe_concat, :capture, :link_to, to: :@template
|
38
|
+
delegate :content_tag, :tag, :safe_join, :safe_concat, :capture, :link_to, :raw, to: :@template
|
38
39
|
|
39
40
|
include GOVUKDesignSystemFormBuilder::Builder
|
40
41
|
end
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_design_system_formbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.2'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 5.2.3
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 6.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '5.2'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 5.2.3
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 6.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: govuk-lint
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +134,104 @@ dependencies:
|
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: nanoc
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '4.11'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '4.11'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: slim
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 4.0.1
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - "~>"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 4.0.1
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: adsf
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 1.4.2
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 1.4.2
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: adsf-live
|
181
|
+
requirement: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - "~>"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 1.4.2
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - "~>"
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 1.4.2
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: rouge
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 3.8.0
|
200
|
+
type: :development
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - "~>"
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 3.8.0
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: htmlbeautifier
|
209
|
+
requirement: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - "~>"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: 1.3.1
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - "~>"
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: 1.3.1
|
221
|
+
- !ruby/object:Gem::Dependency
|
222
|
+
name: sassc
|
223
|
+
requirement: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - "~>"
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: 2.1.0
|
228
|
+
type: :development
|
229
|
+
prerelease: false
|
230
|
+
version_requirements: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - "~>"
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: 2.1.0
|
137
235
|
description: A Rails form builder that generates form inputs adhering to the GOV.UK
|
138
236
|
Design System
|
139
237
|
email:
|
@@ -143,7 +241,6 @@ extensions: []
|
|
143
241
|
extra_rdoc_files: []
|
144
242
|
files:
|
145
243
|
- README.md
|
146
|
-
- Rakefile
|
147
244
|
- lib/govuk_design_system_formbuilder.rb
|
148
245
|
- lib/govuk_design_system_formbuilder/base.rb
|
149
246
|
- lib/govuk_design_system_formbuilder/builder.rb
|
@@ -154,6 +251,7 @@ files:
|
|
154
251
|
- lib/govuk_design_system_formbuilder/containers/form_group.rb
|
155
252
|
- lib/govuk_design_system_formbuilder/containers/radio_buttons_fieldset.rb
|
156
253
|
- lib/govuk_design_system_formbuilder/containers/radios.rb
|
254
|
+
- lib/govuk_design_system_formbuilder/containers/supplemental.rb
|
157
255
|
- lib/govuk_design_system_formbuilder/elements/check_boxes/collection.rb
|
158
256
|
- lib/govuk_design_system_formbuilder/elements/check_boxes/collection_check_box.rb
|
159
257
|
- lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb
|
@@ -173,7 +271,7 @@ files:
|
|
173
271
|
- lib/govuk_design_system_formbuilder/elements/submit.rb
|
174
272
|
- lib/govuk_design_system_formbuilder/elements/text_area.rb
|
175
273
|
- lib/govuk_design_system_formbuilder/version.rb
|
176
|
-
homepage: https://
|
274
|
+
homepage: https://govuk-form-builder.netlify.com
|
177
275
|
licenses:
|
178
276
|
- MIT
|
179
277
|
metadata: {}
|
data/Rakefile
DELETED
File without changes
|