govuk_design_system_formbuilder 2.1.8 → 2.1.9
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: 11458ddeca1cf3fba55781a8c7dfdb0eb682ac519d754b052c54cbae578d5033
|
4
|
+
data.tar.gz: 731aa5873f7bc488c87c97529ea631651ecb36f3a7283693d7ccf01faec8701f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ce8f19c89c96735199b288730141ba152a008786da44cd16455cd74bbed4bc456d0f1fce3ec173a4898b2606efba41e97543e46aaef93632bacbf8ccbf7e905
|
7
|
+
data.tar.gz: 45ec83ef9865b634293748a79b91858ad6d85f06c4680b52abbebaef5429ddf079fd810ed6a5b0ba45d45f9a91c879d83993a9ad540786e803b00bf70ae10bd9
|
@@ -34,6 +34,12 @@ module GOVUKDesignSystemFormBuilder
|
|
34
34
|
# blocks. As per the GOV.UK Design System spec, it defaults to
|
35
35
|
# 'There is a problem'.
|
36
36
|
#
|
37
|
+
# * +:default_collection_check_boxes_include_hidden+ controls whether or not
|
38
|
+
# a hidden field is added when rendering a collection of check boxes
|
39
|
+
#
|
40
|
+
# * +:default_collection_radio_buttons_include_hidden+ controls whether or not
|
41
|
+
# a hidden field is added when rendering a collection of radio buttons
|
42
|
+
#
|
37
43
|
# * +:localisation_schema_fallback+ sets the prefix elements for the array
|
38
44
|
# used to build the localisation string. The final two elements are always
|
39
45
|
# are the object name and attribute name. The _special_ value +__context__+,
|
@@ -52,6 +58,8 @@ module GOVUKDesignSystemFormBuilder
|
|
52
58
|
default_submit_button_text: 'Continue',
|
53
59
|
default_radio_divider_text: 'or',
|
54
60
|
default_error_summary_title: 'There is a problem',
|
61
|
+
default_collection_check_boxes_include_hidden: true,
|
62
|
+
default_collection_radio_buttons_include_hidden: true,
|
55
63
|
|
56
64
|
localisation_schema_fallback: %i(helpers __context__),
|
57
65
|
localisation_schema_label: nil,
|
@@ -501,7 +501,7 @@ module GOVUKDesignSystemFormBuilder
|
|
501
501
|
# :name,
|
502
502
|
# legend: -> { tag.h3('Which category do you belong to?') }
|
503
503
|
#
|
504
|
-
def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method = nil, hint_method = nil, hint: {}, legend: {}, caption: {}, inline: false, small: false, bold_labels: false, classes: nil, include_hidden:
|
504
|
+
def govuk_collection_radio_buttons(attribute_name, collection, value_method, text_method = nil, hint_method = nil, hint: {}, legend: {}, caption: {}, inline: false, small: false, bold_labels: false, classes: nil, include_hidden: config.default_collection_radio_buttons_include_hidden, form_group: {}, &block)
|
505
505
|
Elements::Radios::Collection.new(
|
506
506
|
self,
|
507
507
|
object_name,
|
@@ -646,6 +646,7 @@ module GOVUKDesignSystemFormBuilder
|
|
646
646
|
# @param form_group [Hash] configures the form group
|
647
647
|
# @option form_group classes [Array,String] sets the form group's classes
|
648
648
|
# @option form_group kwargs [Hash] additional attributes added to the form group
|
649
|
+
# @param include_hidden [Boolean] controls whether a hidden field is inserted to allow for empty submissions
|
649
650
|
# @param block [Block] any HTML passed in will be injected into the fieldset, after the hint and before the checkboxes
|
650
651
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
651
652
|
#
|
@@ -682,7 +683,7 @@ module GOVUKDesignSystemFormBuilder
|
|
682
683
|
# :name,
|
683
684
|
# legend: -> { tag.h3('What kind of sandwich do you want?') }
|
684
685
|
#
|
685
|
-
def govuk_collection_check_boxes(attribute_name, collection, value_method, text_method, hint_method = nil, hint: {}, legend: {}, caption: {}, small: false, classes: nil, form_group: {}, &block)
|
686
|
+
def govuk_collection_check_boxes(attribute_name, collection, value_method, text_method, hint_method = nil, hint: {}, legend: {}, caption: {}, small: false, classes: nil, form_group: {}, include_hidden: config.default_collection_check_boxes_include_hidden, &block)
|
686
687
|
Elements::CheckBoxes::Collection.new(
|
687
688
|
self,
|
688
689
|
object_name,
|
@@ -697,6 +698,7 @@ module GOVUKDesignSystemFormBuilder
|
|
697
698
|
small: small,
|
698
699
|
classes: classes,
|
699
700
|
form_group: form_group,
|
701
|
+
include_hidden: include_hidden,
|
700
702
|
&block
|
701
703
|
).html
|
702
704
|
end
|
@@ -6,19 +6,20 @@ module GOVUKDesignSystemFormBuilder
|
|
6
6
|
include Traits::Hint
|
7
7
|
include Traits::Supplemental
|
8
8
|
|
9
|
-
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint:, legend:, caption:, small:, classes:, form_group:, hint_method: nil, &block)
|
9
|
+
def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint:, legend:, caption:, small:, classes:, form_group:, include_hidden:, hint_method: nil, &block)
|
10
10
|
super(builder, object_name, attribute_name, &block)
|
11
11
|
|
12
|
-
@collection
|
13
|
-
@value_method
|
14
|
-
@text_method
|
15
|
-
@hint_method
|
16
|
-
@small
|
17
|
-
@legend
|
18
|
-
@caption
|
19
|
-
@hint
|
20
|
-
@classes
|
21
|
-
@form_group
|
12
|
+
@collection = collection
|
13
|
+
@value_method = value_method
|
14
|
+
@text_method = text_method
|
15
|
+
@hint_method = hint_method
|
16
|
+
@small = small
|
17
|
+
@legend = legend
|
18
|
+
@caption = caption
|
19
|
+
@hint = hint
|
20
|
+
@classes = classes
|
21
|
+
@form_group = form_group
|
22
|
+
@include_hidden = include_hidden
|
22
23
|
end
|
23
24
|
|
24
25
|
def html
|
@@ -56,7 +57,7 @@ module GOVUKDesignSystemFormBuilder
|
|
56
57
|
def collection
|
57
58
|
link_errors = has_errors?
|
58
59
|
|
59
|
-
@builder.collection_check_boxes(@attribute_name, @collection, @value_method, @text_method) do |check_box|
|
60
|
+
@builder.collection_check_boxes(@attribute_name, @collection, @value_method, @text_method, include_hidden: @include_hidden) do |check_box|
|
60
61
|
Elements::CheckBoxes::CollectionCheckBox.new(
|
61
62
|
@builder,
|
62
63
|
@object_name,
|
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.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|