govuk_design_system_formbuilder 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/govuk_design_system_formbuilder/builder.rb +179 -20
- data/lib/govuk_design_system_formbuilder/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dccd0fa57d48d4d0198307c0c4e11ac03dba8ffacd9bcf7850ba509477e4a82
|
4
|
+
data.tar.gz: f3f197d18cc7fb186cf319da8b90f16d9bef48bc0e3c6493857633105872b599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd17c106ef4052149c832e5e8428b7beeddb56cdef0ec4861036242069021d4a5122da8c817e19902c757513a9bc23bf47b4809c63fbc2f20ca19eb983921ee5
|
7
|
+
data.tar.gz: c3ee032aa1925b929abcf0a9d400f1a1404bb5a56b8290ae1f66d475018841a88bb4c504fddfa41ae4baf8d1a7094eb645b67d6b2ffbf935d726a023c42bd2a0
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## What's included
|
4
4
|
|
5
|
-
* 100% compatibility with the GOV.UK Design System
|
5
|
+
* 100% compatibility with the [GOV.UK Design System](https://design-system.service.gov.uk/)
|
6
6
|
* Full control of labels, hints, fieldsets and legends
|
7
7
|
* No overwriting of Rails' default form helpers
|
8
8
|
* Automatic ARIA associations between hints, errors and inputs
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Builder
|
3
|
-
|
4
|
-
# Generates a input of type `text`
|
3
|
+
# Generates a input of type +text+
|
5
4
|
#
|
6
5
|
# @param attribute_name [Symbol] The name of the attribute
|
7
6
|
# @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
|
@@ -11,9 +10,10 @@ module GOVUKDesignSystemFormBuilder
|
|
11
10
|
# @option label weight [String] the weight of the label font, can be +bold+ or +regular+
|
12
11
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
13
12
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
13
|
+
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
14
14
|
#
|
15
15
|
# @example A required full name field with a placeholder
|
16
|
-
# = govuk_text_field :name,
|
16
|
+
# = f.govuk_text_field :name,
|
17
17
|
# label: { text: 'Full name' },
|
18
18
|
# hint_text: 'It says it on your birth certificate',
|
19
19
|
# required: true,
|
@@ -22,7 +22,7 @@ module GOVUKDesignSystemFormBuilder
|
|
22
22
|
Elements::Input.new(self, object_name, attribute_name, attribute_type: :text, hint_text: hint_text, label: label, **args).html
|
23
23
|
end
|
24
24
|
|
25
|
-
# Generates a input of type
|
25
|
+
# Generates a input of type +tel+
|
26
26
|
#
|
27
27
|
# @param attribute_name [Symbol] The name of the attribute
|
28
28
|
# @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
|
@@ -32,9 +32,11 @@ module GOVUKDesignSystemFormBuilder
|
|
32
32
|
# @option label weight [String] the weight of the label font, can be +bold+ or +regular+
|
33
33
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
34
34
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
35
|
+
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
36
|
+
# @see https://design-system.service.gov.uk/patterns/telephone-numbers/ GOV.UK Telephone number patterns
|
35
37
|
#
|
36
38
|
# @example A required phone number field with a placeholder
|
37
|
-
# = govuk_phone_field :phone_number,
|
39
|
+
# = f.govuk_phone_field :phone_number,
|
38
40
|
# label: { text: 'UK telephone number' },
|
39
41
|
# hint_text: 'Include the dialling code',
|
40
42
|
# required: true,
|
@@ -43,7 +45,7 @@ module GOVUKDesignSystemFormBuilder
|
|
43
45
|
Elements::Input.new(self, object_name, attribute_name, attribute_type: :phone, hint_text: hint_text, label: label, **args).html
|
44
46
|
end
|
45
47
|
|
46
|
-
# Generates a input of type
|
48
|
+
# Generates a input of type +email+
|
47
49
|
#
|
48
50
|
# @param attribute_name [Symbol] The name of the attribute
|
49
51
|
# @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
|
@@ -53,16 +55,18 @@ module GOVUKDesignSystemFormBuilder
|
|
53
55
|
# @option label weight [String] the weight of the label font, can be +bold+ or +regular+
|
54
56
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
55
57
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
58
|
+
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
59
|
+
# @see https://design-system.service.gov.uk/patterns/email-addresses/ GOV.UK Email address patterns
|
56
60
|
#
|
57
61
|
# @example An email address field with a placeholder
|
58
|
-
# = govuk_email_field :email_address,
|
62
|
+
# = f.govuk_email_field :email_address,
|
59
63
|
# label: { text: 'Enter your email address' },
|
60
64
|
# placeholder: 'ralph.wiggum@springfield.edu'
|
61
65
|
def govuk_email_field(attribute_name, hint_text: nil, label: {}, **args)
|
62
66
|
Elements::Input.new(self, object_name, attribute_name, attribute_type: :email, hint_text: hint_text, label: label, **args).html
|
63
67
|
end
|
64
68
|
|
65
|
-
# Generates a input of type
|
69
|
+
# Generates a input of type +url+
|
66
70
|
#
|
67
71
|
# @param attribute_name [Symbol] The name of the attribute
|
68
72
|
# @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
|
@@ -72,9 +76,10 @@ module GOVUKDesignSystemFormBuilder
|
|
72
76
|
# @option label weight [String] the weight of the label font, can be +bold+ or +regular+
|
73
77
|
# @option args [Hash] args additional arguments are applied as attributes to +input+ element
|
74
78
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
79
|
+
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
75
80
|
#
|
76
81
|
# @example A url field with autocomplete
|
77
|
-
# = govuk_url_field :favourite_website,
|
82
|
+
# = f.govuk_url_field :favourite_website,
|
78
83
|
# label: { text: 'Enter your favourite website' },
|
79
84
|
# placeholder: 'https://www.gov.uk',
|
80
85
|
# autocomplete: 'url'
|
@@ -82,7 +87,7 @@ module GOVUKDesignSystemFormBuilder
|
|
82
87
|
Elements::Input.new(self, object_name, attribute_name, attribute_type: :url, hint_text: hint_text, label: label, **args).html
|
83
88
|
end
|
84
89
|
|
85
|
-
# Generates a input of type
|
90
|
+
# Generates a input of type +number+
|
86
91
|
#
|
87
92
|
# @param attribute_name [Symbol] The name of the attribute
|
88
93
|
# @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
|
@@ -92,9 +97,10 @@ module GOVUKDesignSystemFormBuilder
|
|
92
97
|
# @option label weight [String] the weight of the label font, can be +bold+ or +regular+
|
93
98
|
# @option args [Hash] args additional arguments are applied as attributes to the +input+ element
|
94
99
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
100
|
+
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
95
101
|
#
|
96
102
|
# @example A number field with placeholder, min, max and step
|
97
|
-
# = govuk_number_field :iq,
|
103
|
+
# = f.govuk_number_field :iq,
|
98
104
|
# label: { text: 'What is your IQ?' },
|
99
105
|
# placeholder: 100,
|
100
106
|
# min: 80,
|
@@ -124,7 +130,7 @@ module GOVUKDesignSystemFormBuilder
|
|
124
130
|
# or characters
|
125
131
|
#
|
126
132
|
# @example A number field with placeholder, min, max and step
|
127
|
-
# = govuk_number_field :cv,
|
133
|
+
# = f.govuk_number_field :cv,
|
128
134
|
# label: { text: 'Tell us about your work history' },
|
129
135
|
# rows: 8,
|
130
136
|
# max_words: 300
|
@@ -142,7 +148,8 @@ module GOVUKDesignSystemFormBuilder
|
|
142
148
|
# @option label text [String] the label text
|
143
149
|
# @option label size [String] the size of the label font, can be +large+, +medium+, +regular+ or +small+
|
144
150
|
# @option label weight [String] the weight of the label font, can be +bold+ or +regular+
|
145
|
-
|
151
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
152
|
+
def govuk_collection_select(attribute_name, collection, value_method, text_method, options: {}, html_options: {}, hint_text: nil, label: {}, &block)
|
146
153
|
label_element = Elements::Label.new(self, object_name, attribute_name, label)
|
147
154
|
hint_element = Elements::Hint.new(self, object_name, attribute_name, hint_text)
|
148
155
|
error_element = Elements::ErrorMessage.new(self, object_name, attribute_name)
|
@@ -174,7 +181,41 @@ module GOVUKDesignSystemFormBuilder
|
|
174
181
|
end
|
175
182
|
end
|
176
183
|
|
177
|
-
|
184
|
+
# Generates a radio button for each item in the supplied collection
|
185
|
+
#
|
186
|
+
# @note Unlike the Rails +collection_radio_buttons+ helper, this version can also insert
|
187
|
+
# hints per item in the collection by supplying a +:hint_method+
|
188
|
+
#
|
189
|
+
# @param attribute_name [Symbol] The name of the attribute
|
190
|
+
# @param collection [Enumerable<Object>] Options to be added to the +select+ element
|
191
|
+
# @param value_method [Symbol] The method called against each member of the collection to provide the value
|
192
|
+
# @param text_method [Symbol] The method called against each member of the collection to provide the text
|
193
|
+
# @param hint_method [Symbol] The method called against each member of the collection to provide the hint text
|
194
|
+
# @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
|
195
|
+
# @param legend [Hash] options for configuring the hash
|
196
|
+
# @param inline [Boolean] controls whether the radio buttons are displayed inline or not
|
197
|
+
# @option legend text [String] the fieldset legend's text content
|
198
|
+
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
199
|
+
# @param block [Block] any HTML passed in is inserted inside the fieldset container,
|
200
|
+
# between the error and the radios container element
|
201
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
202
|
+
#
|
203
|
+
# @example A collection of radio buttons for favourite colours
|
204
|
+
#
|
205
|
+
# @colours = [
|
206
|
+
# OpenStruct.new(id: 'red', name: 'Red', description: 'Roses are red'),
|
207
|
+
# OpenStruct.new(id: 'blue', name: 'Blue', description: 'Violets are... purple?')
|
208
|
+
# ]
|
209
|
+
#
|
210
|
+
# = f.govuk_collection_radio_buttons :favourite_colour,
|
211
|
+
# @colours,
|
212
|
+
# :id,
|
213
|
+
# :name,
|
214
|
+
# :description,
|
215
|
+
# legend: { text: 'Pick your favourite colour', size: 'm' },
|
216
|
+
# hint_text: 'If you cannot find the exact match choose something close',
|
217
|
+
# inline: false
|
218
|
+
def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: { text: nil, size: 'm' }, inline: false, &block)
|
178
219
|
hint_element = Elements::Hint.new(self, object_name, attribute_name, hint_text)
|
179
220
|
error_element = Elements::ErrorMessage.new(self, object_name, attribute_name)
|
180
221
|
|
@@ -186,7 +227,7 @@ module GOVUKDesignSystemFormBuilder
|
|
186
227
|
error_element.html,
|
187
228
|
|
188
229
|
(yield if block_given?),
|
189
|
-
Containers::Radios.new(self, inline:
|
230
|
+
Containers::Radios.new(self, inline: inline).html do
|
190
231
|
safe_join(
|
191
232
|
collection.map do |item|
|
192
233
|
Elements::Radios::CollectionRadio.new(self, object_name, attribute_name, item, value_method, text_method, hint_method).html
|
@@ -199,7 +240,30 @@ module GOVUKDesignSystemFormBuilder
|
|
199
240
|
end
|
200
241
|
end
|
201
242
|
|
202
|
-
|
243
|
+
# Generates a radio button fieldset container and injects the supplied block contents
|
244
|
+
#
|
245
|
+
# @note The intention is to use {#govuk_radio_button} and {#govuk_radio_divider} within the passed-in block
|
246
|
+
#
|
247
|
+
# @param attribute_name [Symbol] The name of the attribute
|
248
|
+
# @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
|
249
|
+
# @param legend [Hash] options for configuring the hash
|
250
|
+
# @param inline [Boolean] controls whether the radio buttons are displayed inline or not
|
251
|
+
# @option legend text [String] the fieldset legend's text content
|
252
|
+
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
253
|
+
# @param block [Block] any HTML passed in will be injected into the fieldset
|
254
|
+
# element and should contain radio buttons and optionally a divider
|
255
|
+
# @see https://design-system.service.gov.uk/components/radios/ GOV.UK Radios
|
256
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
257
|
+
#
|
258
|
+
# @example A collection of radio buttons for favourite colours with a divider
|
259
|
+
#
|
260
|
+
# = f.govuk_collection_radio_buttons :favourite_colour, inline: false do
|
261
|
+
# = f.govuk_radio_button :favourite_colour, :red, label: { text: 'Red' }
|
262
|
+
# = f.govuk_radio_button :favourite_colour, :green, label: { text: 'Green' }
|
263
|
+
# = f.govuk_radio_divider
|
264
|
+
# = f.govuk_radio_button :favourite_colour, :yellow, label: { text: 'Yellow' }
|
265
|
+
#
|
266
|
+
def govuk_radio_buttons_fieldset(attribute_name, inline: false, hint_text: nil, legend: {}, &block)
|
203
267
|
hint_element = Elements::Hint.new(self, object_name, attribute_name, hint_text)
|
204
268
|
error_element = Elements::ErrorMessage.new(self, object_name, attribute_name)
|
205
269
|
|
@@ -208,7 +272,7 @@ module GOVUKDesignSystemFormBuilder
|
|
208
272
|
safe_join([
|
209
273
|
hint_element.html,
|
210
274
|
error_element.html,
|
211
|
-
Containers::Radios.new(self, inline:
|
275
|
+
Containers::Radios.new(self, inline: inline).html do
|
212
276
|
yield
|
213
277
|
end
|
214
278
|
])
|
@@ -216,16 +280,69 @@ module GOVUKDesignSystemFormBuilder
|
|
216
280
|
end
|
217
281
|
end
|
218
282
|
|
219
|
-
|
283
|
+
|
284
|
+
# Generates a radio button
|
285
|
+
#
|
286
|
+
# @note This should only be used from within a {#govuk_radio_buttons_fieldset}
|
287
|
+
# @param attribute_name [Symbol] The name of the attribute
|
288
|
+
# @param hint_text [String] the contents of the hint
|
289
|
+
# @option legend text [String] the fieldset legend's text content
|
290
|
+
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
291
|
+
# @see https://design-system.service.gov.uk/components/radios/ GOV.UK Radios
|
292
|
+
# @param block [Block] Any supplied HTML will be wrapped in a conditional
|
293
|
+
# container and only revealed when the radio button is picked
|
294
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
295
|
+
#
|
296
|
+
# @example A collection of radio buttons for favourite colours with a divider
|
297
|
+
#
|
298
|
+
# = f.govuk_collection_radio_buttons :favourite_colour, inline: false do
|
299
|
+
# = f.govuk_radio_button :favourite_colour, :red, label: { text: 'Red' } do
|
300
|
+
#
|
220
301
|
def govuk_radio_button(attribute_name, value, hint_text: nil, label: {}, &block)
|
221
302
|
Elements::Radios::FieldsetRadio.new(self, object_name, attribute_name, value, hint_text: hint_text, label: label, &block).html
|
222
303
|
end
|
223
304
|
|
305
|
+
# Inserts a text divider into a list of radio buttons
|
306
|
+
#
|
307
|
+
# @param text [String] The divider text
|
308
|
+
# @note This should only be used from within a {#govuk_radio_buttons_fieldset}
|
309
|
+
# @see https://design-system.service.gov.uk/components/radios/#radio-items-with-a-text-divider GOV.UK Radios with a text divider
|
310
|
+
# @example A custom divider
|
311
|
+
# = govuk_radio_divider 'Alternatively'
|
224
312
|
def govuk_radio_divider(text = 'or')
|
225
313
|
tag.div(text, class: %w(govuk-radios__divider))
|
226
314
|
end
|
227
315
|
|
228
|
-
|
316
|
+
# Generate a list of check boxes from a collection
|
317
|
+
#
|
318
|
+
# @param attribute_name [Symbol] The name of the attribute
|
319
|
+
# @param collection [Enumerable<Object>] Options to be added to the +select+ element
|
320
|
+
# @param value_method [Symbol] The method called against each member of the collection to provide the value
|
321
|
+
# @param text_method [Symbol] The method called against each member of the collection to provide the text
|
322
|
+
# @param hint_method [Symbol] The method called against each member of the collection to provide the hint text
|
323
|
+
# @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
|
324
|
+
# @param legend [Hash] options for configuring the hash
|
325
|
+
# @option legend text [String] the fieldset legend's text content
|
326
|
+
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
327
|
+
# @param block [Block] any HTML passed in will be injected into the fieldset, after the hint and before the checkboxes
|
328
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
329
|
+
#
|
330
|
+
# @example A collection of check boxes for sandwich fillings
|
331
|
+
#
|
332
|
+
# @fillings = [
|
333
|
+
# OpenStruct.new(id: 'pastrami', name: 'Pastrami', description: 'Brined, smoked, steamed and seasoned'),
|
334
|
+
# OpenStruct.new(id: 'cheddar', name: 'Cheddar', description: 'A sharp, off-white natural cheese')
|
335
|
+
# ]
|
336
|
+
#
|
337
|
+
# = f.govuk_collection_check_boxes :desired_filling,
|
338
|
+
# @fillings,
|
339
|
+
# :id,
|
340
|
+
# :name,
|
341
|
+
# :description,
|
342
|
+
# legend: { text: 'What do you want in your sandwich?', size: 'm' },
|
343
|
+
# hint_text: "If it isn't listed here, tough luck",
|
344
|
+
# inline: false
|
345
|
+
def govuk_collection_check_boxes(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {}, &block)
|
229
346
|
hint_element = Elements::Hint.new(self, object_name, attribute_name, hint_text)
|
230
347
|
error_element = Elements::ErrorMessage.new(self, object_name, attribute_name)
|
231
348
|
|
@@ -235,7 +352,7 @@ module GOVUKDesignSystemFormBuilder
|
|
235
352
|
[
|
236
353
|
hint_element.html,
|
237
354
|
error_element.html,
|
238
|
-
(
|
355
|
+
(block.call if block_given?),
|
239
356
|
collection_check_boxes(attribute_name, collection, value_method, text_method) do |check_box|
|
240
357
|
Elements::CheckBoxes::CollectionCheckBox.new(self, attribute_name, check_box, hint_method).html
|
241
358
|
end
|
@@ -245,10 +362,52 @@ module GOVUKDesignSystemFormBuilder
|
|
245
362
|
end
|
246
363
|
end
|
247
364
|
|
365
|
+
# Generates a submit button, green by default
|
366
|
+
#
|
367
|
+
# @param text [String] the button text
|
368
|
+
# @param warning [Boolean] makes the button red ({https://design-system.service.gov.uk/components/button/#warning-buttons warning}) when true
|
369
|
+
# @param secondary [Boolean] makes the button grey ({https://design-system.service.gov.uk/components/button/#secondary-buttons secondary}) when true
|
370
|
+
# @todo The GOV.UK design system also supports {https://design-system.service.gov.uk/components/button/#disabled-buttons disabled buttons}, they
|
371
|
+
# should probably be supported too
|
372
|
+
# @param prevent_double_click [Boolean] adds JavaScript to safeguard the
|
373
|
+
# form from being submitted more than once
|
374
|
+
# @param block [Block] Any supplied HTML will be inserted immediately after
|
375
|
+
# the submit button. It is intended for other buttons directly related to
|
376
|
+
# the form's operation, such as 'Cancel' or 'Safe draft'
|
377
|
+
# @raise [ArgumentError] raised if both +warning+ and +secondary+ are true
|
378
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
379
|
+
# @note Only the first additional button or link (passed in via a block) will be given the
|
380
|
+
# correct left margin, subsequent buttons will need to be manually accounted for
|
381
|
+
# @see https://design-system.service.gov.uk/components/button/#stop-users-from-accidentally-sending-information-more-than-once
|
382
|
+
# GOV.UK double click prevention
|
383
|
+
#
|
384
|
+
# @example A submit button with custom text, double click protection and an inline cancel link
|
385
|
+
# = f.govuk_submit "Proceed", prevent_double_click: true do
|
386
|
+
# = link_to 'Cancel', some_other_path, class: 'govuk-button__secondary'
|
387
|
+
#
|
248
388
|
def govuk_submit(text = 'Continue', warning: false, secondary: false, prevent_double_click: true, &block)
|
249
389
|
Elements::Submit.new(self, text, warning: warning, secondary: secondary, prevent_double_click: prevent_double_click, &block).html
|
250
390
|
end
|
251
391
|
|
392
|
+
# Generates three number inputs for the +day+, +month+ and +year+ components of a date
|
393
|
+
#
|
394
|
+
# @note When using this input be aware that Rails's multiparam time and date handling falls foul
|
395
|
+
# of {https://bugs.ruby-lang.org/issues/5988 this} bug, so incorrect dates like +2019-09-31+ will
|
396
|
+
# be 'rounded' up to +2019-10-01+.
|
397
|
+
# @param attribute_name [Symbol] The name of the attribute
|
398
|
+
# @param hint_text [String] the contents of the hint
|
399
|
+
# @param legend [Hash] options for configuring the hash
|
400
|
+
# @option legend text [String] the fieldset legend's text content
|
401
|
+
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
402
|
+
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input group
|
403
|
+
# @param date_of_birth [Boolean] if +true+ {https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#Values birth date auto completion attributes}
|
404
|
+
# will be added to the inputs
|
405
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
406
|
+
#
|
407
|
+
# @example A regular date input with a legend and hint
|
408
|
+
# = f.govuk_date_field :starts_on,
|
409
|
+
# legend: { 'When does your event start?' },
|
410
|
+
# hint_text: 'Leave this field blank if you don't know exactly' }
|
252
411
|
def govuk_date_field(attribute_name, hint_text: nil, legend: {}, date_of_birth: false, &block)
|
253
412
|
Elements::Date.new(self, object_name, attribute_name, hint_text: hint_text, legend: legend, date_of_birth: date_of_birth, &block).html
|
254
413
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_design_system_formbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
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-06-
|
11
|
+
date: 2019-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -105,6 +105,9 @@ dependencies:
|
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.7'
|
110
|
+
- - ">="
|
108
111
|
- !ruby/object:Gem::Version
|
109
112
|
version: 3.7.0
|
110
113
|
type: :development
|
@@ -112,6 +115,9 @@ dependencies:
|
|
112
115
|
version_requirements: !ruby/object:Gem::Requirement
|
113
116
|
requirements:
|
114
117
|
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.7'
|
120
|
+
- - ">="
|
115
121
|
- !ruby/object:Gem::Version
|
116
122
|
version: 3.7.0
|
117
123
|
description: A Rails form builder that generates form inputs adhering to the GOV.UK
|