govuk_design_system_formbuilder 2.7.5 → 2.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/govuk_design_system_formbuilder/elements/error_summary.rb +8 -2
- data/lib/govuk_design_system_formbuilder/presenters/error_summary.rb +4 -0
- data/lib/govuk_design_system_formbuilder/version.rb +1 -1
- data/lib/govuk_design_system_formbuilder.rb +7 -0
- 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: 16dd3a6e9641b3d0aa7e91ee6318bcd0f993d10c00105e1c977f54120eb966d9
|
4
|
+
data.tar.gz: 5aa914a964cac5770d3e1c002aa9e38a20b4bf21c612a9c78c5edfa503c8e98f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 870971ada7f130cd54a13cff52f852d07e1581dd8ebf04f802ae93ca2103325fa2e283e9812170c282da4c5b1a056490799828f0f8d374a7b8d92a053bc6114e
|
7
|
+
data.tar.gz: 7e931f7fe3966909bdd2c4ff16ee3fe7d06e0c52925c03d36fb300a99d7105a842ee6f5aeac165b3824495efd7b3d189ac925378c4a10b7e57c37f8d4230eeb2
|
data/README.md
CHANGED
@@ -7,8 +7,8 @@
|
|
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/master/LICENSE)
|
9
9
|
[![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.14.0-brightgreen)](https://design-system.service.gov.uk)
|
10
|
-
[![Rails](https://img.shields.io/badge/
|
11
|
-
[![Ruby](https://img.shields.io/badge/
|
10
|
+
[![Rails](https://img.shields.io/badge/Rails-6.0.4.1%20%E2%95%B1%206.1.4.1-E16D6D)](https://weblog.rubyonrails.org/releases/)
|
11
|
+
[![Ruby](https://img.shields.io/badge/Ruby-2.6.8%20%E2%95%B1%202.7.4%20%E2%95%B1%203.0.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
|
|
@@ -56,7 +56,7 @@ To get up and running quickly and easily try kickstarting your project with a
|
|
56
56
|
pre-configured template:
|
57
57
|
|
58
58
|
* [DfE Boilerplate](https://github.com/DFE-Digital/govuk-rails-boilerplate)
|
59
|
-
* [
|
59
|
+
* [DEFRA Ruby Template](https://github.com/DEFRA/defra-ruby-template)
|
60
60
|
|
61
61
|
## Setup 🔧
|
62
62
|
|
@@ -80,8 +80,8 @@ module GOVUKDesignSystemFormBuilder
|
|
80
80
|
config.default_error_summary_error_order_method
|
81
81
|
end
|
82
82
|
|
83
|
-
def list_item(attribute, message)
|
84
|
-
tag.li(link_to(message, same_page_link(field_id(attribute)),
|
83
|
+
def list_item(attribute, message, url = nil)
|
84
|
+
tag.li(link_to(message, url || same_page_link(field_id(attribute)), **link_options))
|
85
85
|
end
|
86
86
|
|
87
87
|
def same_page_link(target)
|
@@ -129,6 +129,12 @@ module GOVUKDesignSystemFormBuilder
|
|
129
129
|
}
|
130
130
|
}
|
131
131
|
end
|
132
|
+
|
133
|
+
def link_options(turbo_prefix: config.default_error_summary_turbo_prefix)
|
134
|
+
return {} unless turbo_prefix
|
135
|
+
|
136
|
+
{ data: { turbo_prefix => false } }
|
137
|
+
end
|
132
138
|
end
|
133
139
|
end
|
134
140
|
end
|
@@ -19,9 +19,13 @@ module Presenters
|
|
19
19
|
# passed into {GOVUKDesignSystemFormBuilder::Elements::ErrorSummary#list_item}.
|
20
20
|
#
|
21
21
|
# @return [Array<Array(Symbol, String)>] array of attribute and message arrays
|
22
|
+
# @return [Array<Array(Symbol, String, String)>] array of attribute, message and URL arrays.
|
22
23
|
#
|
23
24
|
# @example Output format given the input above:
|
24
25
|
# [[:attribute_one, "first error"], [:attribute_two, "third error"]]
|
26
|
+
#
|
27
|
+
# @example Output with hard-coded URLs
|
28
|
+
# [[:attribute_one, "first error", "https://example.com/attribute-one"], [:attribute_two, "third error", "https://example.com/attribute-two"]]
|
25
29
|
def formatted_error_messages
|
26
30
|
@error_messages.map { |attribute, messages| [attribute, messages.first] }
|
27
31
|
end
|
@@ -54,6 +54,12 @@ module GOVUKDesignSystemFormBuilder
|
|
54
54
|
# will check for on the bound object to see whether or not to try ordering the
|
55
55
|
# error messages
|
56
56
|
#
|
57
|
+
# * +:default_error_summary_turbo_prefix+ is used to disable turbo/turbolinks from
|
58
|
+
# handling clicks on links in the error summary. When it's a string (eg,
|
59
|
+
# turbo), that will result in links with the attribute 'data-turbo=false'.
|
60
|
+
# When nil, no data attribute will be added. Defaults to 'turbolinks' for
|
61
|
+
# compatibilitiy's sake; this will change to 'turbo' when Rails 7 is released
|
62
|
+
#
|
57
63
|
# * +:localisation_schema_fallback+ sets the prefix elements for the array
|
58
64
|
# used to build the localisation string. The final two elements are always
|
59
65
|
# are the object name and attribute name. The _special_ value +__context__+,
|
@@ -78,6 +84,7 @@ module GOVUKDesignSystemFormBuilder
|
|
78
84
|
default_error_summary_title: 'There is a problem',
|
79
85
|
default_error_summary_presenter: Presenters::ErrorSummaryPresenter,
|
80
86
|
default_error_summary_error_order_method: nil,
|
87
|
+
default_error_summary_turbo_prefix: 'turbolinks',
|
81
88
|
default_collection_check_boxes_include_hidden: true,
|
82
89
|
default_collection_radio_buttons_include_hidden: true,
|
83
90
|
default_submit_validate: false,
|
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.7.
|
4
|
+
version: 2.7.6
|
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-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|
@@ -350,12 +350,12 @@ homepage: https://govuk-form-builder.netlify.app
|
|
350
350
|
licenses:
|
351
351
|
- MIT
|
352
352
|
metadata:
|
353
|
-
bug_tracker_uri: https://github.com/DFE-Digital/
|
354
|
-
changelog_uri: https://github.com/DFE-Digital/
|
353
|
+
bug_tracker_uri: https://github.com/DFE-Digital/govuk-formbuilder/issues
|
354
|
+
changelog_uri: https://github.com/DFE-Digital/govuk-formbuilder/releases
|
355
355
|
documentation_uri: https://www.rubydoc.info/gems/govuk_design_system_formbuilder/GOVUKDesignSystemFormBuilder/Builder
|
356
356
|
homepage_uri: https://govuk-form-builder.netlify.app
|
357
|
-
source_code_uri: https://github.com/DFE-Digital/
|
358
|
-
github_repo: https://github.com/DFE-Digital/
|
357
|
+
source_code_uri: https://github.com/DFE-Digital/govuk-formbuilder
|
358
|
+
github_repo: https://github.com/DFE-Digital/govuk-formbuilder
|
359
359
|
post_install_message:
|
360
360
|
rdoc_options: []
|
361
361
|
require_paths:
|