govuk_design_system_formbuilder 2.0.0b3 → 2.0.0b4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/govuk_design_system_formbuilder/builder.rb +31 -14
- data/lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb +13 -2
- data/lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb +8 -7
- data/lib/govuk_design_system_formbuilder/traits/input.rb +42 -6
- data/lib/govuk_design_system_formbuilder/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1a220934d67c1a26afea6d623bd2424156b6b4b71ef88411703da5ae761d778
|
4
|
+
data.tar.gz: 808f12be46a25c60e1b1f97d074778bb1a8e1245a78a37672b6282dc4cdeb1fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fa051693840ca2463c6115bb0e4e4e53d68a0322697d49d186f83328635abee391466474da54cdc82fcbc77c28b055b10d7cb8374495965d00d8c4a8562134f
|
7
|
+
data.tar.gz: e8e93bdcbcd3d00b6d62477c52e0f2b4fa387de30825c479db38e1dfb4a1be89e316ff091c3eef1a0f0a917ad12581c26a565dc46cdfa55e1f5212053e459992
|
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.
|
10
|
+
[![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.9.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.
|
13
|
+
fully-compliant with version 3.9.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
|
@@ -26,6 +26,8 @@ module GOVUKDesignSystemFormBuilder
|
|
26
26
|
# @param form_group [Hash] configures the form group
|
27
27
|
# @option form_group classes [Array,String] sets the form group's classes
|
28
28
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
29
|
+
# @param prefix_text [String] the text placed before the input. No prefix will be added if left +nil+
|
30
|
+
# @param suffix_text [String] the text placed after the input. No suffix will be added if left +nil+
|
29
31
|
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
30
32
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
31
33
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
@@ -49,8 +51,8 @@ module GOVUKDesignSystemFormBuilder
|
|
49
51
|
# = f.govuk_text_field :callsign,
|
50
52
|
# label: -> { tag.h3('Call-sign') }
|
51
53
|
#
|
52
|
-
def govuk_text_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, **kwargs, &block)
|
53
|
-
Elements::Inputs::Text.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, **kwargs, &block).html
|
54
|
+
def govuk_text_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
|
55
|
+
Elements::Inputs::Text.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
|
54
56
|
end
|
55
57
|
|
56
58
|
# Generates a input of type +tel+
|
@@ -76,6 +78,8 @@ module GOVUKDesignSystemFormBuilder
|
|
76
78
|
# @param form_group [Hash] configures the form group
|
77
79
|
# @option form_group classes [Array,String] sets the form group's classes
|
78
80
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
81
|
+
# @param prefix_text [String] the text placed before the input. No prefix will be added if left +nil+
|
82
|
+
# @param suffix_text [String] the text placed after the input. No suffix will be added if left +nil+
|
79
83
|
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
80
84
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
81
85
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
@@ -100,8 +104,8 @@ module GOVUKDesignSystemFormBuilder
|
|
100
104
|
# = f.govuk_phone_field :work_number,
|
101
105
|
# label: -> { tag.h3('Work number') }
|
102
106
|
#
|
103
|
-
def govuk_phone_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, **kwargs, &block)
|
104
|
-
Elements::Inputs::Phone.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, **kwargs, &block).html
|
107
|
+
def govuk_phone_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
|
108
|
+
Elements::Inputs::Phone.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
|
105
109
|
end
|
106
110
|
|
107
111
|
# Generates a input of type +email+
|
@@ -127,6 +131,8 @@ module GOVUKDesignSystemFormBuilder
|
|
127
131
|
# @param form_group [Hash] configures the form group
|
128
132
|
# @option form_group classes [Array,String] sets the form group's classes
|
129
133
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
134
|
+
# @param prefix_text [String] the text placed before the input. No prefix will be added if left +nil+
|
135
|
+
# @param suffix_text [String] the text placed after the input. No suffix will be added if left +nil+
|
130
136
|
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
131
137
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
132
138
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
@@ -149,8 +155,8 @@ module GOVUKDesignSystemFormBuilder
|
|
149
155
|
# = f.govuk_email_field :personal_email,
|
150
156
|
# label: -> { tag.h3('Personal email address') }
|
151
157
|
#
|
152
|
-
def govuk_email_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, **kwargs, &block)
|
153
|
-
Elements::Inputs::Email.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, **kwargs, &block).html
|
158
|
+
def govuk_email_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
|
159
|
+
Elements::Inputs::Email.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
|
154
160
|
end
|
155
161
|
|
156
162
|
# Generates a input of type +password+
|
@@ -176,6 +182,8 @@ module GOVUKDesignSystemFormBuilder
|
|
176
182
|
# @param form_group [Hash] configures the form group
|
177
183
|
# @option form_group classes [Array,String] sets the form group's classes
|
178
184
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
185
|
+
# @param prefix_text [String] the text placed before the input. No prefix will be added if left +nil+
|
186
|
+
# @param suffix_text [String] the text placed after the input. No suffix will be added if left +nil+
|
179
187
|
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
180
188
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
181
189
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
@@ -197,8 +205,8 @@ module GOVUKDesignSystemFormBuilder
|
|
197
205
|
# = f.govuk_password_field :passcode,
|
198
206
|
# label: -> { tag.h3('What is your secret pass code?') }
|
199
207
|
#
|
200
|
-
def govuk_password_field(attribute_name, hint: {}, label: {}, width: nil, form_group: {}, caption: {}, **kwargs, &block)
|
201
|
-
Elements::Inputs::Password.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, **kwargs, &block).html
|
208
|
+
def govuk_password_field(attribute_name, hint: {}, label: {}, width: nil, form_group: {}, caption: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
|
209
|
+
Elements::Inputs::Password.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
|
202
210
|
end
|
203
211
|
|
204
212
|
# Generates a input of type +url+
|
@@ -224,6 +232,8 @@ module GOVUKDesignSystemFormBuilder
|
|
224
232
|
# @param form_group [Hash] configures the form group
|
225
233
|
# @option form_group classes [Array,String] sets the form group's classes
|
226
234
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
235
|
+
# @param prefix_text [String] the text placed before the input. No prefix will be added if left +nil+
|
236
|
+
# @param suffix_text [String] the text placed after the input. No suffix will be added if left +nil+
|
227
237
|
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
228
238
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
229
239
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
@@ -246,8 +256,8 @@ module GOVUKDesignSystemFormBuilder
|
|
246
256
|
# = f.govuk_url_field :work_website,
|
247
257
|
# label: -> { tag.h3("Enter your company's website") }
|
248
258
|
#
|
249
|
-
def govuk_url_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, **kwargs, &block)
|
250
|
-
Elements::Inputs::URL.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, **kwargs, &block).html
|
259
|
+
def govuk_url_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
|
260
|
+
Elements::Inputs::URL.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
|
251
261
|
end
|
252
262
|
|
253
263
|
# Generates a input of type +number+
|
@@ -273,6 +283,8 @@ module GOVUKDesignSystemFormBuilder
|
|
273
283
|
# @param form_group [Hash] configures the form group
|
274
284
|
# @option form_group classes [Array,String] sets the form group's classes
|
275
285
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
286
|
+
# @param prefix_text [String] the text placed before the input. No prefix will be added if left +nil+
|
287
|
+
# @param suffix_text [String] the text placed after the input. No suffix will be added if left +nil+
|
276
288
|
# @param block [Block] arbitrary HTML that will be rendered between the hint and the input
|
277
289
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
278
290
|
# @see https://design-system.service.gov.uk/components/text-input/ GOV.UK Text input
|
@@ -298,8 +310,8 @@ module GOVUKDesignSystemFormBuilder
|
|
298
310
|
# = f.govuk_url_field :personal_best_over_100m,
|
299
311
|
# label: -> { tag.h3("How many seconds does it take you to run 100m?") }
|
300
312
|
#
|
301
|
-
def govuk_number_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, **kwargs, &block)
|
302
|
-
Elements::Inputs::Number.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, **kwargs, &block).html
|
313
|
+
def govuk_number_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
|
314
|
+
Elements::Inputs::Number.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
|
303
315
|
end
|
304
316
|
|
305
317
|
# Generates a +textarea+ element with a label, optional hint. Also offers
|
@@ -710,6 +722,8 @@ module GOVUKDesignSystemFormBuilder
|
|
710
722
|
# @option caption kwargs [Hash] additional arguments are applied as attributes on the caption +span+ element
|
711
723
|
# @param classes [Array,String] Classes to add to the checkbox container.
|
712
724
|
# @param form_group [Hash] configures the form group
|
725
|
+
# @param multiple [Boolean] when true adds a +[]+ suffix the +name+ of the automatically-generated hidden field
|
726
|
+
# (ie. <code>project[invoice_attributes][]</code>). When false, no +[]+ suffix is added (ie. <code>project[accepted]</code>)
|
713
727
|
# @option form_group classes [Array,String] sets the form group's classes
|
714
728
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
715
729
|
# @param block [Block] a block of HTML that will be used to populate the fieldset
|
@@ -725,7 +739,7 @@ module GOVUKDesignSystemFormBuilder
|
|
725
739
|
# = f.govuk_check_box :desired_filling, :lemonade, label: { text: 'Lemonade' }, link_errors: true
|
726
740
|
# = f.govuk_check_box :desired_filling, :fizzy_orange, label: { text: 'Fizzy orange' }
|
727
741
|
#
|
728
|
-
def govuk_check_boxes_fieldset(attribute_name, legend: {}, caption: {}, hint: {}, small: false, classes: nil, form_group: {}, &block)
|
742
|
+
def govuk_check_boxes_fieldset(attribute_name, legend: {}, caption: {}, hint: {}, small: false, classes: nil, form_group: {}, multiple: true, &block)
|
729
743
|
Containers::CheckBoxesFieldset.new(
|
730
744
|
self,
|
731
745
|
object_name,
|
@@ -736,6 +750,7 @@ module GOVUKDesignSystemFormBuilder
|
|
736
750
|
small: small,
|
737
751
|
classes: classes,
|
738
752
|
form_group: form_group,
|
753
|
+
multiple: multiple,
|
739
754
|
&block
|
740
755
|
).html
|
741
756
|
end
|
@@ -744,6 +759,7 @@ module GOVUKDesignSystemFormBuilder
|
|
744
759
|
#
|
745
760
|
# @param attribute_name [Symbol] The name of the attribute
|
746
761
|
# @param value [Boolean,String,Symbol,Integer] The value of the checkbox when it is checked
|
762
|
+
# @param unchecked_value [Boolean,String,Symbol,Integer] The value of the checkbox when it is unchecked
|
747
763
|
# @param hint [Hash,Proc] The content of the hint. No hint will be added if 'text' is left +nil+. When a +Proc+ is
|
748
764
|
# supplied the hint will be wrapped in a +div+ instead of a +span+
|
749
765
|
# @option hint text [String] the hint text
|
@@ -766,12 +782,13 @@ module GOVUKDesignSystemFormBuilder
|
|
766
782
|
# label: { text: 'Do you agree with our terms and conditions?' },
|
767
783
|
# hint: { text: 'You will not be able to proceed unless you do' }
|
768
784
|
#
|
769
|
-
def govuk_check_box(attribute_name, value, hint: {}, label: {}, link_errors: false, multiple: true, &block)
|
785
|
+
def govuk_check_box(attribute_name, value, unchecked_value = false, hint: {}, label: {}, link_errors: false, multiple: true, &block)
|
770
786
|
Elements::CheckBoxes::FieldsetCheckBox.new(
|
771
787
|
self,
|
772
788
|
object_name,
|
773
789
|
attribute_name,
|
774
790
|
value,
|
791
|
+
unchecked_value,
|
775
792
|
hint: hint,
|
776
793
|
label: label,
|
777
794
|
link_errors: link_errors,
|
@@ -4,7 +4,7 @@ module GOVUKDesignSystemFormBuilder
|
|
4
4
|
include Traits::Error
|
5
5
|
include Traits::Hint
|
6
6
|
|
7
|
-
def initialize(builder, object_name, attribute_name, hint:, legend:, caption:, small:, classes:, form_group:, &block)
|
7
|
+
def initialize(builder, object_name, attribute_name, hint:, legend:, caption:, small:, classes:, form_group:, multiple:, &block)
|
8
8
|
super(builder, object_name, attribute_name, &block)
|
9
9
|
|
10
10
|
@legend = legend
|
@@ -13,19 +13,30 @@ module GOVUKDesignSystemFormBuilder
|
|
13
13
|
@small = small
|
14
14
|
@classes = classes
|
15
15
|
@form_group = form_group
|
16
|
+
@multiple = multiple
|
16
17
|
@block_content = capture { block.call }
|
17
18
|
end
|
18
19
|
|
19
20
|
def html
|
20
21
|
Containers::FormGroup.new(@builder, @object_name, @attribute_name, **@form_group).html do
|
21
22
|
Containers::Fieldset.new(@builder, @object_name, @attribute_name, **fieldset_options).html do
|
22
|
-
safe_join([hint_element, error_element, checkboxes])
|
23
|
+
safe_join([hint_element, error_element, hidden_field, checkboxes])
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
private
|
28
29
|
|
30
|
+
def hidden_field
|
31
|
+
return unless @multiple
|
32
|
+
|
33
|
+
@builder.hidden_field(@attribute_name, value: "", name: hidden_field_name)
|
34
|
+
end
|
35
|
+
|
36
|
+
def hidden_field_name
|
37
|
+
format("%<object_name>s[%<attribute_name>s][]", object_name: @object_name, attribute_name: @attribute_name)
|
38
|
+
end
|
39
|
+
|
29
40
|
def fieldset_options
|
30
41
|
{
|
31
42
|
legend: @legend,
|
@@ -8,14 +8,15 @@ module GOVUKDesignSystemFormBuilder
|
|
8
8
|
include Traits::Hint
|
9
9
|
include Traits::Conditional
|
10
10
|
|
11
|
-
def initialize(builder, object_name, attribute_name, value, label:, hint:, link_errors:, multiple:, &block)
|
11
|
+
def initialize(builder, object_name, attribute_name, value, unchecked_value, label:, hint:, link_errors:, multiple:, &block)
|
12
12
|
super(builder, object_name, attribute_name)
|
13
13
|
|
14
|
-
@value
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
14
|
+
@value = value
|
15
|
+
@unchecked_value = unchecked_value
|
16
|
+
@label = label
|
17
|
+
@hint = hint
|
18
|
+
@multiple = multiple
|
19
|
+
@link_errors = link_errors
|
19
20
|
|
20
21
|
if block_given?
|
21
22
|
@conditional_content = wrap_conditional(block)
|
@@ -36,7 +37,7 @@ module GOVUKDesignSystemFormBuilder
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def check_box
|
39
|
-
@builder.check_box(@attribute_name, options, @value,
|
40
|
+
@builder.check_box(@attribute_name, options, @value, @unchecked_value)
|
40
41
|
end
|
41
42
|
|
42
43
|
def options
|
@@ -1,38 +1,58 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Traits
|
3
3
|
module Input
|
4
|
-
def initialize(builder, object_name, attribute_name, hint:, label:, caption:, width:, form_group:, **kwargs, &block)
|
4
|
+
def initialize(builder, object_name, attribute_name, hint:, label:, caption:, prefix_text:, suffix_text:, width:, form_group:, **kwargs, &block)
|
5
5
|
super(builder, object_name, attribute_name, &block)
|
6
6
|
|
7
7
|
@width = width
|
8
8
|
@label = label
|
9
9
|
@caption = caption
|
10
10
|
@hint = hint
|
11
|
+
@prefix_text = prefix_text
|
12
|
+
@suffix_text = suffix_text
|
11
13
|
@html_attributes = kwargs
|
12
14
|
@form_group = form_group
|
13
15
|
end
|
14
16
|
|
15
17
|
def html
|
16
18
|
Containers::FormGroup.new(@builder, @object_name, @attribute_name, **@form_group).html do
|
17
|
-
safe_join([label_element, supplemental_content, hint_element, error_element,
|
19
|
+
safe_join([label_element, supplemental_content, hint_element, error_element, content])
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
23
|
private
|
22
24
|
|
25
|
+
def content
|
26
|
+
if affixed?
|
27
|
+
affixed_input
|
28
|
+
else
|
29
|
+
input
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def affixed_input
|
34
|
+
content_tag('div', class: %(#{brand}-input__wrapper)) do
|
35
|
+
safe_join([prefix, input, suffix])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
23
39
|
def input
|
24
|
-
@builder.send(builder_method, @attribute_name, **
|
40
|
+
@builder.send(builder_method, @attribute_name, **options, **@html_attributes)
|
41
|
+
end
|
42
|
+
|
43
|
+
def affixed?
|
44
|
+
[@prefix_text, @suffix_text].any?
|
25
45
|
end
|
26
46
|
|
27
|
-
def
|
47
|
+
def options
|
28
48
|
{
|
29
49
|
id: field_id(link_errors: true),
|
30
|
-
class:
|
50
|
+
class: classes,
|
31
51
|
aria: { describedby: described_by(hint_id, error_id, supplemental_id) }
|
32
52
|
}
|
33
53
|
end
|
34
54
|
|
35
|
-
def
|
55
|
+
def classes
|
36
56
|
[%(#{brand}-input)].push(width_classes, error_classes).compact
|
37
57
|
end
|
38
58
|
|
@@ -64,6 +84,22 @@ module GOVUKDesignSystemFormBuilder
|
|
64
84
|
else fail(ArgumentError, "invalid width '#{@width}'")
|
65
85
|
end
|
66
86
|
end
|
87
|
+
|
88
|
+
def prefix
|
89
|
+
return nil if @prefix_text.blank?
|
90
|
+
|
91
|
+
tag.span(@prefix_text, class: %(#{brand}-input__prefix), **affix_options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def suffix
|
95
|
+
return nil if @suffix_text.blank?
|
96
|
+
|
97
|
+
tag.span(@suffix_text, class: %(#{brand}-input__suffix), **affix_options)
|
98
|
+
end
|
99
|
+
|
100
|
+
def affix_options
|
101
|
+
{ aria: { hidden: true } }
|
102
|
+
end
|
67
103
|
end
|
68
104
|
end
|
69
105
|
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: 2.0.
|
4
|
+
version: 2.0.0b4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 0.
|
137
|
+
version: 0.17.1
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0.
|
144
|
+
version: 0.17.1
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: htmlbeautifier
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,14 +176,14 @@ dependencies:
|
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 3.
|
179
|
+
version: 3.22.0
|
180
180
|
type: :development
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: 3.
|
186
|
+
version: 3.22.0
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: rubypants
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|