govuk_design_system_formbuilder 1.1.3 → 1.1.4

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: 822c524b38070bd3718e97837b302e5694a1583ef54fe912bde810b2c62714ea
4
- data.tar.gz: 77cff051fdafe108337e9087b5584c9a9ce8a278095568d9b54898002f8c7271
3
+ metadata.gz: 16ae05f4dde6930029fd81d58059802deb3c8e70692c8dd121c23c18994f4a4e
4
+ data.tar.gz: 79593ec5cb79765f9b42842c91093324da8f268db7d5d77393b716688217b5b5
5
5
  SHA512:
6
- metadata.gz: f79bf7bf920cba89a9d1e8a7766f72d86e97c684442f8094d34664b74e03da07c0033bf12b631f8f0ead1d8ca1b27bbefdbe9e946d6559e90209799eabd06490
7
- data.tar.gz: 0f875612abcb83f7e5e1792861586bd5877accd6b381ad8e20e9cc97484afb3fddeb7d9d5b7f30e4eb139dec47636e1fa5e7372c68f4d102cbe70c8a43fcadac
6
+ metadata.gz: 985674a13a6bd7cfe67213ea2447b3476dd6a4859b5cbac4566d3492e45d719aec8aa00ace8936cf701652396c81e1efac73b80948bceab98f02095a7edaa29c
7
+ data.tar.gz: fb2dbc8270bc4849683e5888bb29e83ce5f3bf609c91da13af778e5ae3142f8e8a86a70162d3ec458f76990ee71ddaa47daf338013938472dfb00660f6a1ff6f
@@ -238,6 +238,7 @@ module GOVUKDesignSystemFormBuilder
238
238
  # @param inline [Boolean] controls whether the radio buttons are displayed inline or not
239
239
  # @param small [Boolean] controls whether small radio buttons are used instead of regular-sized ones
240
240
  # @param bold_labels [Boolean] controls whether the radio button labels are bold
241
+ # @param classes [String] Classes to add to the radio button container.
241
242
  # @option legend text [String] the fieldset legend's text content
242
243
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
243
244
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+, defaults to +h1+
@@ -258,7 +259,7 @@ module GOVUKDesignSystemFormBuilder
258
259
  # legend: { text: 'Pick your favourite colour', size: 'm' },
259
260
  # hint_text: 'If you cannot find the exact match choose something close',
260
261
  # inline: false
261
- 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, &block)
262
+ 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)
262
263
  Elements::Radios::Collection.new(
263
264
  self,
264
265
  object_name,
@@ -272,6 +273,7 @@ module GOVUKDesignSystemFormBuilder
272
273
  inline: inline,
273
274
  small: small,
274
275
  bold_labels: bold_labels,
276
+ classes: classes,
275
277
  &block
276
278
  ).html
277
279
  end
@@ -289,6 +291,7 @@ module GOVUKDesignSystemFormBuilder
289
291
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
290
292
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
291
293
  # @param block [Block] a block of HTML that will be used to populate the fieldset
294
+ # @param classes [String] Classes to add to the radio button container.
292
295
  # @see https://design-system.service.gov.uk/components/radios/ GOV.UK Radios
293
296
  # @return [ActiveSupport::SafeBuffer] HTML output
294
297
  #
@@ -300,8 +303,8 @@ module GOVUKDesignSystemFormBuilder
300
303
  # = f.govuk_radio_divider
301
304
  # = f.govuk_radio_button :favourite_colour, :yellow, label: { text: 'Yellow' }
302
305
  #
303
- def govuk_radio_buttons_fieldset(attribute_name, hint_text: nil, legend: {}, inline: false, small: false, &block)
304
- Containers::RadioButtonsFieldset.new(self, object_name, attribute_name, hint_text: hint_text, legend: legend, inline: inline, small: small, &block).html
306
+ def govuk_radio_buttons_fieldset(attribute_name, hint_text: nil, legend: {}, inline: false, small: false, classes: nil, &block)
307
+ Containers::RadioButtonsFieldset.new(self, object_name, attribute_name, hint_text: hint_text, legend: legend, inline: inline, small: small, classes: classes, &block).html
305
308
  end
306
309
 
307
310
  # Generates a radio button
@@ -350,6 +353,7 @@ module GOVUKDesignSystemFormBuilder
350
353
  # When a +Proc+ is provided it must take a single argument that is a single member of the collection
351
354
  # @param hint_text [String] The content of the fieldset hint. No hint will be injected if left +nil+
352
355
  # @param small [Boolean] controls whether small check boxes are used instead of regular-sized ones
356
+ # @param classes [String] Classes to add to the checkbox container.
353
357
  # @param legend [Hash] options for configuring the legend
