govuk_design_system_formbuilder 1.2.2 → 1.2.3
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: b04804863d4a75157988de721c6fda535eb35df444b8a99a8830b7b9758f8e03
|
4
|
+
data.tar.gz: 162d14ae3760447cf707bc89195daa2a66ca104265258d751b1082325ed56aa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71814ceeaf1bb257102a0b4f3e04675bf44aa10a3b85837420d30295bf1b77e9f63c6498dc6d0a8560c5cfb7abcecd7ec057d7ce73a7b2f0f682849eae71a7ba
|
7
|
+
data.tar.gz: 16d9e596f3a56b25a5413aed0b996d1965cd0be1a2fb6653217cea9b41b1334f9918a75f71ea0f6ba51844b617bd0a2a3a0686c4c8fb34f05b999afce50f8f67
|
@@ -14,6 +14,9 @@ module GOVUKDesignSystemFormBuilder
|
|
14
14
|
# * +:brand+ sets the value used to prefix all classes, used to allow the
|
15
15
|
# builder to be branded for alternative (similar) design systems.
|
16
16
|
#
|
17
|
+
# * +:default_caption_size+ controls the default size of caption text.
|
18
|
+
# Can be either +xl+, +l+ or +m+.
|
19
|
+
#
|
17
20
|
# * +:default_legend_size+ controls the default size of legend text.
|
18
21
|
# Can be either +xl+, +l+, +m+ or +s+.
|
19
22
|
#
|
@@ -45,6 +48,7 @@ module GOVUKDesignSystemFormBuilder
|
|
45
48
|
|
46
49
|
default_legend_size: 'm',
|
47
50
|
default_legend_tag: 'h1',
|
51
|
+
default_caption_size: 'm',
|
48
52
|
default_submit_button_text: 'Continue',
|
49
53
|
default_radio_divider_text: 'or',
|
50
54
|
default_error_summary_title: 'There is a problem',
|
@@ -3,7 +3,7 @@ module GOVUKDesignSystemFormBuilder
|
|
3
3
|
class Caption < Base
|
4
4
|
include Traits::Localisation
|
5
5
|
|
6
|
-
def initialize(builder, object_name, attribute_name, text:, size:
|
6
|
+
def initialize(builder, object_name, attribute_name, text:, size: nil)
|
7
7
|
super(builder, object_name, attribute_name)
|
8
8
|
|
9
9
|
@text = caption_text(text)
|
@@ -21,7 +21,7 @@ module GOVUKDesignSystemFormBuilder
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def caption_size_class(size)
|
24
|
-
case size
|
24
|
+
case size || config.default_caption_size
|
25
25
|
when 'xl' then %(#{brand}-caption-xl)
|
26
26
|
when 'l' then %(#{brand}-caption-l)
|
27
27
|
when 'm' then %(#{brand}-caption-m)
|
@@ -39,7 +39,7 @@ module GOVUKDesignSystemFormBuilder
|
|
39
39
|
|
40
40
|
def label
|
41
41
|
@builder.label(@attribute_name, label_options) do
|
42
|
-
@content || safe_join([
|
42
|
+
@content || safe_join([caption, @text])
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -61,6 +61,10 @@ module GOVUKDesignSystemFormBuilder
|
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
64
|
+
def caption
|
65
|
+
caption_element.html unless [@radio_class, @checkbox_class].any?
|
66
|
+
end
|
67
|
+
|
64
68
|
def radio_class(radio)
|
65
69
|
radio ? %(#{brand}-radios__label) : nil
|
66
70
|
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.2.
|
4
|
+
version: 1.2.3
|
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-06-
|
11
|
+
date: 2020-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|