govuk_design_system_formbuilder 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f5a6a3bf20a1265053dcc1412b8e1cd3a401b67000d4baea725d1e38de52115
|
|
4
|
+
data.tar.gz: 336536cec3118c2b2f408bfd17e173b12026031bf4147bf92fac910c4a73fff9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9ccef41328fbf34c365e0d18f4709a3ef25d26ad4a22b0ca0836f36835eb14a7628b0a5100f0724fe05b422e9ae184c236648d421389e2aecaf5d39610c4279
|
|
7
|
+
data.tar.gz: e08a35440a95b29e82e62c9ab0b3c5bbb421899eb4b118331ea29d818a55c257965e0e983b311038a60956aefcbb01d2ed6a2719ae1f6fedf69d073c4da03ffa
|
data/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# GOV.UK
|
|
1
|
+
# GOV.UK Form Builder for Ruby on Rails
|
|
2
2
|
|
|
3
|
-
[](https://codeclimate.com/github/
|
|
5
|
-
[](https://github.com/x-govuk/govuk-form-builder/actions)
|
|
4
|
+
[](https://codeclimate.com/github/x-govuk/govuk-form-builder/maintainability)
|
|
5
|
+
[](https://rubygems.org/gems/govuk_design_system_formbuilder)
|
|
6
6
|
[](https://rubygems.org/gems/govuk_design_system_formbuilder)
|
|
7
|
-
[](https://codeclimate.com/github/
|
|
8
|
-
[](https://codeclimate.com/github/x-govuk/govuk-form-builder/test_coverage)
|
|
8
|
+
[](https://github.com/x-govuk/govuk-form-builder/blob/main/LICENSE)
|
|
9
|
+
[](https://design-system.service.gov.uk)
|
|
10
10
|
[](https://weblog.rubyonrails.org/releases/)
|
|
11
11
|
[](https://www.ruby-lang.org/en/downloads/)
|
|
12
12
|
|
|
@@ -16,22 +16,18 @@ It is intended to make creating forms **quick**, **easy** and **familiar** for R
|
|
|
16
16
|
|
|
17
17
|
## Documentation
|
|
18
18
|
|
|
19
|
-
The gem comes with [a full guide](https://govuk-form-builder.netlify.app/) that
|
|
20
|
-
covers most aspects of day-to-day use, along with code and output examples. The
|
|
21
|
-
examples in the guide are generated from the builder itself so it will always
|
|
22
|
-
be up to date.
|
|
19
|
+
The gem comes with [a full guide](https://govuk-form-builder.netlify.app/) that covers most aspects of day-to-day use, along with code and output examples. The examples in the guide are generated from the builder itself so it will always be up to date.
|
|
23
20
|
|
|
24
21
|
[](https://app.netlify.com/sites/govuk-form-builder/deploys)
|
|
25
22
|
|
|
26
|
-
## What
|
|
23
|
+
## What’s included
|
|
27
24
|
|
|
28
25
|
* 100% compatibility with the GOV.UK Design System
|
|
29
26
|
* Full control of labels, legends, hints, captions and fieldsets
|
|
30
|
-
* No overwriting of Rails
|
|
27
|
+
* No overwriting of Rails’ default form helpers
|
|
31
28
|
* Automatic ARIA associations between hints, errors and inputs
|
|
32
29
|
* Most helpers take blocks for arbitrary content
|
|
33
|
-
* Additional params for programmatically adding hints to check box and radio
|
|
34
|
-
button collections
|
|
30
|
+
* Additional params for programmatically adding hints to check box and radio button collections
|
|
35
31
|
* Full I18n support
|
|
36
32
|
* Automatic handling of ActiveRecord validation error messages
|
|
37
33
|
* No external dependencies
|
|
@@ -40,29 +36,22 @@ be up to date.
|
|
|
40
36
|
|
|
41
37
|
## Installation
|
|
42
38
|
|
|
43
|
-
You can install the form builder gem by running the `gem install
|
|
44
|
-
govuk_design_system_formbuilder` or by adding the following line
|
|
45
|
-
to your `Gemfile`:
|
|
39
|
+
You can install the form builder gem by running the `gem install govuk_design_system_formbuilder` or by adding the following line to your `Gemfile`:
|
|
46
40
|
|
|
47
41
|
```sh
|
|
48
42
|
gem 'govuk_design_system_formbuilder'
|
|
49
43
|
```
|
|
50
44
|
|
|
51
|
-
To make full use of this tool, you will need a Rails application with the latest [GOV.UK
|
|
52
|
-
Frontend](https://github.com/alphagov/govuk-frontend) assets installed and
|
|
53
|
-
configured.
|
|
45
|
+
To make full use of this tool, you will need a Rails application with the latest [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) assets installed and configured.
|
|
54
46
|
|
|
55
|
-
To get up and running quickly and easily try kickstarting your project with a
|
|
56
|
-
pre-configured template:
|
|
47
|
+
To get up and running quickly and easily try kickstarting your project with a pre-configured template:
|
|
57
48
|
|
|
58
49
|
* [DfE Rails Template](https://github.com/DFE-Digital/rails-template)
|
|
59
50
|
* [DEFRA Ruby Template](https://github.com/DEFRA/defra-ruby-template)
|
|
60
51
|
|
|
61
52
|
## Setup
|
|
62
53
|
|
|
63
|
-
To use the form builder in an ad hoc basis you can specify it as an argument to
|
|
64
|
-
`form_for` or `form_with`. These examples are written in [Slim](https://github.com/slim-template/slim) but
|
|
65
|
-
other templating languages like ERB and [Haml](https://haml.info/) work just as well.
|
|
54
|
+
To use the form builder in an ad hoc basis you can specify it as an argument to `form_for` or `form_with`. These examples are written in [Slim](https://github.com/slim-template/slim) but other templating languages like ERB and [Haml](https://haml.info/) work just as well.
|
|
66
55
|
|
|
67
56
|
```slim
|
|
68
57
|
= form_for @some_object, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f|
|
|
@@ -92,16 +81,14 @@ Now we can get started!
|
|
|
92
81
|
:name,
|
|
93
82
|
:description,
|
|
94
83
|
label: { text: "Which department do you work for?" },
|
|
95
|
-
hint: { text: "If you don
|
|
84
|
+
hint: { text: "If you don’t know ask your manager" }
|
|
96
85
|
|
|
97
86
|
= f.govuk_submit 'Away we go!'
|
|
98
87
|
```
|
|
99
88
|
|
|
100
89
|
## Developing and running the tests
|
|
101
90
|
|
|
102
|
-
The form builder is tested with RSpec. To run all the tests first ensure that
|
|
103
|
-
the development and testing prerequisite gems are installed. At the root of a
|
|
104
|
-
freshly-cloned repo run:
|
|
91
|
+
The form builder is tested with RSpec. To run all the tests first ensure that the development and testing prerequisite gems are installed. At the root of a freshly-cloned repo run:
|
|
105
92
|
|
|
106
93
|
```sh
|
|
107
94
|
bundle
|
|
@@ -115,12 +102,9 @@ bundle exec rspec
|
|
|
115
102
|
|
|
116
103
|
## Contributing
|
|
117
104
|
|
|
118
|
-
Bug reports and feature requests are most welcome, please raise an issue or
|
|
119
|
-
submit a pull request.
|
|
105
|
+
Bug reports and feature requests are most welcome, please raise an issue or submit a pull request.
|
|
120
106
|
|
|
121
|
-
Currently we
|
|
122
|
-
ensure code meets the GOV.UK guidelines. Please ensure that any PRs also adhere
|
|
123
|
-
to this standard.
|
|
107
|
+
Currently we’re using [GOVUK Lint](https://github.com/alphagov/govuk-lint) to ensure code meets the GOV.UK guidelines. Please ensure that any PRs also adhere to this standard.
|
|
124
108
|
|
|
125
109
|
To help keep the logs clean and tidy, please configure git to use your full name:
|
|
126
110
|
|
|
@@ -130,18 +114,18 @@ git config --global user.name "Julius Hibbert"
|
|
|
130
114
|
|
|
131
115
|
## Services using this library
|
|
132
116
|
|
|
133
|
-
Approximately [100 services use this library](https://github.com/
|
|
117
|
+
Approximately [100 services use this library](https://github.com/x-govuk/govuk-form-builder/network/dependents),
|
|
134
118
|
here are a few from the <abbr title="Department for Education">DfE</abbr>, <abbr title="Ministry of Justice">MoJ</abbr>, and
|
|
135
119
|
<abbr title="Department for Business, Energy & Industrial Strategy">BEIS</abbr>.
|
|
136
120
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
121
|
+
* [Apply for teacher training](https://www.github.com/x-govuk/apply-for-teacher-training)
|
|
122
|
+
* [Teaching Vacancies](https://www.github.com/x-govuk/teaching-vacancies)
|
|
123
|
+
* [Get a teacher training adviser](https://www.github.com/x-govuk/get-teacher-training-adviser-service/)
|
|
124
|
+
* [Claim for crown court defence](https://www.github.com/ministryofjustice/Claim-for-Crown-Court-Defence)
|
|
125
|
+
* [Appeal to the tax tribunal](https://www.github.com/ministryofjustice/tax-tribunals-datacapture)
|
|
126
|
+
* [Apply to court about child arrangements](https://www.github.com/ministryofjustice/c100-application)
|
|
127
|
+
* [Trade Tariff duty calculator](https://www.github.com/trade-tariff/trade-tariff-duty-calculator)
|
|
128
|
+
* [Report your official development assistance](https://www.github.com/UKGovernmentBEIS/beis-report-official-development-assistance)
|
|
145
129
|
|
|
146
130
|
## Form building services using this library
|
|
147
131
|
|
|
@@ -150,5 +134,4 @@ here are a few from the <abbr title="Department for Education">DfE</abbr>, <abbr
|
|
|
150
134
|
|
|
151
135
|
## Thanks
|
|
152
136
|
|
|
153
|
-
This project was inspired by [Ministry of Justice
|
|
154
|
-
but is leaner, more modular and written in a more idiomatic style.
|
|
137
|
+
This project was inspired by [Ministry of Justice’s GovukElementsFormBuilder](https://github.com/ministryofjustice/govuk_elements_form_builder), but is leaner, more modular and written in a more idiomatic style.
|
|
@@ -857,6 +857,7 @@ module GOVUKDesignSystemFormBuilder
|
|
|
857
857
|
# @param text [String,Proc] the button text. When a +Proc+ is provided its contents will be rendered within the button element
|
|
858
858
|
# @param warning [Boolean] makes the button red ({https://design-system.service.gov.uk/components/button/#warning-buttons warning}) when true
|
|
859
859
|
# @param secondary [Boolean] makes the button grey ({https://design-system.service.gov.uk/components/button/#secondary-buttons secondary}) when true
|
|
860
|
+
# @param inverse [Boolean] inverts the colours of the button. Note this isn't yet part of the design system.
|
|
860
861
|
# @param prevent_double_click [Boolean] adds JavaScript to safeguard the
|
|
861
862
|
# form from being submitted more than once
|
|
862
863
|
# @param validate [Boolean] adds the formnovalidate to the submit button when true, this disables all
|
|
@@ -881,8 +882,8 @@ module GOVUKDesignSystemFormBuilder
|
|
|
881
882
|
# = f.govuk_submit "Proceed", prevent_double_click: true do
|
|
882
883
|
# = link_to 'Cancel', some_other_path, class: 'govuk-button__secondary'
|
|
883
884
|
#
|
|
884
|
-
def govuk_submit(text = config.default_submit_button_text, warning: false, secondary: false, prevent_double_click: true, validate: config.default_submit_validate, disabled: false, **kwargs, &block)
|
|
885
|
-
Elements::Submit.new(self, text, warning: warning, secondary: secondary, prevent_double_click: prevent_double_click, validate: validate, disabled: disabled, **kwargs, &block).html
|
|
885
|
+
def govuk_submit(text = config.default_submit_button_text, warning: false, secondary: false, inverse: false, prevent_double_click: true, validate: config.default_submit_validate, disabled: false, **kwargs, &block)
|
|
886
|
+
Elements::Submit.new(self, text, warning: warning, secondary: secondary, inverse: inverse, prevent_double_click: prevent_double_click, validate: validate, disabled: disabled, **kwargs, &block).html
|
|
886
887
|
end
|
|
887
888
|
|
|
888
889
|
# Generates three inputs for the +day+, +month+ and +year+ components of a date
|
|
@@ -5,7 +5,7 @@ module GOVUKDesignSystemFormBuilder
|
|
|
5
5
|
include Traits::HTMLClasses
|
|
6
6
|
include Traits::HTMLAttributes
|
|
7
7
|
|
|
8
|
-
def initialize(builder, text, warning:, secondary:, prevent_double_click:, validate:, disabled:, **kwargs, &block)
|
|
8
|
+
def initialize(builder, text, warning:, secondary:, inverse:, prevent_double_click:, validate:, disabled:, **kwargs, &block)
|
|
9
9
|
super(builder, nil, nil)
|
|
10
10
|
|
|
11
11
|
fail ArgumentError, 'buttons can be warning or secondary' if warning && secondary
|
|
@@ -14,6 +14,7 @@ module GOVUKDesignSystemFormBuilder
|
|
|
14
14
|
@prevent_double_click = prevent_double_click
|
|
15
15
|
@warning = warning
|
|
16
16
|
@secondary = secondary
|
|
17
|
+
@inverse = inverse
|
|
17
18
|
@validate = validate
|
|
18
19
|
@disabled = disabled
|
|
19
20
|
@html_attributes = kwargs
|
|
@@ -68,6 +69,7 @@ module GOVUKDesignSystemFormBuilder
|
|
|
68
69
|
"button--warning" => @warning,
|
|
69
70
|
"button--secondary" => @secondary,
|
|
70
71
|
"button--disabled" => @disabled,
|
|
72
|
+
"button--inverse" => @inverse,
|
|
71
73
|
).prefix(brand)
|
|
72
74
|
end
|
|
73
75
|
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: 4.
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Yates
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-07-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: html-attributes-utils
|
|
@@ -134,14 +134,14 @@ dependencies:
|
|
|
134
134
|
requirements:
|
|
135
135
|
- - "~>"
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: 4.
|
|
137
|
+
version: 4.11.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.11.0
|
|
145
145
|
- !ruby/object:Gem::Dependency
|
|
146
146
|
name: simplecov
|
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -260,14 +260,14 @@ dependencies:
|
|
|
260
260
|
requirements:
|
|
261
261
|
- - "~>"
|
|
262
262
|
- !ruby/object:Gem::Version
|
|
263
|
-
version: 0.
|
|
263
|
+
version: 0.24.0
|
|
264
264
|
type: :development
|
|
265
265
|
prerelease: false
|
|
266
266
|
version_requirements: !ruby/object:Gem::Requirement
|
|
267
267
|
requirements:
|
|
268
268
|
- - "~>"
|
|
269
269
|
- !ruby/object:Gem::Version
|
|
270
|
-
version: 0.
|
|
270
|
+
version: 0.24.0
|
|
271
271
|
- !ruby/object:Gem::Dependency
|
|
272
272
|
name: webrick
|
|
273
273
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -282,8 +282,8 @@ dependencies:
|
|
|
282
282
|
- - "~>"
|
|
283
283
|
- !ruby/object:Gem::Version
|
|
284
284
|
version: 1.8.1
|
|
285
|
-
description:
|
|
286
|
-
|
|
285
|
+
description: This library provides view components for the GOV.UK Design System. It
|
|
286
|
+
makes creating services more familiar for Ruby on Rails developers.
|
|
287
287
|
email:
|
|
288
288
|
- peter.yates@graphia.co.uk
|
|
289
289
|
executables: []
|
|
@@ -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/
|
|
354
|
-
changelog_uri: https://github.com/
|
|
353
|
+
bug_tracker_uri: https://github.com/x-govuk/govuk-form-builder/issues
|
|
354
|
+
changelog_uri: https://github.com/x-govuk/govuk-form-builder/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/
|
|
358
|
-
github_repo: https://github.com/
|
|
357
|
+
source_code_uri: https://github.com/x-govuk/govuk-form-builder
|
|
358
|
+
github_repo: https://github.com/x-govuk/govuk-form-builder
|
|
359
359
|
post_install_message:
|
|
360
360
|
rdoc_options: []
|
|
361
361
|
require_paths:
|
|
@@ -374,5 +374,5 @@ requirements: []
|
|
|
374
374
|
rubygems_version: 3.2.33
|
|
375
375
|
signing_key:
|
|
376
376
|
specification_version: 4
|
|
377
|
-
summary: GOV.UK
|
|
377
|
+
summary: GOV.UK Form Builder for Ryby on Rails
|
|
378
378
|
test_files: []
|