govuk_design_system_formbuilder 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/govuk_design_system_formbuilder.rb +1 -1
- data/lib/govuk_design_system_formbuilder/base.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/character_count.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/check_boxes.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/fieldset.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/form_group.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/radios.rb +1 -1
- data/lib/govuk_design_system_formbuilder/containers/supplemental.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/check_boxes/collection_check_box.rb +1 -3
- data/lib/govuk_design_system_formbuilder/elements/check_boxes/fieldset_check_box.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/date.rb +3 -3
- data/lib/govuk_design_system_formbuilder/elements/error_message.rb +3 -3
- data/lib/govuk_design_system_formbuilder/elements/error_summary.rb +3 -3
- data/lib/govuk_design_system_formbuilder/elements/inputs/email.rb +0 -2
- data/lib/govuk_design_system_formbuilder/elements/inputs/number.rb +0 -2
- data/lib/govuk_design_system_formbuilder/elements/inputs/password.rb +0 -2
- data/lib/govuk_design_system_formbuilder/elements/inputs/phone.rb +0 -2
- data/lib/govuk_design_system_formbuilder/elements/inputs/text.rb +0 -2
- data/lib/govuk_design_system_formbuilder/elements/inputs/url.rb +0 -2
- data/lib/govuk_design_system_formbuilder/elements/label.rb +2 -2
- data/lib/govuk_design_system_formbuilder/elements/legend.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/radios/collection_radio_button.rb +2 -4
- data/lib/govuk_design_system_formbuilder/elements/radios/fieldset_radio_button.rb +1 -1
- data/lib/govuk_design_system_formbuilder/elements/text_area.rb +10 -10
- data/lib/govuk_design_system_formbuilder/traits/conditional.rb +1 -1
- data/lib/govuk_design_system_formbuilder/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73f7852a0c839a3c662b7c5551c2e3e96d37c32fde6af4ad861cfd37f8c0d79f
|
4
|
+
data.tar.gz: 3252d8a1c64a4457de52ad87c2a7c9e5945b7400e7ee279c8e3910ee8f4a0cc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dd6efdac09f58e06bb8241aacc420bfb016960320cbbf4c9496ed163a5f2ff1f63c79d5f5dca381b7da4f5efa5c75997a8a10542755de3f8a67adb19393756e
|
7
|
+
data.tar.gz: b8ea6181c35e29784d8ebcb00bdb1a9d32d5970b26d260336413aaa8b475bee0a7ff085b64e05cb385014563ea7fb8799847c59d2408726a1fdd5b733b55b844
|
data/README.md
CHANGED
@@ -7,10 +7,10 @@
|
|
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.8.
|
10
|
+
[![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.8.1-brightgreen)](https://design-system.service.gov.uk)
|
11
11
|
|
12
12
|
This gem provides a easy-to-use form builder that generates forms that are
|
13
|
-
fully-compliant with version 3.8.
|
13
|
+
fully-compliant with version 3.8.1 of the [GOV.UK Design System](https://design-system.service.gov.uk/),
|
14
14
|
minimising the amount of markup you need to write.
|
15
15
|
|
16
16
|
In addition to the basic markup, the more-advanced functionality of the Design
|
@@ -88,7 +88,7 @@ module GOVUKDesignSystemFormBuilder
|
|
88
88
|
end
|
89
89
|
|
90
90
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
91
|
-
delegate :content_tag, :tag, :safe_join, :
|
91
|
+
delegate :content_tag, :tag, :safe_join, :link_to, :capture, to: :@template
|
92
92
|
|
93
93
|
include GOVUKDesignSystemFormBuilder::Builder
|
94
94
|
end
|
@@ -8,7 +8,7 @@ module GOVUKDesignSystemFormBuilder
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class Base
|
11
|
-
delegate :
|
11
|
+
delegate :content_tag, :safe_join, :tag, :link_to, :capture, to: :@builder
|
12
12
|
delegate :config, to: GOVUKDesignSystemFormBuilder
|
13
13
|
|
14
14
|
def initialize(builder, object_name, attribute_name, &block)
|
@@ -2,8 +2,6 @@ module GOVUKDesignSystemFormBuilder
|
|
2
2
|
module Elements
|
3
3
|
module CheckBoxes
|
4
4
|
class CollectionCheckBox < Base
|
5
|
-
using PrefixableArray
|
6
|
-
|
7
5
|
include Traits::CollectionItem
|
8
6
|
include Traits::Hint
|
9
7
|
|
@@ -18,7 +16,7 @@ module GOVUKDesignSystemFormBuilder
|
|
18
16
|
end
|
19
17
|
|
20
18
|
def html
|
21
|
-
|
19
|
+
tag.div(class: %(#{brand}-checkboxes__item)) do
|
22
20
|
safe_join([check_box, label_element, hint_element])
|
23
21
|
end
|
24
22
|
end
|
@@ -35,7 +35,7 @@ module GOVUKDesignSystemFormBuilder
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def date
|
38
|
-
|
38
|
+
tag.div(class: %(#{brand}-date-input)) do
|
39
39
|
safe_join([day, month, year])
|
40
40
|
end
|
41
41
|
end
|
@@ -61,8 +61,8 @@ module GOVUKDesignSystemFormBuilder
|
|
61
61
|
def date_part(segment, width:, link_errors: false)
|
62
62
|
value = @builder.object.try(@attribute_name).try(segment)
|
63
63
|
|
64
|
-
|
65
|
-
|
64
|
+
tag.div(class: %(#{brand}-date-input__item)) do
|
65
|
+
tag.div(class: %(#{brand}-form-group)) do
|
66
66
|
safe_join([label(segment, link_errors), input(segment, link_errors, width, value)])
|
67
67
|
end
|
68
68
|
end
|
@@ -12,14 +12,14 @@ module GOVUKDesignSystemFormBuilder
|
|
12
12
|
def html
|
13
13
|
return nil unless has_errors?
|
14
14
|
|
15
|
-
|
16
|
-
safe_join([
|
15
|
+
tag.span(class: %(#{brand}-error-message), id: error_id) do
|
16
|
+
safe_join([hidden_prefix, message])
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def
|
22
|
+
def hidden_prefix
|
23
23
|
tag.span('Error: ', class: %(#{brand}-visually-hidden))
|
24
24
|
end
|
25
25
|
|
@@ -12,7 +12,7 @@ module GOVUKDesignSystemFormBuilder
|
|
12
12
|
def html
|
13
13
|
return nil unless object_has_errors?
|
14
14
|
|
15
|
-
|
15
|
+
tag.div(class: summary_class, **summary_options) do
|
16
16
|
safe_join([title, summary])
|
17
17
|
end
|
18
18
|
end
|
@@ -24,8 +24,8 @@ module GOVUKDesignSystemFormBuilder
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def summary
|
27
|
-
|
28
|
-
|
27
|
+
tag.div(class: summary_class('body')) do
|
28
|
+
tag.ul(class: [%(#{brand}-list), summary_class('list')]) do
|
29
29
|
safe_join(list)
|
30
30
|
end
|
31
31
|
end
|
@@ -44,10 +44,10 @@ module GOVUKDesignSystemFormBuilder
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def retrieve_text(option_text, hidden)
|
47
|
-
text = [option_text, localised_text(:label), @attribute_name.capitalize].compact.first
|
47
|
+
text = [option_text, localised_text(:label), @attribute_name.capitalize].compact.first
|
48
48
|
|
49
49
|
if hidden
|
50
|
-
tag.span(text, class: %
|
50
|
+
tag.span(text, class: %(#{brand}-visually-hidden))
|
51
51
|
else
|
52
52
|
text
|
53
53
|
end
|
@@ -2,8 +2,6 @@ module GOVUKDesignSystemFormBuilder
|
|
2
2
|
module Elements
|
3
3
|
module Radios
|
4
4
|
class CollectionRadioButton < Base
|
5
|
-
using PrefixableArray
|
6
|
-
|
7
5
|
include Traits::Hint
|
8
6
|
include Traits::CollectionItem
|
9
7
|
|
@@ -23,7 +21,7 @@ module GOVUKDesignSystemFormBuilder
|
|
23
21
|
end
|
24
22
|
|
25
23
|
def html
|
26
|
-
|
24
|
+
tag.div(class: %(#{brand}-radios__item)) do
|
27
25
|
safe_join([radio, label_element, hint_element])
|
28
26
|
end
|
29
27
|
end
|
@@ -38,7 +36,7 @@ module GOVUKDesignSystemFormBuilder
|
|
38
36
|
{
|
39
37
|
id: field_id(link_errors: @link_errors),
|
40
38
|
aria: { describedby: hint_id },
|
41
|
-
class: %
|
39
|
+
class: %(#{brand}-radios__input)
|
42
40
|
}
|
43
41
|
end
|
44
42
|
|
@@ -11,15 +11,15 @@ module GOVUKDesignSystemFormBuilder
|
|
11
11
|
def initialize(builder, object_name, attribute_name, hint_text:, label:, caption:, rows:, max_words:, max_chars:, threshold:, form_group_classes:, **kwargs, &block)
|
12
12
|
super(builder, object_name, attribute_name, &block)
|
13
13
|
|
14
|
-
@label
|
15
|
-
@caption
|
16
|
-
@hint_text
|
17
|
-
@max_words
|
18
|
-
@max_chars
|
19
|
-
@threshold
|
20
|
-
@rows
|
14
|
+
@label = label
|
15
|
+
@caption = caption
|
16
|
+
@hint_text = hint_text
|
17
|
+
@max_words = max_words
|
18
|
+
@max_chars = max_chars
|
19
|
+
@threshold = threshold
|
20
|
+
@rows = rows
|
21
21
|
@form_group_classes = form_group_classes
|
22
|
-
@html_attributes
|
22
|
+
@html_attributes = kwargs
|
23
23
|
end
|
24
24
|
|
25
25
|
def html
|
@@ -42,7 +42,7 @@ module GOVUKDesignSystemFormBuilder
|
|
42
42
|
|
43
43
|
def classes
|
44
44
|
%w(textarea).prefix(brand).tap do |classes|
|
45
|
-
classes.push(%(#{brand}-textarea--error))
|
45
|
+
classes.push(%(#{brand}-textarea--error)) if has_errors?
|
46
46
|
classes.push(%(#{brand}-js-character-count)) if limit?
|
47
47
|
end
|
48
48
|
end
|
@@ -79,7 +79,7 @@ module GOVUKDesignSystemFormBuilder
|
|
79
79
|
def limit_description
|
80
80
|
return nil unless limit?
|
81
81
|
|
82
|
-
|
82
|
+
tag.span(id: limit_id, class: limit_description_classes, aria: { live: 'polite' }) do
|
83
83
|
"You can enter up to #{limit_quantity} #{limit_type}"
|
84
84
|
end
|
85
85
|
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.7
|
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-
|
11
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: 3.17.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
68
|
+
version: 3.17.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,14 +176,14 @@ dependencies:
|
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 3.
|
179
|
+
version: 3.21.0
|
180
180
|
type: :development
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: 3.
|
186
|
+
version: 3.21.0
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: rubypants
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|