govuk_design_system_formbuilder 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/govuk_design_system_formbuilder/builder.rb +3 -3
- data/lib/govuk_design_system_formbuilder/containers/button_group.rb +15 -0
- data/lib/govuk_design_system_formbuilder/elements/submit.rb +10 -6
- data/lib/govuk_design_system_formbuilder/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c234131d78ff639d142f65d670b23876a8fb38eddea46a83e21aeb3d9f6daa2
|
4
|
+
data.tar.gz: 211981c7246de88afb294f72a06b6e0432f2e5f38f26449b43d7c5fc87f36c7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd8d23e033c5ca4770b258c12b6ac59eca551da6c55838f5bf76ceeb98549ce8beb7ebd3c0c412942687aa60ad9596e96dc6324b783a262f3d02028bc5862298
|
7
|
+
data.tar.gz: 482d6efa88f4b02b305f51b5e897550e076390ccb69281d4ae533d043e9761b341078ec4f06943bf6f8582c37b906a5c902e84eeca4b6e42000ed3ba349878c8
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
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.11.0-brightgreen)](https://design-system.service.gov.uk)
|
11
11
|
[![Rails](https://img.shields.io/badge/Ruby-2.5.8%20%E2%95%B1%202.6.6%20%E2%95%B1%202.7.2-E16D6D)](https://weblog.rubyonrails.org/releases/)
|
12
12
|
[![Ruby](https://img.shields.io/badge/Rails-5.2.4%20%E2%95%B1%206.0.3%20%E2%95%B1%206.1.0-E16D6D)](https://www.ruby-lang.org/en/downloads/)
|
13
13
|
|
@@ -811,9 +811,9 @@ module GOVUKDesignSystemFormBuilder
|
|
811
811
|
# client-side validation provided by the browser. This is to provide a more consistent and accessible user
|
812
812
|
# experience
|
813
813
|
# @param disabled [Boolean] makes the button disabled when true
|
814
|
-
# @param block [Block]
|
815
|
-
#
|
816
|
-
#
|
814
|
+
# @param block [Block] When content is passed in via a block the submit element and the block content will
|
815
|
+
# be wrapped in a +<div class="govuk-button-group">+ which will space the buttons and links within
|
816
|
+
# evenly.
|
817
817
|
# @raise [ArgumentError] raised if both +warning+ and +secondary+ are true
|
818
818
|
# @return [ActiveSupport::SafeBuffer] HTML output
|
819
819
|
# @note Only the first additional button or link (passed in via a block) will be given the
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GOVUKDesignSystemFormBuilder
|
2
|
+
module Containers
|
3
|
+
class ButtonGroup < Base
|
4
|
+
def initialize(builder, buttons)
|
5
|
+
super(builder, nil, nil)
|
6
|
+
|
7
|
+
@buttons = buttons
|
8
|
+
end
|
9
|
+
|
10
|
+
def html
|
11
|
+
tag.div(@buttons, class: %(#{brand}-button-group))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -19,11 +19,19 @@ module GOVUKDesignSystemFormBuilder
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def html
|
22
|
-
|
22
|
+
@block_content.present? ? button_group : buttons
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
+
def buttons
|
28
|
+
safe_join([submit, @block_content])
|
29
|
+
end
|
30
|
+
|
31
|
+
def button_group
|
32
|
+
Containers::ButtonGroup.new(@builder, buttons).html
|
33
|
+
end
|
34
|
+
|
27
35
|
def submit
|
28
36
|
@builder.submit(@text, class: classes, **options)
|
29
37
|
end
|
@@ -31,7 +39,7 @@ module GOVUKDesignSystemFormBuilder
|
|
31
39
|
def classes
|
32
40
|
%w(button)
|
33
41
|
.prefix(brand)
|
34
|
-
.push(warning_class, secondary_class, disabled_class,
|
42
|
+
.push(warning_class, secondary_class, disabled_class, custom_classes)
|
35
43
|
.flatten
|
36
44
|
.compact
|
37
45
|
end
|
@@ -55,10 +63,6 @@ module GOVUKDesignSystemFormBuilder
|
|
55
63
|
%(#{brand}-button--secondary) if @secondary
|
56
64
|
end
|
57
65
|
|
58
|
-
def padding_class
|
59
|
-
%(#{brand}-!-margin-right-1) if @block_content
|
60
|
-
end
|
61
|
-
|
62
66
|
def disabled_class
|
63
67
|
%(#{brand}-button--disabled) if @disabled
|
64
68
|
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.1.
|
4
|
+
version: 2.1.8
|
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-
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- lib/govuk_design_system_formbuilder.rb
|
253
253
|
- lib/govuk_design_system_formbuilder/base.rb
|
254
254
|
- lib/govuk_design_system_formbuilder/builder.rb
|
255
|
+
- lib/govuk_design_system_formbuilder/containers/button_group.rb
|
255
256
|
- lib/govuk_design_system_formbuilder/containers/character_count.rb
|
256
257
|
- lib/govuk_design_system_formbuilder/containers/check_boxes.rb
|
257
258
|
- lib/govuk_design_system_formbuilder/containers/check_boxes_fieldset.rb
|