govuk_design_system_formbuilder 3.0.0 → 3.0.3b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/govuk_design_system_formbuilder/elements/error_summary.rb +0 -1
- data/lib/govuk_design_system_formbuilder/traits/html_attributes.rb +4 -60
- data/lib/govuk_design_system_formbuilder/version.rb +1 -1
- data/lib/govuk_design_system_formbuilder.rb +4 -4
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8688a1ed5a9271f5618ba56617a4eab9aa1c341514b6d956558adc314282a2a
|
4
|
+
data.tar.gz: 29e1c726ef83a28da2bda26a917590ee672e4fb85cb1c3a9a89000636c2fef09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa735d3a296e2dd9f3b12cdb689fd659a9696f8cd33f866502cb48ddc63bba05013d4e87e6c688dacf25cc2de63b554fa6da6acf65bf9887c7e660265d21cc9c
|
7
|
+
data.tar.gz: 8273c13b2e36dba076b2120ee5ddd66c25c62153f9aabcc7e041d5eca9e93c4eadde7cfffedf88ebbabb8a7a509551ef0d7f5a3425c002d8afb02e245fb222d2
|
data/README.md
CHANGED
@@ -6,9 +6,9 @@
|
|
6
6
|
[![Gem](https://img.shields.io/gem/dt/govuk_design_system_formbuilder?logo=rubygems)](https://rubygems.org/gems/govuk_design_system_formbuilder)
|
7
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/110136fb22341d3ba646/test_coverage)](https://codeclimate.com/github/DFE-Digital/govuk-formbuilder/test_coverage)
|
8
8
|
[![GitHub license](https://img.shields.io/github/license/DFE-Digital/govuk_design_system_formbuilder)](https://github.com/DFE-Digital/govuk-formbuilder/blob/main/LICENSE)
|
9
|
-
[![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-
|
10
|
-
[![Rails](https://img.shields.io/badge/Rails-6.1.
|
11
|
-
[![Ruby](https://img.shields.io/badge/Ruby-2.7.
|
9
|
+
[![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-4.0.1-brightgreen)](https://design-system.service.gov.uk)
|
10
|
+
[![Rails](https://img.shields.io/badge/Rails-6.1.5%20%E2%95%B1%207.0.3-E16D6D)](https://weblog.rubyonrails.org/releases/)
|
11
|
+
[![Ruby](https://img.shields.io/badge/Ruby-2.7.6%20%20%E2%95%B1%203.0.4%20%20%E2%95%B1%203.1.2-E16D6D)](https://www.ruby-lang.org/en/downloads/)
|
12
12
|
|
13
13
|
This library provides an easy-to-use form builder for the [GOV.UK Design System](https://design-system.service.gov.uk/).
|
14
14
|
|
@@ -55,7 +55,7 @@ configured.
|
|
55
55
|
To get up and running quickly and easily try kickstarting your project with a
|
56
56
|
pre-configured template:
|
57
57
|
|
58
|
-
* [DfE
|
58
|
+
* [DfE Rails Template](https://github.com/DFE-Digital/rails-template)
|
59
59
|
* [DEFRA Ruby Template](https://github.com/DEFRA/defra-ruby-template)
|
60
60
|
|
61
61
|
## Setup 🔧
|
@@ -130,7 +130,7 @@ git config --global user.name "Julius Hibbert"
|
|
130
130
|
|
131
131
|
## Services using this library
|
132
132
|
|
133
|
-
Approximately [
|
133
|
+
Approximately [70 services use this library](https://github.com/DFE-Digital/govuk-formbuilder/network/dependents),
|
134
134
|
here are a few from the <abbr title="Department for Education">DfE</abbr>, <abbr title="Ministry of Justice">MoJ</abbr>, and
|
135
135
|
<abbr title="Department for Business, Energy & Industrial Strategy">BEIS</abbr>.
|
136
136
|
|
@@ -1,68 +1,12 @@
|
|
1
1
|
module GOVUKDesignSystemFormBuilder
|
2
2
|
module Traits
|
3
3
|
module HTMLAttributes
|
4
|
-
|
5
|
-
# * deeply merging them so both the default (required) attributes are
|
6
|
-
# present
|
7
|
-
# * joins the arrays into strings to maintain Rails 6.0.* compatibility
|
8
|
-
class Attributes
|
9
|
-
# Only try to combine and merge these attributes that contain a list of
|
10
|
-
# values separated by a space. All other values should be merged in a
|
11
|
-
# regular fashion (where the custom value overrides the default)
|
12
|
-
MERGEABLE = [
|
13
|
-
%i(class),
|
14
|
-
%i(aria controls),
|
15
|
-
%i(aria describedby),
|
16
|
-
%i(aria flowto),
|
17
|
-
%i(aria labelledby),
|
18
|
-
%i(aria owns),
|
19
|
-
].freeze
|
20
|
-
|
21
|
-
def initialize(defaults, custom)
|
22
|
-
@merged = defaults.deeper_merge(deep_split_values(custom))
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_h
|
26
|
-
deep_join_values(@merged)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def deep_split_values(hash, parent = nil)
|
32
|
-
hash.each.with_object({}) do |(key, value), result|
|
33
|
-
result[key] = case value
|
34
|
-
when Hash
|
35
|
-
deep_split_values(value, key)
|
36
|
-
when String
|
37
|
-
split_mergeable(key, value, parent)
|
38
|
-
else
|
39
|
-
value
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def split_mergeable(key, value, parent = nil)
|
45
|
-
return value.presence unless [parent, key].compact.in?(MERGEABLE)
|
46
|
-
|
47
|
-
value.split
|
48
|
-
end
|
49
|
-
|
50
|
-
def deep_join_values(hash)
|
51
|
-
hash.each.with_object({}) do |(key, value), result|
|
52
|
-
result[key] = case value
|
53
|
-
when Hash
|
54
|
-
deep_join_values(value)
|
55
|
-
when Array
|
56
|
-
value.uniq.join(' ').presence
|
57
|
-
else
|
58
|
-
value
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
4
|
+
using HTMLAttributesUtils
|
63
5
|
|
64
6
|
def attributes(html_attributes = {})
|
65
|
-
|
7
|
+
options
|
8
|
+
.deep_merge_html_attributes(html_attributes)
|
9
|
+
.deep_tidy_html_attributes
|
66
10
|
end
|
67
11
|
end
|
68
12
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'deep_merge/rails_compat'
|
2
1
|
require 'active_support/configurable'
|
2
|
+
require 'html_attributes_utils'
|
3
3
|
|
4
4
|
[%w(presenters *.rb), %w(refinements *.rb), %w(traits *.rb), %w(*.rb), %w(elements ** *.rb), %w(containers ** *.rb)]
|
5
5
|
.flat_map { |matcher| Dir.glob(File.join(__dir__, 'govuk_design_system_formbuilder', *matcher)) }
|
@@ -57,8 +57,8 @@ module GOVUKDesignSystemFormBuilder
|
|
57
57
|
# * +:default_error_summary_turbo_prefix+ is used to disable turbo/turbolinks from
|
58
58
|
# handling clicks on links in the error summary. When it's a string (eg,
|
59
59
|
# turbo), that will result in links with the attribute 'data-turbo=false'.
|
60
|
-
# When nil, no data attribute will be added. Defaults to
|
61
|
-
#
|
60
|
+
# When nil, no data attribute will be added. Defaults to turbo since Rails 7,
|
61
|
+
# change to 'turbolinks' for Rails 6.1
|
62
62
|
#
|
63
63
|
# * +:localisation_schema_fallback+ sets the prefix elements for the array
|
64
64
|
# used to build the localisation string. The final two elements are always
|
@@ -88,7 +88,7 @@ module GOVUKDesignSystemFormBuilder
|
|
88
88
|
default_error_summary_title: 'There is a problem',
|
89
89
|
default_error_summary_presenter: Presenters::ErrorSummaryPresenter,
|
90
90
|
default_error_summary_error_order_method: nil,
|
91
|
-
default_error_summary_turbo_prefix: '
|
91
|
+
default_error_summary_turbo_prefix: 'turbo',
|
92
92
|
default_collection_check_boxes_include_hidden: true,
|
93
93
|
default_collection_radio_buttons_include_hidden: true,
|
94
94
|
default_submit_validate: false,
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_design_system_formbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3b1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: html-attributes-utils
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.9.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.9.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionview
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 4.
|
137
|
+
version: 4.3.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.
|
144
|
+
version: 4.3.0
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: simplecov
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,14 +190,14 @@ dependencies:
|
|
190
190
|
requirements:
|
191
191
|
- - "~>"
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: 3.
|
193
|
+
version: 3.28.0
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - "~>"
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: 3.
|
200
|
+
version: 3.28.0
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: rubypants
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -368,9 +368,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
368
368
|
version: '0'
|
369
369
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
370
370
|
requirements:
|
371
|
-
- - "
|
371
|
+
- - ">"
|
372
372
|
- !ruby/object:Gem::Version
|
373
|
-
version:
|
373
|
+
version: 1.3.1
|
374
374
|
requirements: []
|
375
375
|
rubygems_version: 3.1.6
|
376
376
|
signing_key:
|