govuk_design_system_formbuilder 1.2.0b2 → 1.2.0b4

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: 37c93687dcdba2d6aa866d4fe1e9ef930647145f82d05f6d6285302b7b8af64a
4
- data.tar.gz: 2f2fa7661eea4bd940c02da45dae2061065705e8012962fa663ed71c0e33a7a3
3
+ metadata.gz: 33e103d8be5763415d474e06b5ec369e41faa78736769dfdc361da38cfdc0b35
4
+ data.tar.gz: 46bb0c7084d3bc259715dc7e3ea94ffc53f3cc2347ad922657ee6f5182f404b5
5
5
  SHA512:
6
- metadata.gz: 9696c0832e0b2582577c95ad23a62968bd4470237b8993e866a2c443e611f07d1733d5db77de173e19769fae1fd0fa90da84cc15167bb06887801c5dc6399bff
7
- data.tar.gz: 56561bda3f5b4b369c65a78e6175a708d62feb5f60f774c485a97c7dfc9e0a2b8e09f5030e2ab93d927295680628384bafc94ccbe17fd91188803bec408da1f2
6
+ metadata.gz: e6ad6b1bc1d47c5c5510e112a480fff9680d1dc8e64605524a2e63b67a72d1881227614970e61653d37782bff41f7ae1ca052ef67fbb3653ace5e24550e1afdd
7
+ data.tar.gz: 92f7169ebf567010c3114946b50677869ef5616e8f96c3542ea11739ea63e3516a1dba70d6fb8b2bfcffeaa2c86a8e5f039f51a0db2e8ac312e2d1185f215d82
data/README.md CHANGED
@@ -7,10 +7,10 @@
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.6.0-brightgreen)](https://design-system.service.gov.uk)
10
+ [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.7.0-brightgreen)](https://design-system.service.gov.uk)
11
11
 
12
12
  This gem provides a easy-to-use form builder that generates forms that are
13
- fully-compliant with version 3.6.0 of the [GOV.UK Design System](https://design-system.service.gov.uk/),
13
+ fully-compliant with version 3.7.0 of the [GOV.UK Design System](https://design-system.service.gov.uk/),
14
14
  minimising the amount of markup you need to write.
15
15
 
16
16
  In addition to the basic markup, the more-advanced functionality of the Design
@@ -52,7 +52,8 @@ module GOVUKDesignSystemFormBuilder
52
52
  localisation_schema_fallback: %i(helpers __context__),
53
53
  localisation_schema_label: nil,
54
54
  localisation_schema_hint: nil,
55
- localisation_schema_legend: nil
55
+ localisation_schema_legend: nil,
56
+ localisation_schema_caption: nil
56
57
  }.freeze
57
58
 
58
59
  DEFAULTS.each_key { |k| config_accessor(k) { DEFAULTS[k] } }
@@ -8,15 +8,19 @@ module GOVUKDesignSystemFormBuilder
8
8
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
9
9
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
10
10
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
11
- # @param [Hash] label configures the associated label
11
+ # @param label [Hash,Proc] configures or sets the associated label content
12
12
  # @option label text [String] the label text
13
13
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
14
14
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
15
15
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
16
- # @option args [Hash] args additional arguments are applied as attributes to +input+ element
16
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
17
+ # @option caption text [String] the caption text
18
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
19
+ # @option args [Hash] args additional arguments are applied as attributes to the +input+ element
17
20
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
18
21
  # @return [ActiveSupport::SafeBuffer] HTML output
19
22
  # @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
23
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
20
24
  #
21
25
  # @example A required full name field with a placeholder
22
26
  # = f.govuk_text_field :name,
@@ -32,8 +36,12 @@ module GOVUKDesignSystemFormBuilder
32
36
  # p.govuk-inset-text
33
37
  # | Ensure your stage name is unique
34
38
  #
35
- def govuk_text_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
36
- Elements::Inputs::Text.new(self, object_name, attribute_name, hint_text: hint_text, label: label, width: width, **args, &block).html
39
+ # @example A text field with the label supplied as a proc
40
+ # = f.govuk_text_field :callsign,
41
+ # label: -> { tag.h3('Call-sign') }
42
+ #
43
+ def govuk_text_field(attribute_name, hint_text: nil, label: {}, caption: {}, width: nil, **args, &block)
44
+ Elements::Inputs::Text.new(self, object_name, attribute_name, hint_text: hint_text, label: label, caption: caption, width: width, **args, &block).html
37
45
  end
38
46
 
39
47
  # Generates a input of type +tel+
@@ -42,16 +50,20 @@ module GOVUKDesignSystemFormBuilder
42
50
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
43
51
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
44
52
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
45
- # @param [Hash] label configures the associated label
53
+ # @param label [Hash,Proc] configures or sets the associated label content
46
54
  # @option label text [String] the label text
47
55
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
48
56
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
49
57
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
50
- # @option args [Hash] args additional arguments are applied as attributes to +input+ element
58
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
59
+ # @option caption text [String] the caption text
60
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
61
+ # @option args [Hash] args additional arguments are applied as attributes to the +input+ element
51
62
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
52
63
  # @return [ActiveSupport::SafeBuffer] HTML output
53
64
  # @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
54
65
  # @see https://design-system.service.gov.uk/patterns/telephone-numbers/ GOV.UK Telephone number patterns
66
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
55
67
  #
56
68
  # @example A required phone number field with a placeholder
57
69
  # = f.govuk_phone_field :phone_number,
@@ -67,8 +79,12 @@ module GOVUKDesignSystemFormBuilder
67
79
  # p.govuk-inset-text
68
80
  # | Yes, fax machines are still a thing
69
81
  #
70
- def govuk_phone_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
71
- Elements::Inputs::Phone.new(self, object_name, attribute_name, hint_text: hint_text, label: label, width: width, **args, &block).html
82
+ # @example A phone field with the label supplied as a proc
83
+ # = f.govuk_phone_field :work_number,
84
+ # label: -> { tag.h3('Work number') }
85
+ #
86
+ def govuk_phone_field(attribute_name, hint_text: nil, label: {}, caption: {}, width: nil, **args, &block)
87
+ Elements::Inputs::Phone.new(self, object_name, attribute_name, hint_text: hint_text, label: label, caption: caption, width: width, **args, &block).html
72
88
  end
73
89
 
74
90
  # Generates a input of type +email+
@@ -77,31 +93,39 @@ module GOVUKDesignSystemFormBuilder
77
93
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
78
94
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
79
95
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
80
- # @param [Hash] label configures the associated label
96
+ # @param label [Hash,Proc] configures or sets the associated label content
81
97
  # @option label text [String] the label text
82
98
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
83
99
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
84
100
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
85
- # @option args [Hash] args additional arguments are applied as attributes to +input+ element
101
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
102
+ # @option caption text [String] the caption text
103
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
104
+ # @option args [Hash] args additional arguments are applied as attributes to the +input+ element
86
105
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
87
106
  # @return [ActiveSupport::SafeBuffer] HTML output
88
107
  # @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
89
108
  # @see https://design-system.service.gov.uk/patterns/email-addresses/ GOV.UK Email address patterns
109
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
90
110
  #
91
111
  # @example An email address field with a placeholder
92
112
  # = f.govuk_email_field :email_address,
93
113
  # label: { text: 'Enter your email address' },
94
114
  # placeholder: 'ralph.wiggum@springfield.edu'
95
115
  #
96
- # @example A email field with injected content
97
- # = f.govuk_phone_field :email_address,
98
- # label: { text: 'Email address' } do
116
+ # @example An email field with injected content
117
+ # = f.govuk_phone_field :work_email,
118
+ # label: { text: 'Work email address' } do
99
119
  #
100
120
  # p.govuk-inset-text
101
121
  # | Use your work address
102
122
  #
103
- def govuk_email_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
104
- Elements::Inputs::Email.new(self, object_name, attribute_name, hint_text: hint_text, label: label, width: width, **args, &block).html
123
+ # @example A email field with the label supplied as a proc
124
+ # = f.govuk_email_field :personal_email,
125
+ # label: -> { tag.h3('Personal email address') }
126
+ #
127
+ def govuk_email_field(attribute_name, hint_text: nil, label: {}, caption: {}, width: nil, **args, &block)
128
+ Elements::Inputs::Email.new(self, object_name, attribute_name, hint_text: hint_text, label: label, caption: caption, width: width, **args, &block).html
105
129
  end
106
130
 
107
131
  # Generates a input of type +password+
@@ -110,16 +134,20 @@ module GOVUKDesignSystemFormBuilder
110
134
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
111
135
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
112
136
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
113
- # @param [Hash] label configures the associated label
137
+ # @param label [Hash,Proc] configures or sets the associated label content
114
138
  # @option label text [String] the label text
115
139
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
116
140
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
117
141
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
118
- # @option args [Hash] args additional arguments are applied as attributes to +input+ element
142
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
143
+ # @option caption text [String] the caption text
144
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
145
+ # @option args [Hash] args additional arguments are applied as attributes to the +input+ element
119
146
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
120
147
  # @return [ActiveSupport::SafeBuffer] HTML output
121
148
  # @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
122
149
  # @see https://design-system.service.gov.uk/patterns/passwords/ GOV.UK Password patterns
150
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
123
151
  #
124
152
  # @example A password field
125
153
  # = f.govuk_password_field :password,
@@ -132,8 +160,12 @@ module GOVUKDesignSystemFormBuilder
132
160
  # p.govuk-inset-text
133
161
  # | Ensure your password is at least 16 characters long
134
162
  #
135
- def govuk_password_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
136
- Elements::Inputs::Password.new(self, object_name, attribute_name, hint_text: hint_text, label: label, width: width, **args, &block).html
163
+ # @example A password field with the label supplied as a proc
164
+ # = f.govuk_password_field :passcode,
165
+ # label: -> { tag.h3('What is your secret pass code?') }
166
+ #
167
+ def govuk_password_field(attribute_name, hint_text: nil, label: {}, width: nil, caption: {}, **args, &block)
168
+ Elements::Inputs::Password.new(self, object_name, attribute_name, hint_text: hint_text, label: label, caption: caption, width: width, **args, &block).html
137
169
  end
138
170
 
139
171
  # Generates a input of type +url+
@@ -142,15 +174,19 @@ module GOVUKDesignSystemFormBuilder
142
174
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
143
175
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
144
176
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
145
- # @param [Hash] label configures the associated label
177
+ # @param label [Hash,Proc] configures or sets the associated label content
146
178
  # @option label text [String] the label text
147
179
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
148
180
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
149
181
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
150
- # @option args [Hash] args additional arguments are applied as attributes to +input+ element
182
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
183
+ # @option caption text [String] the caption text
184
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
185
+ # @option args [Hash] args additional arguments are applied as attributes to the +input+ element
151
186
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
152
187
  # @return [ActiveSupport::SafeBuffer] HTML output
153
188
  # @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
189
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
154
190
  #
155
191
  # @example A url field with autocomplete
156
192
  # = f.govuk_url_field :favourite_website,
@@ -165,8 +201,12 @@ module GOVUKDesignSystemFormBuilder
165
201
  # p.govuk-inset-text
166
202
  # | This will be visible on your profile
167
203
  #
168
- def govuk_url_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
169
- Elements::Inputs::URL.new(self, object_name, attribute_name, hint_text: hint_text, label: label, width: width, **args, &block).html
204
+ # @example A url field with the label supplied as a proc
205
+ # = f.govuk_url_field :work_website,
206
+ # label: -> { tag.h3("Enter your company's website") }
207
+ #
208
+ def govuk_url_field(attribute_name, hint_text: nil, label: {}, caption: {}, width: nil, **args, &block)
209
+ Elements::Inputs::URL.new(self, object_name, attribute_name, hint_text: hint_text, label: label, caption: caption, width: width, **args, &block).html
170
210
  end
171
211
 
172
212
  # Generates a input of type +number+
@@ -175,15 +215,19 @@ module GOVUKDesignSystemFormBuilder
175
215
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
176
216
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
177
217
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
178
- # @param [Hash] label configures the associated label
218
+ # @param label [Hash,Proc] configures or sets the associated label content
179
219
  # @option label text [String] the label text
180
220
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
181
221
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
182
222
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
223
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
224
+ # @option caption text [String] the caption text
225
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
183
226
  # @option args [Hash] args additional arguments are applied as attributes to the +input+ element
184
227
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
185
228
  # @return [ActiveSupport::SafeBuffer] HTML output
186
229
  # @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
230
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
187
231
  #
188
232
  # @example A number field with placeholder, min, max and step
189
233
  # = f.govuk_number_field :iq,
@@ -201,8 +245,12 @@ module GOVUKDesignSystemFormBuilder
201
245
  # | If you haven't measured your height in the last 6 months
202
246
  # do it now
203
247
  #
204
- def govuk_number_field(attribute_name, hint_text: nil, label: {}, width: nil, **args, &block)
205
- Elements::Inputs::Number.new(self, object_name, attribute_name, hint_text: hint_text, label: label, width: width, **args, &block).html
248
+ # @example A number field with the label supplied as a proc
249
+ # = f.govuk_url_field :personal_best_over_100m,
250
+ # label: -> { tag.h3("How many seconds does it take you to run 100m?") }
251
+ #
252
+ def govuk_number_field(attribute_name, hint_text: nil, label: {}, caption: {}, width: nil, **args, &block)
253
+ Elements::Inputs::Number.new(self, object_name, attribute_name, hint_text: hint_text, label: label, caption: caption, width: width, **args, &block).html
206
254
  end
207
255
 
208
256
  # Generates a +textarea+ element with a label, optional hint. Also offers
@@ -211,11 +259,14 @@ module GOVUKDesignSystemFormBuilder
211
259
  #
212
260
  # @param attribute_name [Symbol] The name of the attribute
213
261
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
214
- # @param [Hash] label configures the associated label
262
+ # @param label [Hash,Proc] configures or sets the associated label content
215
263
  # @option label text [String] the label text
216
264
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
217
265
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
218
266
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
267
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
268
+ # @option caption text [String] the caption text
269
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
219
270
  # @param max_words [Integer] adds the GOV.UK max word count
220
271
  # @param max_chars [Integer] adds the GOV.UK max characters count
221
272
  # @param threshold [Integer] only show the +max_words+ and +max_chars+ warnings once a threshold (percentage) is reached
@@ -223,25 +274,31 @@ module GOVUKDesignSystemFormBuilder
223
274
  # @option args [Hash] args additional arguments are applied as attributes to the +textarea+ element
224
275
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
225
276
  # @return [ActiveSupport::SafeBuffer] HTML output
277
+ # @see https://design-system.service.gov.uk/components/textarea/ GOV.UK text area component
226
278
  # @see https://design-system.service.gov.uk/components/character-count GOV.UK character count component
279
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
227
280
  # @note Setting +max_chars+ or +max_words+ will add a caption beneath the +textarea+ with a live count of words
228
281
  # or characters
229
282
  #
230
283
  # @example A text area with a custom number of rows and a word limit
231
- # = f.govuk_number_field :cv,
284
+ # = f.govuk_text_area :cv,
232
285
  # label: { text: 'Tell us about your work history' },
233
286
  # rows: 8,
234
287
  # max_words: 300
235
288
  #
236
289
  # @example A text area with injected content
237
- # = f.govuk_number_field :description,
290
+ # = f.govuk_text_area :description,
238
291
  # label: { text: 'Where did the incident take place?' } do
239
292
  #
240
293
  # p.govuk-inset-text
241
294
  # | If you don't know exactly leave this section blank
242
295
  #
243
- def govuk_text_area(attribute_name, hint_text: nil, label: {}, max_words: nil, max_chars: nil, rows: 5, threshold: nil, **args, &block)
244
- 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
296
+ # @example A text area with the label supplied as a proc
297
+ # = f.govuk_text_area :instructions,
298
+ # label: -> { tag.h3("How do you set it up?") }
299
+ #
300
+ def govuk_text_area(attribute_name, hint_text: nil, label: {}, caption: {}, max_words: nil, max_chars: nil, rows: 5, threshold: nil, **args, &block)
301
+ Elements::TextArea.new(self, object_name, attribute_name, hint_text: hint_text, label: label, caption: caption, max_words: max_words, max_chars: max_chars, rows: rows, threshold: threshold, **args, &block).html
245
302
  end
246
303
 
247
304
  # Generates a +select+ element containing +option+ for each member in the provided collection
@@ -259,21 +316,23 @@ module GOVUKDesignSystemFormBuilder
259
316
  # @return [ActiveSupport::SafeBuffer] HTML output
260
317
  #
261
318
  # @example A select box with hint
262
- # = f.govuk_number_field :grade,
319
+ # = f.govuk_collection_select :grade,
263
320
  # @grades,
264
321
  # :id,
265
322
  # :name,
266
323
  # hint_text: "If you took the test more than once enter your highest grade"
267
324
  #
268
325
  # @example A select box with injected content
269
- # = f.govuk_number_field :favourite_colour,
270
- # @colours,
271
- # :id,
272
- # :name do
326
+ # = f.govuk_collection_select(:favourite_colour, @colours, :id, :name) do
273
327
  #
274
328
  # p.govuk-inset-text
275
329
  # | Select the closest match
276
- def govuk_collection_select(attribute_name, collection, value_method, text_method, options: {}, html_options: {}, hint_text: nil, label: {}, &block)
330
+ #
331
+ # @example A select box with the label supplied as a proc
332
+ # = f.govuk_collection_select(:team, @teams, :id, :name) do
333
+ # label: -> { tag.h3("Which team did you represent?") }
334
+ #
335
+ def govuk_collection_select(attribute_name, collection, value_method, text_method, options: {}, html_options: {}, hint_text: nil, label: {}, caption: {}, &block)
277
336
  Elements::Select.new(
278
337
  self,
279
338
  object_name,
@@ -283,6 +342,7 @@ module GOVUKDesignSystemFormBuilder
283
342
  text_method: text_method,
284
343
  hint_text: hint_text,
285
344
  label: label,
345
+ caption: caption,
286
346
  options: options,
287
347
  html_options: html_options,
288
348
  &block
@@ -309,7 +369,7 @@ module GOVUKDesignSystemFormBuilder
309
369
  # When a +Proc+ is provided it must take a single argument that is a single member of the collection.
310
370
  # When a +nil+ value is provided the hint text will be retrieved from the locale. This is the default and param can be omitted.
311
371
  # @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
312
- # @param legend [Hash] options for configuring the legend
372
+ # @param legend [Hash,Proc] options for configuring the legend
313
373
  # @param inline [Boolean] controls whether the radio buttons are displayed inline or not
314
374
  # @param small [Boolean] controls whether small radio buttons are used instead of regular-sized ones
315
375
  # @param bold_labels [Boolean] controls whether the radio button labels are bold
@@ -318,6 +378,9 @@ module GOVUKDesignSystemFormBuilder
318
378
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
319
379
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
320
380
  # @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
381
+ # @param caption [Hash] configures or sets the caption content which is inserted above the legend
382
+ # @option caption text [String] the caption text
383
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
321
384
  # @return [ActiveSupport::SafeBuffer] HTML output
322
385
  #
323
386
  # @example A collection of radio buttons for favourite colours, labels capitalised via a proc
@@ -337,14 +400,22 @@ module GOVUKDesignSystemFormBuilder
337
400
  # inline: false
338
401
  #
339
402
  # @example A collection of radio buttons for grades with injected content
340
- # = f.govuk_collection_radio_buttons :favourite_colour,
403
+ # = f.govuk_collection_radio_buttons :grade,
341
404
  # @grades,
342
405
  # :id,
343
406
  # :name do
344
407
  #
345
408
  # p.govuk-inset-text
346
409
  # | If you took the test more than once enter your highest grade
347
- 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, classes: nil, &block)
410
+ #
411
+ # @example A collection of radio buttons with the legend supplied as a proc
412
+ # = f.govuk_collection_radio_buttons :category,
413
+ # @categories,
414
+ # :id,
415
+ # :name,
416
+ # legend: -> { tag.h3('Which category do you belong to?') }
417
+ #
418
+ def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {}, caption: {}, inline: false, small: false, bold_labels: false, classes: nil, &block)
348
419
  Elements::Radios::Collection.new(
349
420
  self,
350
421
  object_name,
@@ -355,6 +426,7 @@ module GOVUKDesignSystemFormBuilder
355
426
  hint_method: hint_method,
356
427
  hint_text: hint_text,
357
428
  legend: legend,
429
+ caption: caption,
358
430
  inline: inline,
359
431
  small: small,
360
432
  bold_labels: bold_labels,
@@ -367,30 +439,46 @@ module GOVUKDesignSystemFormBuilder
367
439
  #
368
440
  # @note The intention is to use {#govuk_radio_button} and {#govuk_radio_divider} within the passed-in block
369
441
  #
442
+ # @note To ensure the {#govuk_error_summary} link functions correctly ensure the first {#govuk_radio_button}
443
+ # is set to +link_errors: true+
444
+ #
370
445
  # @param attribute_name [Symbol] The name of the attribute
371
446
  # @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
372
- # @param legend [Hash] options for configuring the legend
447
+ # @param legend [Hash,Proc] options for configuring the legend
373
448
  # @param inline [Boolean] controls whether the radio buttons are displayed inline or not
374
449
  # @param small [Boolean] controls whether small radio buttons are used instead of regular-sized ones
375
450
  # @option legend text [String] the fieldset legend's text content
376
451
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
377
452
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
378
453
  # @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
454
+ # @param caption [Hash] configures or sets the caption content which is inserted above the legend
455
+ # @option caption text [String] the caption text
456
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
379
457
  # @param block [Block] a block of HTML that will be used to populate the fieldset
380
458
  # @param classes [String] Classes to add to the radio button container.
381
459
  # @see https://design-system.service.gov.uk/components/radios/ GOV.UK Radios
460
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
382
461
  # @return [ActiveSupport::SafeBuffer] HTML output
383
462
  #
384
- # @example A collection of radio buttons for favourite colours with a divider
463
+ # @example A radio button fieldset for favourite colours with a divider
385
464
  #
386
- # = f.govuk_collection_radio_buttons :favourite_colour, inline: false do
387
- # = f.govuk_radio_button :favourite_colour, :red, label: { text: 'Red' }
465
+ # = f.govuk_radio_buttons_fieldset :favourite_colour, inline: false do
466
+ # = f.govuk_radio_button :favourite_colour, :red, label: { text: 'Red' }, link_errors: true
388
467
  # = f.govuk_radio_button :favourite_colour, :green, label: { text: 'Green' }
389
468
  # = f.govuk_radio_divider
390
469
  # = f.govuk_radio_button :favourite_colour, :yellow, label: { text: 'Yellow' }
391
470
  #
392
- def govuk_radio_buttons_fieldset(attribute_name, hint_text: nil, legend: {}, inline: false, small: false, classes: nil, &block)
393
- Containers::RadioButtonsFieldset.new(self, object_name, attribute_name, hint_text: hint_text, legend: legend, inline: inline, small: small, classes: classes, &block).html
471
+ # @example A radio button fieldset with the legend supplied as a proc
472
+ # = f.govuk_radio_buttons_fieldset :burger_id do
473
+ # @burgers,
474
+ # :id,
475
+ # :name,
476
+ # legend: -> { tag.h3('Which hamburger do you want with your meal?') } do
477
+ # = f.govuk_radio_button :burger_id, :regular, label: { text: 'Hamburger' }, link_errors: true
478
+ # = f.govuk_radio_button :burger_id, :cheese, label: { text: 'Cheeseburger' }
479
+ #
480
+ def govuk_radio_buttons_fieldset(attribute_name, hint_text: nil, legend: {}, caption: {}, inline: false, small: false, classes: nil, &block)
481
+ Containers::RadioButtonsFieldset.new(self, object_name, attribute_name, hint_text: hint_text, legend: legend, caption: caption, inline: inline, small: small, classes: classes, &block).html
394
482
  end
395
483
 
396
484
  # Generates a radio button
@@ -403,15 +491,16 @@ module GOVUKDesignSystemFormBuilder
403
491
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
404
492
  # @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
405
493
  # @see https://design-system.service.gov.uk/components/radios/ GOV.UK Radios
494
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
406
495
  # @param block [Block] Any supplied HTML will be wrapped in a conditional
407
496
  # container and only revealed when the radio button is picked
408
- # @param link_errors [Boolean] controls whether this radio button should be linked to
497
+ # @param link_errors [Boolean] controls whether this radio button should be linked to from {#govuk_error_summary}
409
498
  # from the error summary. <b>Should only be set to +true+ for the first radio button in a fieldset</b>
410
499
  # @return [ActiveSupport::SafeBuffer] HTML output
411
500
  #
412
- # @example A collection of radio buttons for favourite colours with a divider
501
+ # @example A single radio button for our new favourite colour
413
502
  #
414
- # = f.govuk_collection_radio_buttons :favourite_colour, inline: false do
503
+ # = f.govuk_radio_buttons_fieldset :favourite_colour do
415
504
  # = f.govuk_radio_button :favourite_colour, :red, label: { text: 'Red' }
416
505
  #
417
506
  def govuk_radio_button(attribute_name, value, hint_text: nil, label: {}, link_errors: false, &block)
@@ -441,11 +530,14 @@ module GOVUKDesignSystemFormBuilder
441
530
  # @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
442
531
  # @param small [Boolean] controls whether small check boxes are used instead of regular-sized ones
443
532
  # @param classes [String] Classes to add to the checkbox container.
444
- # @param legend [Hash] options for configuring the legend
533
+ # @param legend [Hash,Proc] options for configuring the legend
445
534
  # @option legend text [String] the fieldset legend's text content
446
535
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
447
536
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
448
537
  # @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
538
+ # @param caption [Hash] configures or sets the caption content which is inserted above the legend
539
+ # @option caption text [String] the caption text
540
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
449
541
  # @param block [Block] any HTML passed in will be injected into the fieldset, after the hint and before the checkboxes
450
542
  # @return [ActiveSupport::SafeBuffer] HTML output
451
543
  #
@@ -467,14 +559,22 @@ module GOVUKDesignSystemFormBuilder
467
559
  # classes: 'app-overflow-scroll',
468
560
  #
469
561
  # @example A collection of check boxes for types of bread
470
- # = f.govuk_collection_radio_buttons :bread,
562
+ # = f.govuk_collection_check_boxes :bread,
471
563
  # @variety,
472
564
  # :id,
473
565
  # :name do
474
566
  #
475
567
  # p.govuk-inset-text
476
568
  # | Only Hearty Italian is available with the meal deal menu
477
- def govuk_collection_check_boxes(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {}, small: false, classes: nil, &block)
569
+ #
570
+ # @example A collection of check boxes with the legend supplied as a proc
571
+ # = f.govuk_collection_check_boxes :sandwich_type,
572
+ # @breads,
573
+ # :id,
574
+ # :name,
575
+ # legend: -> { tag.h3('What kind of sandwich do you want?') }
576
+ #
577
+ def govuk_collection_check_boxes(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {}, caption: {}, small: false, classes: nil, &block)
478
578
  Elements::CheckBoxes::Collection.new(
479
579
  self,
480
580
  object_name,
@@ -485,6 +585,7 @@ module GOVUKDesignSystemFormBuilder
485
585
  hint_method: hint_method,
486
586
  hint_text: hint_text,
487
587
  legend: legend,
588
+ caption: caption,
488
589
  small: small,
489
590
  classes: classes,
490
591
  &block
@@ -493,43 +594,54 @@ module GOVUKDesignSystemFormBuilder
493
594
 
494
595
  # Generate a fieldset intended to conatain one or more {#govuk_check_box}
495
596
  #
597
+ # @note To ensure the {#govuk_error_summary} link functions correctly ensure the first {#govuk_check_box}
598
+ # is set to +link_errors: true+
599
+ #
496
600
  # @param attribute_name [Symbol] The name of the attribute
497
601
  # @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
498
602
  # @param small [Boolean] controls whether small check boxes are used instead of regular-sized ones
499
- # @param legend [Hash] options for configuring the legend
603
+ # @param legend [Hash,Proc] options for configuring the legend
500
604
  # @option legend text [String] the fieldset legend's text content
501
605
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
502
606
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
503
607
  # @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
608
+ # @param caption [Hash] configures or sets the caption content which is inserted above the legend
609
+ # @option caption text [String] the caption text
610
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
504
611
  # @param classes [String] Classes to add to the checkbox container.
505
612
  # @param block [Block] a block of HTML that will be used to populate the fieldset
506
613
  # @return [ActiveSupport::SafeBuffer] HTML output
507
614
  #
508
615
  # @example A collection of check boxes for sandwich fillings
509
- #
510
- # = f.govuk_check_boxes_fieldset :desired_filling,
616
+ # = f.govuk_check_boxes_fieldset :desired_filling, legend: { text: 'Which filling do you want?' },
511
617
  # = f.govuk_check_box :desired_filling, :cheese, label: { text: 'Cheese' }, link_errors: true
512
618
  # = f.govuk_check_box :desired_filling, :tomato, label: { text: 'Tomato' }
513
619
  #
514
- def govuk_check_boxes_fieldset(attribute_name, legend: {}, hint_text: {}, small: false, classes: nil, &block)
620
+ # @example A collection of check boxes for drinks choices with legend as a proc
621
+ # = f.govuk_check_boxes_fieldset :drink_id, legend: -> { tag.h3('Choose drinks to accompany your meal') },
622
+ # = f.govuk_check_box :desired_filling, :lemonade, label: { text: 'Lemonade' }, link_errors: true
623
+ # = f.govuk_check_box :desired_filling, :fizzy_orange, label: { text: 'Fizzy orange' }
624
+ #
625
+ def govuk_check_boxes_fieldset(attribute_name, legend: {}, caption: {}, hint_text: {}, small: false, classes: nil, &block)
515
626
  Containers::CheckBoxesFieldset.new(
516
627
  self,
517
628
  object_name,
518
629
  attribute_name,
519
630
  hint_text: hint_text,
520
631
  legend: legend,
632
+ caption: caption,
521
633
  small: small,
522
634
  classes: classes,
523
635
  &block
524
636
  ).html
525
637
  end
526
638
 
527
- # Generates a single fieldset, intended for use within a {#govuk_check_boxes_fieldset}
639
+ # Generates a single check box, intended for use within a {#govuk_check_boxes_fieldset}
528
640
  #
529
641
  # @param attribute_name [Symbol] The name of the attribute
530
642
  # @param value [Boolean,String,Symbol,Integer] The value of the checkbox when it is checked
531
643
  # @param hint_text [String] the contents of the hint
532
- # @param link_errors [Boolean] controls whether this radio button should be linked to
644
+ # @param link_errors [Boolean] controls whether this radio button should be linked to from {#govuk_error_summary}
533
645
  # @option label text [String] the label text
534
646
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
535
647
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
@@ -598,11 +710,14 @@ module GOVUKDesignSystemFormBuilder
598
710
  # be 'rounded' up to +2019-10-01+.
599
711
  # @param attribute_name [Symbol] The name of the attribute
600
712
  # @param hint_text [String] the contents of the hint
601
- # @param legend [Hash] options for configuring the legend
713
+ # @param legend [Hash,Proc] options for configuring the legend
602
714
  # @option legend text [String] the fieldset legend's text content
603
715
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
604
716
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
605
717
  # @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
718
+ # @param caption [Hash] configures or sets the caption content which is inserted above the legend
719
+ # @option caption text [String] the caption text
720
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
606
721
  # @param omit_day [Boolean] do not render a day input, only capture month and year
607
722
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input group
608
723
  # @param date_of_birth [Boolean] if +true+ {https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#Values birth date auto completion attributes}
@@ -610,6 +725,7 @@ module GOVUKDesignSystemFormBuilder
610
725
  # @return [ActiveSupport::SafeBuffer] HTML output
611
726
  #
612
727
  # @see https://github.com/alphagov/govuk-frontend/issues/1449 GOV.UK date input element attributes, using text instead of number
728
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
613
729
  #
614
730
  # @example A regular date input with a legend, hint and injected content
615
731
  # = f.govuk_date_field :starts_on,
@@ -619,8 +735,11 @@ module GOVUKDesignSystemFormBuilder
619
735
  # p.govuk-inset-text
620
736
  # | If you don't fill this in you won't be eligable for a refund
621
737
  #
622
- def govuk_date_field(attribute_name, hint_text: nil, legend: {}, date_of_birth: false, omit_day: false, &block)
623
- Elements::Date.new(self, object_name, attribute_name, hint_text: hint_text, legend: legend, date_of_birth: date_of_birth, omit_day: omit_day, &block).html
738
+ # @example A date input with legend supplied as a proc
739
+ # = f.govuk_date_field :finishes_on,
740
+ # legend: -> { tag.h3('Which category do you belong to?') }
741
+ def govuk_date_field(attribute_name, hint_text: nil, legend: {}, caption: {}, date_of_birth: false, omit_day: false, &block)
742
+ Elements::Date.new(self, object_name, attribute_name, hint_text: hint_text, legend: legend, caption: caption, date_of_birth: date_of_birth, omit_day: omit_day, &block).html
624
743
  end
625
744
 
626
745
  # Generates a summary of errors in the form, each linking to the corresponding
@@ -628,12 +747,6 @@ module GOVUKDesignSystemFormBuilder
628
747
  #
629
748
  # @param title [String] the error summary heading
630
749
  #
631
- # @todo Currently the summary anchors link to the inline error messages themselves rather to
632
- # the accompanying input. More work is required to improve this and it needs to be
633
- # handled in a less-generic manner. For example, we can't link to a specific radio button
634
- # if one hasn't been chosen but we should link to a {#govuk_text_field} if one has been left
635
- # blank
636
- #
637
750
  # @example An error summary with a custom title
638
751
  # = f.govuk_error_summary 'Uh-oh, spaghettios'
639
752
  #
@@ -644,12 +757,15 @@ module GOVUKDesignSystemFormBuilder
644
757
 
645
758
  # Generates a fieldset containing the contents of the block
646
759
  #
647
- # @param legend [Hash] options for configuring the legend
760
+ # @param legend [Hash,Proc] options for configuring the legend
648
761
  # @param described_by [Array<String>] the ids of the elements that describe this fieldset, usually hints and errors
649
762
  # @option legend text [String] the fieldset legend's text content
650
763
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
651
764
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
652
765
  # @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
766
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
767
+ # @option caption text [String] the caption text
768
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
653
769
  #
654
770
  # @example A fieldset containing address fields
655
771
  # = f.govuk_fieldset legend: { text: 'Address' }
@@ -657,10 +773,16 @@ module GOVUKDesignSystemFormBuilder
657
773
  # = f.govuk_text_field :town
658
774
  # = f.govuk_text_field :city
659
775
  #
776
+ # @example A fieldset with the legend as a proc
777
+ # = f.govuk_fieldset legend: -> { tag.h3('Skills') }
778
+ # = f.govuk_text_area :physical
779
+ # = f.govuk_text_area :mental
780
+ #
660
781
  # @see https://design-system.service.gov.uk/components/fieldset/ GOV.UK fieldset
782
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
661
783
  # @return [ActiveSupport::SafeBuffer] HTML output
662
- def govuk_fieldset(legend: { text: 'Fieldset heading' }, described_by: nil, &block)
663
- Containers::Fieldset.new(self, legend: legend, described_by: described_by).html(&block)
784
+ def govuk_fieldset(legend: { text: 'Fieldset heading' }, caption: {}, described_by: nil, &block)
785
+ Containers::Fieldset.new(self, legend: legend, caption: caption, described_by: described_by, &block).html
664
786
  end
665
787
 
666
788
  # Generates an input of type +file+
@@ -670,8 +792,11 @@ module GOVUKDesignSystemFormBuilder
670
792
  # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
671
793
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
672
794
  # @option label hidden [Boolean] control the visability of the label. Hidden labels will stil be read by screenreaders
795
+ # @param caption [Hash] configures or sets the caption content which is inserted above the label
796
+ # @option caption text [String] the caption text
797
+ # @option caption size [String] the size of the caption, can be +xl+, +l+ or +m+. Defaults to +m+
673
798
  # @param hint_text [String] The content of the hint. No hint will be injected if left +nil+
674
- # @option args [Hash] args additional arguments are applied as attributes to +input+ element
799
+ # @option args [Hash] args additional arguments are applied as attributes to the +input+ element
675
800
  # @param block [Block] arbitrary HTML that will be rendered between the hint and the input
676
801
  #
677
802
  # @example A photo upload field with file type specifier and injected content
@@ -680,14 +805,18 @@ module GOVUKDesignSystemFormBuilder
680
805
  # p.govuk-inset-text
681
806
  # | Explicit images will result in account termination
682
807
  #
808
+ # @example A CV upload field with label as a proc
809
+ # = f.govuk_file_field :cv, label: -> { tag.h3('Upload your CV') }
810
+ #
683
811
  # @see https://design-system.service.gov.uk/components/file-upload/ GOV.UK file upload
812
+ # @see https://design-system.service.gov.uk/styles/typography/#headings-with-captions Headings with captions
684
813
  # @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file MDN documentation for file upload
685
814
  #
686
815
  # @note Remember to set +multipart: true+ when creating a form with file
687
816
  # uploads, {https://guides.rubyonrails.org/form_helpers.html#uploading-files see
688
817
  # the Rails documentation} for more information
689
- def govuk_file_field(attribute_name, label: {}, hint_text: nil, **args, &block)
690
- Elements::File.new(self, object_name, attribute_name, label: label, hint_text: hint_text, **args, &block).html
818
+ def govuk_file_field(attribute_name, label: {}, caption: {}, hint_text: nil, **args, &block)
819
+ Elements::File.new(self, object_name, attribute_name, label: label, caption: caption, hint_text: hint_text, **args, &block).html
691
820
  end
692
821
  end
693
822
  end