354
358
  # @option legend text [String] the fieldset legend's text content
355
359
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
@@ -371,8 +375,9 @@ module GOVUKDesignSystemFormBuilder
371
375
  # :description,
372
376
  # legend: { text: 'What do you want in your sandwich?', size: 'm' },
373
377
  # hint_text: "If it isn't listed here, tough luck",
374
- # inline: false
375
- def govuk_collection_check_boxes(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {}, small: false, &block)
378
+ # inline: false,
379
+ # classes: 'app-overflow-scroll',
380
+ def govuk_collection_check_boxes(attribute_name, collection, value_method, text_method, hint_method = nil, hint_text: nil, legend: {}, small: false, classes: nil, &block)
376
381
  Elements::CheckBoxes::Collection.new(
377
382
  self,
378
383
  object_name,
@@ -384,6 +389,7 @@ module GOVUKDesignSystemFormBuilder
384
389
  hint_text: hint_text,
385
390
  legend: legend,
386
391
  small: small,
392
+ classes: classes,
387
393
  &block
388
394
  ).html
389
395
  end
@@ -397,6 +403,7 @@ module GOVUKDesignSystemFormBuilder
397
403
  # @option legend text [String] the fieldset legend's text content
398
404
  # @option legend size [String] the size of the fieldset legend font, can be +xl+, +l+, +m+ or +s+
399
405
  # @option legend tag [Symbol,String] the tag used for the fieldset's header, defaults to +h1+
406
+ # @param classes [String] Classes to add to the checkbox container.
400
407
  # @param block [Block] a block of HTML that will be used to populate the fieldset
401
408
  # @return [ActiveSupport::SafeBuffer] HTML output
402
409
  #
@@ -406,7 +413,7 @@ module GOVUKDesignSystemFormBuilder
406
413
  # = f.govuk_check_box :desired_filling, :cheese, label: { text: 'Cheese' }, link_errors: true
407
414
  # = f.govuk_check_box :desired_filling, :tomato, label: { text: 'Tomato' }
408
415
  #
409
- def govuk_check_boxes_fieldset(attribute_name, legend: {}, hint_text: {}, small: false, &block)
416
+ def govuk_check_boxes_fieldset(attribute_name, legend: {}, hint_text: {}, small: false, classes: nil, &block)
410
417
  Containers::CheckBoxesFieldset.new(
411
418
  self,
412
419
  object_name,
@@ -414,6 +421,7 @@ module GOVUKDesignSystemFormBuilder
414
421
  hint_text: hint_text,
415
422
  legend: legend,
416
423
  small: small,
424
+ classes: classes,
417
425
  &block
418
426
  ).html
419
427
  end
@@ -1,9 +1,10 @@
1
1
  module GOVUKDesignSystemFormBuilder
2
2
  module Containers
3
3
  class CheckBoxes < Base
4
- def initialize(builder, small:)
4
+ def initialize(builder, small:, classes: nil)
5
5
  @builder = builder
6
6
  @small = small
7
+ @classes = classes
7
8
  end
8
9
 
9
10
  def html
@@ -17,6 +18,7 @@ module GOVUKDesignSystemFormBuilder
17
18
  def check_boxes_classes
18
19
  %w(govuk-checkboxes).tap do |c|
19
20
  c.push('govuk-checkboxes--small') if @small
21
+ c.push(@classes) if @classes
20
22
  end
21
23
  end
22
24
  end
@@ -4,12 +4,13 @@ module GOVUKDesignSystemFormBuilder
4
4
  include Traits::Error
5
5
  include Traits::Hint
6
6
 
7
- def initialize(builder, object_name, attribute_name, hint_text:, legend:, small:, &block)
7
+ def initialize(builder, object_name, attribute_name, hint_text:, legend:, small:, classes:, &block)
8
8
  super(builder, object_name, attribute_name, &block)
9
9
 
10
10
  @legend = legend
11
11
  @hint_text = hint_text
12
12
  @small = small
13
+ @classes = classes
13
14
  @block_content = capture { block.call }
14
15
  end
15
16
 
@@ -20,7 +21,7 @@ module GOVUKDesignSystemFormBuilder
20
21
  [
21
22
  hint_element.html,
22
23
  error_element.html,
23
- Containers::CheckBoxes.new(@builder, small: @small).html do
24
+ Containers::CheckBoxes.new(@builder, small: @small, classes: @classes).html do
24
25
  @block_content
25
26
  end
26
27
  ]
@@ -4,13 +4,14 @@ module GOVUKDesignSystemFormBuilder
4
4
  include Traits::Hint
5
5
  include Traits::Error
6
6
 
