govuk_design_system_formbuilder 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c55b78722270c864a735be507e018c420e14bee0e408c59da1bc61777c320bf7
|
4
|
+
data.tar.gz: b0d291bca6a13a77fe21db5c431bfea86184de8acd82b5e4cc3a3c944fdf322c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a130e8bb5964af17acb89a14f02ecda2ed989c1e18c6ed970a400945be78c5a8fdc0dd735333b026f51b75a5d090c4e6403f3594feedf595b21c294abec13ae7
|
7
|
+
data.tar.gz: 9afc6f6e12e26bdc2cd4eafc41f2d1e5a972829fd18bd2a2571550b683500320a66f6603d159af0e7c0943b57deeaf8b47267499ac4cf2c3577d207b555cfcba
|
@@ -21,7 +21,7 @@ module GOVUKDesignSystemFormBuilder
|
|
21
21
|
# Can be either +xl+, +l+, +m+ or +s+.
|
22
22
|
#
|
23
23
|
# * +:default_legend_tag+ controls the default tag that legends are
|
24
|
-
# wrapped in. Defaults to +
|
24
|
+
# wrapped in. Defaults to +nil+.
|
25
25
|
#
|
26
26
|
# * +:default_submit_button_text+ sets the value assigned to +govuk_submit+,
|
27
27
|
# defaults to 'Continue'.
|
@@ -47,7 +47,7 @@ module GOVUKDesignSystemFormBuilder
|
|
47
47
|
brand: 'govuk',
|
48
48
|
|
49
49
|
default_legend_size: 'm',
|
50
|
-
default_legend_tag:
|
50
|
+
default_legend_tag: nil,
|
51
51
|
default_caption_size: 'm',
|
52
52
|
default_submit_button_text: 'Continue',
|
53
53
|
default_radio_divider_text: 'or',
|
@@ -459,7 +459,7 @@ module GOVUKDesignSystemFormBuilder
|
|
459
459
|
# @param classes [Array,String] Classes to add to the radio button container.
|
460
460
|
# @option legend text [String] the fieldset legend's text content
|
461
461
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
462
|
-
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1
|
462
|
+
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+.
|
463
463
|
# @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
|
464
464
|
# @option legend kwargs [Hash] additional arguments are applied as attributes on the +legend+ element
|
465
465
|
# @param caption [Hash] configures or sets the caption content which is inserted above the legend
|
@@ -538,7 +538,7 @@ module GOVUKDesignSystemFormBuilder
|
|
538
538
|
# @param small [Boolean] controls whether small radio buttons are used instead of regular-sized ones
|
539
539
|
# @option legend text [String] the fieldset legend's text content
|
540
540
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
541
|
-
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1
|
541
|
+
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+.
|
542
542
|
# @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
|
543
543
|
# @option legend kwargs [Hash] additional arguments are applied as attributes on the +legend+ element
|
544
544
|
# @param caption [Hash] configures or sets the caption content which is inserted above the legend
|
@@ -635,7 +635,7 @@ module GOVUKDesignSystemFormBuilder
|
|
635
635
|
# @param legend [NilClass,Hash,Proc] options for configuring the legend. Legend will be omitted if +nil+.
|
636
636
|
# @option legend text [String] the fieldset legend's text content
|
637
637
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
638
|
-
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1
|
638
|
+
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+.
|
639
639
|
# @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
|
640
640
|
# @param caption [Hash] configures or sets the caption content which is inserted above the legend
|
641
641
|
# @option caption text [String] the caption text
|
@@ -713,7 +713,7 @@ module GOVUKDesignSystemFormBuilder
|
|
713
713
|
# @param legend [NilClass,Hash,Proc] options for configuring the legend. Legend will be omitted if +nil+.
|
714
714
|
# @option legend text [String] the fieldset legend's text content
|
715
715
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
716
|
-
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1
|
716
|
+
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+.
|
717
717
|
# @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
|
718
718
|
# @option legend kwargs [Hash] additional arguments are applied as attributes on the +legend+ element
|
719
719
|
# @param caption [Hash] configures or sets the caption content which is inserted above the legend
|
@@ -816,6 +816,8 @@ module GOVUKDesignSystemFormBuilder
|
|
816
816
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
817
817
|
# @note Only the first additional button or link (passed in via a block) will be given the
|
818
818
|
# correct left margin, subsequent buttons will need to be manually accounted for
|
819
|
+
# @note This helper always renders an +<input type='submit'>+ tag, HTML content is not supported inside. You
|
820
|
+
# can place +<button>+ tags inside the form to have the same effect
|
819
821
|
# @see https://design-system.service.gov.uk/components/button/#stop-users-from-accidentally-sending-information-more-than-once
|
820
822
|
# GOV.UK double click prevention
|
821
823
|
#
|
@@ -840,7 +842,7 @@ module GOVUKDesignSystemFormBuilder
|
|
840
842
|
# @param legend [NilClass,Hash,Proc] options for configuring the legend. Legend will be omitted if +nil+.
|
841
843
|
# @option legend text [String] the fieldset legend's text content
|
842
844
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
843
|
-
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1
|
845
|
+
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+.
|
844
846
|
# @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
|
845
847
|
# @option legend kwargs [Hash] additional arguments are applied as attributes on the +legend+ element
|
846
848
|
# @param caption [Hash] configures or sets the caption content which is inserted above the legend
|
@@ -879,6 +881,9 @@ module GOVUKDesignSystemFormBuilder
|
|
879
881
|
#
|
880
882
|
# @param title [String] the error summary heading
|
881
883
|
#
|
884
|
+
# @note Only the first error in the +#errors+ array for each attribute will
|
885
|
+
# be included.
|
886
|
+
#
|
882
887
|
# @example An error summary with a custom title
|
883
888
|
# = f.govuk_error_summary 'Uh-oh, spaghettios'
|
884
889
|
#
|
@@ -893,7 +898,7 @@ module GOVUKDesignSystemFormBuilder
|
|
893
898
|
# @param described_by [Array<String>] the ids of the elements that describe this fieldset, usually hints and errors
|
894
899
|
# @option legend text [String] the fieldset legend's text content
|
895
900
|
# @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
|
896
|
-
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1
|
901
|
+
# @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+.
|
897
902
|
# @option legend hidden [Boolean] control the visibility of the legend. Hidden legends will still be read by screenreaders
|
898
903
|
# @option legend kwargs [Hash] additional arguments are applied as attributes on the +legend+ element
|
899
904
|
# @param caption [Hash] configures or sets the caption content which is inserted above the label
|
@@ -902,13 +907,13 @@ module GOVUKDesignSystemFormBuilder
|
|
902
907
|
# @option caption kwargs [Hash] additional arguments are applied as attributes on the caption +span+ element
|
903
908
|
#
|
904
909
|
# @example A fieldset containing address fields
|
905
|
-
# = f.govuk_fieldset legend: { text: 'Address' }
|
910
|
+
# = f.govuk_fieldset legend: { text: 'Address' } do
|
906
911
|
# = f.govuk_text_field :street
|
907
912
|
# = f.govuk_text_field :town
|
908
913
|
# = f.govuk_text_field :city
|
909
914
|
#
|
910
915
|
# @example A fieldset with the legend as a proc
|
911
|
-
# = f.govuk_fieldset legend: -> { tag.h3('Skills') }
|
916
|
+
# = f.govuk_fieldset legend: -> { tag.h3('Skills') } do
|
912
917
|
# = f.govuk_text_area :physical
|
913
918
|
# = f.govuk_text_area :mental
|
914
919
|
#
|
@@ -11,7 +11,7 @@ module GOVUKDesignSystemFormBuilder
|
|
11
11
|
|
12
12
|
case legend
|
13
13
|
when NilClass
|
14
|
-
|
14
|
+
# do nothing
|
15
15
|
when Proc
|
16
16
|
@raw = capture { legend.call }
|
17
17
|
when Hash
|
@@ -23,7 +23,7 @@ module GOVUKDesignSystemFormBuilder
|
|
23
23
|
@caption = caption
|
24
24
|
end
|
25
25
|
else
|
26
|
-
fail(ArgumentError, %(legend must be a Proc or Hash))
|
26
|
+
fail(ArgumentError, %(legend must be a NilClass, Proc or Hash))
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -38,12 +38,18 @@ module GOVUKDesignSystemFormBuilder
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def content
|
41
|
-
return
|
41
|
+
return unless active?
|
42
42
|
|
43
|
-
tag.legend(class: classes, **@html_attributes)
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
tag.legend(legend_text, class: classes, **@html_attributes)
|
44
|
+
end
|
45
|
+
|
46
|
+
def legend_text
|
47
|
+
caption_and_text = safe_join([caption_element, @text])
|
48
|
+
|
49
|
+
if @tag.present?
|
50
|
+
content_tag(@tag, class: heading_classes) { caption_and_text }
|
51
|
+
else
|
52
|
+
caption_and_text
|
47
53
|
end
|
48
54
|
end
|
49
55
|
|
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.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -176,14 +176,14 @@ dependencies:
|
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 3.
|
179
|
+
version: 3.23.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.23.0
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: rubypants
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|