govuk_design_system_formbuilder 5.3.0 → 5.3.1

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: 8e35d673c28b60b7f821d646ce2386de839de096525d8689104b1d972e7cbd41
4
- data.tar.gz: 59cdb7f48b6d6540e281d2c2953d87c9a54fb570415be01cf5f68d0a15db57c9
3
+ metadata.gz: 51a139b376822ea5bfdbeef995d5b8daef3d0a67fa6d035165253dbfafe2496f
4
+ data.tar.gz: 8a2a50e44d2ecf48edba85535cf876f95fc6a22f89188a219edba6c97570f5eb
5
5
  SHA512:
6
- metadata.gz: 97062bf75bb33fd65e0e2b82a916f020164274ab4e9920eebbc56bdc7e392708e5fdd2570c5e7b6627a5cdb7c54156dc2ebe6c4ade09af67815122dbe00c0b46
7
- data.tar.gz: dfb265e232f555c33fc432c15fe84e2a04386ebf2f2a8946fb691c5f64be323ecf2e5c6484d35a0e1697a82fc67c84fdfbaa0f1a31972356a12c74484de0be69
6
+ metadata.gz: 6c1052d946ea83b6d301c1acf02e6c9b6f8da14fd70409ef91bd0908d47fc57e25e130e214e12b0fa22fb7fe63adf85b809a76d8f78708f4e1da12990bfa0fd2
7
+ data.tar.gz: b543d521fe7fd10597942fc70c8a45513d876e28a624e3064f51d6e7a303031cec3e5e01e66e399717eacae5a1a714fcc0fb4c3c4981ffb62ac3edd18a33a2a9
@@ -8,7 +8,6 @@ module GOVUKDesignSystemFormBuilder
8
8
  include Traits::Supplemental
9
9
  include Traits::HTMLClasses
10
10
 
11
- SEGMENTS = { day: '3i', month: '2i', year: '1i' }.freeze
12
11
  MULTIPARAMETER_KEY = { day: 3, month: 2, year: 1 }.freeze
13
12
 
14
13
  def initialize(builder, object_name, attribute_name, legend:, caption:, hint:, omit_day:, maxlength_enabled:, form_group:, date_of_birth: false, **kwargs, &block)
@@ -34,6 +33,10 @@ module GOVUKDesignSystemFormBuilder
34
33
 
35
34
  private
36
35
 
36
+ def segments
37
+ config.default_date_segments
38
+ end
39
+
37
40
  def fieldset_options
38
41
  { legend: @legend, caption: @caption, described_by: [error_id, hint_id, supplemental_id] }
39
42
  end
@@ -136,7 +139,7 @@ module GOVUKDesignSystemFormBuilder
136
139
  if has_errors? && link_errors
137
140
  field_id(link_errors:)
138
141
  else
139
- [@object_name, @attribute_name, SEGMENTS.fetch(segment)].join("_")
142
+ [@object_name, @attribute_name, segments.fetch(segment)].join("_")
140
143
  end
141
144
  end
142
145
 
@@ -145,7 +148,7 @@ module GOVUKDesignSystemFormBuilder
145
148
  "%<object_name>s[%<input_name>s(%<segment>s)]",
146
149
  object_name: @object_name,
147
150
  input_name: @attribute_name,
148
- segment: SEGMENTS.fetch(segment)
151
+ segment: segments.fetch(segment)
149
152
  )
150
153
  end
151
154
 
@@ -1,3 +1,3 @@
1
1
  module GOVUKDesignSystemFormBuilder
2
- VERSION = '5.3.0'.freeze
2
+ VERSION = '5.3.1'.freeze
3
3
  end
@@ -27,16 +27,17 @@ module GOVUKDesignSystemFormBuilder
27
27
  # * +:default_submit_button_text+ sets the value assigned to +govuk_submit+,
28
28
  # defaults to 'Continue'.
29
29
  #
30
+ # * +:default_date_segments+ allows the date segments used by Rails'
31
+ # multiparameter attributes to be configured. This is useful if you want to
32
+ # override the standard behaviour where Rails tries to cast the values
33
+ # into a +Date+. Defaults to +{ day: '3i', month: '2i', year: '1i' }+
34
+ #
30
35
  # * +:default_radio_divider_text+ sets the text automatically added to the
31
36
  # radio button divider, defaults to 'or'
32
37
  #
33
38
  # * +:default_check_box_divider_text+ sets the text automatically added to the
34
39
  # checkbox divider, defaults to 'or'
35
40
  #
36
- # * +:default_submit_button_text+ sets the text used to divide the last radio
37
- # button in radio button fieldsets. As per the GOV.UK Design System spec,
38
- # it defaults to 'or'.
39
- #
40
41
  # * +:default_collection_check_boxes_include_hidden+ controls whether or not
41
42
  # a hidden field is added when rendering a collection of check boxes
42
43
  #
@@ -92,6 +93,7 @@ module GOVUKDesignSystemFormBuilder
92
93
  default_legend_tag: nil,
93
94
  default_caption_size: 'm',
94
95
  default_submit_button_text: 'Continue',
96
+ default_date_segments: { day: '3i', month: '2i', year: '1i' },
95
97
  default_radio_divider_text: 'or',
96
98
  default_check_box_divider_text: 'or',
97
99
  default_error_summary_title: 'There is a problem',
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: 5.3.0
4
+ version: 5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Yates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-28 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 4.14.0
137
+ version: 4.16.0
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: 4.14.0
144
+ version: 4.16.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: simplecov
147
147
  requirement: !ruby/object:Gem::Requirement