7
- def initialize(builder, object_name, attribute_name, hint_text:, legend:, inline:, small:, &block)
7
+ def initialize(builder, object_name, attribute_name, hint_text:, legend:, inline:, small:, classes:, &block)
8
8
  super(builder, object_name, attribute_name)
9
9
 
10
10
  @inline = inline
11
11
  @small = small
12
12
  @legend = legend
13
13
  @hint_text = hint_text
14
+ @classes = classes
14
15
  @block_content = capture { block.call }
15
16
  end
16
17
 
@@ -21,7 +22,7 @@ module GOVUKDesignSystemFormBuilder
21
22
  [
22
23
  hint_element.html,
23
24
  error_element.html,
24
- Containers::Radios.new(@builder, inline: @inline, small: @small).html do
25
+ Containers::Radios.new(@builder, inline: @inline, small: @small, classes: @classes).html do
25
26
  @block_content
26
27
  end
27
28
  ]
@@ -3,10 +3,11 @@ module GOVUKDesignSystemFormBuilder
3
3
  class Radios < Base
4
4
  include Traits::Hint
5
5
 
6
- def initialize(builder, inline:, small:)
6
+ def initialize(builder, inline:, small:, classes:)
7
7
  @builder = builder
8
8
  @inline = inline
9
9
  @small = small
10
+ @classes = classes
10
11
  end
11
12
 
12
13
  def html
@@ -21,6 +22,7 @@ module GOVUKDesignSystemFormBuilder
21
22
  %w(govuk-radios).tap do |c|
22
23
  c.push('govuk-radios--inline') if @inline
23
24
  c.push('govuk-radios--small') if @small
25
+ c.push(@classes) if @classes
24
26
  end
25
27
  end
26
28
  end
@@ -6,7 +6,7 @@ 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_method: nil, hint_text:, legend:, small:, &block)
9
+ def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint_method: nil, hint_text:, legend:, small:, classes:, &block)
10
10
  super(builder, object_name, attribute_name, &block)
11
11
 
12
12
  @collection = collection
@@ -16,6 +16,7 @@ module GOVUKDesignSystemFormBuilder
16
16
  @small = small
17
17
  @legend = legend
18
18
  @hint_text = hint_text
19
+ @classes = classes
19
20
  end
20
21
 
21
22
  def html
@@ -26,7 +27,7 @@ module GOVUKDesignSystemFormBuilder
26
27
  hint_element.html,
27
28
  error_element.html,
28
29
  supplemental_content.html,
29
- Containers::CheckBoxes.new(@builder, small: @small).html do
30
+ Containers::CheckBoxes.new(@builder, small: @small, classes: @classes).html do
30
31
  build_collection
31
32
  end
32
33
  ]
@@ -6,7 +6,7 @@ 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_method:, hint_text:, legend:, inline:, small:, bold_labels:, &block)
9
+ def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint_method:, hint_text:, legend:, inline:, small:, bold_labels:, classes:, &block)
10
10
  super(builder, object_name, attribute_name, &block)
11
11
 
12
12
  @collection = collection
@@ -17,6 +17,7 @@ module GOVUKDesignSystemFormBuilder
17
17
  @small = small
18
18
  @legend = legend
19
19
  @hint_text = hint_text
20
+ @classes = classes
20
21
  @bold_labels = hint_method.present? || bold_labels
21
22
  end
22
23
 
@@ -28,7 +29,7 @@ module GOVUKDesignSystemFormBuilder
28
29
  hint_element.html,
29
30
  error_element.html,
30
31
  supplemental_content.html,
31
- Containers::Radios.new(@builder, inline: @inline, small: @small).html do
32
+ Containers::Radios.new(@builder, inline: @inline, small: @small, classes: @classes).html do
32
33
  safe_join(build_collection)
33
34
  end
34
35
  ]
@@ -1,3 +1,3 @@
1
1
  module GOVUKDesignSystemFormBuilder
2
- VERSION = '1.1.3'.freeze
2
+ VERSION = '1.1.4'.freeze
3
3
  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: 1.1.3
4
+ version: 1.1.4
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-01-21 00:00:00.000000000 Z
11
+ date: 2020-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -204,14 +204,14 @@ dependencies:
204
204
  requirements:
205
205
  - - "~>"
206
206
  - !ruby/object:Gem::Version
207
- version: 3.14.0
207
+ version: 3.15.0
208
208
  type: :development
209
209
  prerelease: false
210
210
  version_requirements: !ruby/object:Gem::Requirement
211
211
  requirements:
212
212
  - - "~>"
213
213
  - !ruby/object:Gem::Version
214
- version: 3.14.0
214
+ version: 3.15.0
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: rubypants
217
217
  requirement: !ruby/object:Gem::Requirement