formtastic 5.0.0 → 6.0.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 +4 -4
- data/.gitattributes +0 -1
- data/.github/workflows/integration.yaml +36 -0
- data/.github/workflows/test.yml +26 -20
- data/.gitignore +2 -1
- data/Appraisals +23 -0
- data/CONTRIBUTING.md +27 -0
- data/Gemfile +5 -0
- data/MIT-LICENSE +1 -1
- data/README.md +14 -46
- data/RELEASE_PROCESS +0 -1
- data/Rakefile +1 -1
- data/formtastic.gemspec +17 -10
- data/gemfiles/rails_72.gemfile +9 -0
- data/gemfiles/rails_80.gemfile +9 -0
- data/gemfiles/rails_81.gemfile +9 -0
- data/gemfiles/rails_edge.gemfile +9 -0
- data/lib/formtastic/actions/input_action.rb +1 -1
- data/lib/formtastic/actions/link_action.rb +1 -1
- data/lib/formtastic/form_builder.rb +27 -27
- data/lib/formtastic/helpers/action_helper.rb +0 -1
- data/lib/formtastic/helpers/actions_helper.rb +1 -1
- data/lib/formtastic/helpers/errors_helper.rb +71 -14
- data/lib/formtastic/helpers/fieldset_wrapper.rb +1 -1
- data/lib/formtastic/helpers/form_helper.rb +3 -3
- data/lib/formtastic/helpers/input_helper.rb +5 -3
- data/lib/formtastic/i18n.rb +0 -1
- data/lib/formtastic/inputs/base/aria.rb +26 -0
- data/lib/formtastic/inputs/base/collections.rb +1 -1
- data/lib/formtastic/inputs/base/errors.rb +1 -1
- data/lib/formtastic/inputs/base/html.rb +1 -1
- data/lib/formtastic/inputs/base/labelling.rb +1 -1
- data/lib/formtastic/inputs/base/validations.rb +32 -8
- data/lib/formtastic/inputs/base.rb +7 -5
- data/lib/formtastic/inputs/country_input.rb +9 -6
- data/lib/formtastic/inputs/datalist_input.rb +2 -2
- data/lib/formtastic/inputs/number_input.rb +1 -1
- data/lib/formtastic/inputs/range_input.rb +1 -1
- data/lib/formtastic/inputs/time_zone_input.rb +1 -1
- data/lib/formtastic/version.rb +1 -1
- data/lib/formtastic.rb +6 -2
- data/lib/generators/formtastic/form/form_generator.rb +2 -3
- data/lib/generators/formtastic/install/install_generator.rb +0 -1
- data/lib/generators/formtastic/stylesheets/stylesheets_generator.rb +15 -0
- data/{app/assets/stylesheets → lib/generators/templates}/formtastic.css +4 -4
- data/lib/generators/templates/formtastic.rb +7 -1
- data/script/integration-template.rb +14 -11
- data/script/integration.sh +17 -4
- data/spec/action_class_finder_spec.rb +0 -1
- data/spec/actions/button_action_spec.rb +0 -1
- data/spec/actions/generic_action_spec.rb +2 -3
- data/spec/actions/input_action_spec.rb +0 -1
- data/spec/actions/link_action_spec.rb +0 -1
- data/spec/builder/custom_builder_spec.rb +0 -1
- data/spec/builder/error_proc_spec.rb +0 -1
- data/spec/builder/semantic_fields_for_spec.rb +72 -2
- data/spec/fast_spec_helper.rb +0 -1
- data/spec/generators/formtastic/stylesheets/stylesheets_generator_spec.rb +22 -0
- data/spec/helpers/actions_helper_spec.rb +0 -1
- data/spec/helpers/form_helper_spec.rb +0 -1
- data/spec/helpers/input_helper_spec.rb +12 -1
- data/spec/helpers/inputs_helper_spec.rb +1 -2
- data/spec/helpers/reflection_helper_spec.rb +0 -1
- data/spec/helpers/semantic_errors_helper_spec.rb +114 -7
- data/spec/i18n_spec.rb +1 -2
- data/spec/input_class_finder_spec.rb +0 -1
- data/spec/inputs/base/collections_spec.rb +41 -0
- data/spec/inputs/boolean_input_spec.rb +0 -1
- data/spec/inputs/check_boxes_input_spec.rb +1 -2
- data/spec/inputs/color_input_spec.rb +0 -1
- data/spec/inputs/country_input_spec.rb +5 -6
- data/spec/inputs/custom_input_spec.rb +0 -1
- data/spec/inputs/datalist_input_spec.rb +0 -1
- data/spec/inputs/date_picker_input_spec.rb +0 -1
- data/spec/inputs/date_select_input_spec.rb +1 -2
- data/spec/inputs/datetime_picker_input_spec.rb +0 -1
- data/spec/inputs/datetime_select_input_spec.rb +1 -2
- data/spec/inputs/email_input_spec.rb +0 -1
- data/spec/inputs/file_input_spec.rb +0 -1
- data/spec/inputs/hidden_input_spec.rb +0 -1
- data/spec/inputs/include_blank_spec.rb +0 -1
- data/spec/inputs/label_spec.rb +32 -1
- data/spec/inputs/number_input_spec.rb +0 -1
- data/spec/inputs/password_input_spec.rb +1 -2
- data/spec/inputs/phone_input_spec.rb +0 -1
- data/spec/inputs/placeholder_spec.rb +0 -1
- data/spec/inputs/radio_input_spec.rb +0 -1
- data/spec/inputs/range_input_spec.rb +0 -1
- data/spec/inputs/readonly_spec.rb +0 -1
- data/spec/inputs/search_input_spec.rb +0 -1
- data/spec/inputs/select_input_spec.rb +0 -1
- data/spec/inputs/string_input_spec.rb +67 -2
- data/spec/inputs/text_input_spec.rb +0 -1
- data/spec/inputs/time_picker_input_spec.rb +0 -1
- data/spec/inputs/time_select_input_spec.rb +1 -2
- data/spec/inputs/time_zone_input_spec.rb +0 -1
- data/spec/inputs/url_input_spec.rb +0 -1
- data/spec/inputs/with_options_spec.rb +0 -1
- data/spec/localizer_spec.rb +0 -1
- data/spec/namespaced_class_finder_spec.rb +0 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/support/custom_macros.rb +11 -3
- data/spec/support/specialized_class_finder_shared_example.rb +0 -1
- data/spec/support/test_environment.rb +2 -2
- metadata +53 -41
- data/CHANGELOG.md +0 -61
- data/Gemfile.lock +0 -140
- data/app/assets/stylesheets/formtastic_ie6.css +0 -33
- data/app/assets/stylesheets/formtastic_ie7.css +0 -23
- data/gemfiles/rails_6.0/Gemfile +0 -5
- data/gemfiles/rails_6.1/Gemfile +0 -5
- data/gemfiles/rails_7.0/Gemfile +0 -5
- data/gemfiles/rails_7.1/Gemfile +0 -5
- data/gemfiles/rails_edge/Gemfile +0 -13
- data/lib/formtastic/engine.rb +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c26be428c94cba3b204e5c9fe8c9ea4b1e7b3630e9557d7a342d69117f9bf109
|
|
4
|
+
data.tar.gz: 00cfa7ba8fba47111d3ba25ff59cb5251471ccf629715666c38cb0a686dde2e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44abed557365670d69015a5d478a90bd1a0b41c86f48436c75404ee12ab471cea3fc302d42c58c6f3a42cd0eeef254c026822f187a91d46c967b9393736d2a53
|
|
7
|
+
data.tar.gz: 16fcf4a1bf7f355ec5f85df8a0a38693cb7a512950524b3d169e36ea35f10567b9a81268a99930553f13fb6bc997c4d6ff264ac9b84142e614f48d9694c8e40a
|
data/.gitattributes
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
CHANGELOG merge=union
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: integration
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
ci:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
needs: test
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v6
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-22.04
|
|
17
|
+
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v6
|
|
23
|
+
|
|
24
|
+
- uses: actions/setup-node@v6
|
|
25
|
+
with:
|
|
26
|
+
node-version: 11
|
|
27
|
+
|
|
28
|
+
- name: Set up Ruby
|
|
29
|
+
uses: ruby/setup-ruby@v1
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: '4.0'
|
|
32
|
+
bundler-cache: true
|
|
33
|
+
bundler: latest
|
|
34
|
+
|
|
35
|
+
- name: Run integration
|
|
36
|
+
run: script/integration.sh
|
data/.github/workflows/test.yml
CHANGED
|
@@ -2,6 +2,8 @@ name: test
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
5
7
|
pull_request:
|
|
6
8
|
|
|
7
9
|
jobs:
|
|
@@ -9,41 +11,46 @@ jobs:
|
|
|
9
11
|
runs-on: ubuntu-latest
|
|
10
12
|
needs: test
|
|
11
13
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@v6
|
|
13
15
|
test:
|
|
14
|
-
runs-on: ubuntu-
|
|
16
|
+
runs-on: ubuntu-22.04
|
|
15
17
|
|
|
16
18
|
strategy:
|
|
17
19
|
fail-fast: false
|
|
18
20
|
|
|
19
21
|
matrix:
|
|
20
22
|
gemfile:
|
|
21
|
-
- gemfiles/
|
|
22
|
-
- gemfiles/
|
|
23
|
-
- gemfiles/
|
|
24
|
-
- gemfiles/
|
|
25
|
-
- gemfiles/rails_edge/Gemfile
|
|
23
|
+
- gemfiles/rails_72.gemfile
|
|
24
|
+
- gemfiles/rails_80.gemfile
|
|
25
|
+
- gemfiles/rails_81.gemfile
|
|
26
|
+
- gemfiles/rails_edge.gemfile
|
|
26
27
|
|
|
27
28
|
ruby:
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- 3.
|
|
29
|
+
- '3.1'
|
|
30
|
+
- '3.2'
|
|
31
|
+
- '3.3'
|
|
32
|
+
- '3.4'
|
|
33
|
+
- '4.0'
|
|
31
34
|
|
|
32
35
|
exclude:
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
36
|
+
- gemfile: gemfiles/rails_80.gemfile
|
|
37
|
+
ruby: '3.1'
|
|
38
|
+
- gemfile: gemfiles/rails_81.gemfile
|
|
39
|
+
ruby: '3.1'
|
|
40
|
+
- gemfile: gemfiles/rails_edge.gemfile
|
|
41
|
+
ruby: '3.1'
|
|
42
|
+
- gemfile: gemfiles/rails_edge.gemfile
|
|
43
|
+
ruby: '3.2'
|
|
44
|
+
- gemfile: gemfiles/rails_72.gemfile
|
|
45
|
+
ruby: '4.0'
|
|
39
46
|
|
|
40
47
|
env:
|
|
41
48
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
|
42
49
|
|
|
43
50
|
steps:
|
|
44
|
-
- uses: actions/checkout@
|
|
51
|
+
- uses: actions/checkout@v6
|
|
45
52
|
|
|
46
|
-
- uses: actions/setup-node@
|
|
53
|
+
- uses: actions/setup-node@v6
|
|
47
54
|
with:
|
|
48
55
|
node-version: 11
|
|
49
56
|
|
|
@@ -57,5 +64,4 @@ jobs:
|
|
|
57
64
|
- name: Run tests
|
|
58
65
|
run: |
|
|
59
66
|
bundle exec rake spec
|
|
60
|
-
|
|
61
|
-
continue-on-error: ${{ matrix.gemfile == 'gemfiles/rails_edge/Gemfile' }}
|
|
67
|
+
continue-on-error: ${{ matrix.gemfile == 'gemfiles/rails_edge.gemfile' }}
|
data/.gitignore
CHANGED
data/Appraisals
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
appraise "rails-72" do
|
|
2
|
+
gem "actionpack", "~> 7.2.3"
|
|
3
|
+
gem "activesupport", "~> 7.2.3"
|
|
4
|
+
gem "activerecord", "~> 7.2.3"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
appraise "rails-80" do
|
|
8
|
+
gem "actionpack", "~> 8.0.4"
|
|
9
|
+
gem "activesupport", "~> 8.0.4"
|
|
10
|
+
gem "activerecord", "~> 8.0.4"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
appraise "rails-81" do
|
|
14
|
+
gem "actionpack", "~> 8.1.2"
|
|
15
|
+
gem "activesupport", "~> 8.1.2"
|
|
16
|
+
gem "activerecord", "~> 8.1.2"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
appraise "rails-edge" do
|
|
20
|
+
gem "actionpack", git: "https://github.com/rails/rails.git", branch: "main"
|
|
21
|
+
gem "activesupport", git: "https://github.com/rails/rails.git", branch: "main"
|
|
22
|
+
gem "activerecord", git: "https://github.com/rails/rails.git", branch: "main"
|
|
23
|
+
end
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## General Workflow
|
|
4
|
+
|
|
5
|
+
* Fork the project on Github
|
|
6
|
+
* Install development dependencies (`bundle install` and `bundle exec rake appraisal:install`)
|
|
7
|
+
* Run the appraisals to check you've got a clean build with passing tests to work on (`bundle exec rake`)
|
|
8
|
+
* Create a topic branch for your changes
|
|
9
|
+
* Ensure that you provide *documentation* and *test coverage* for your changes (patches won't be accepted without)
|
|
10
|
+
* Ensure that all tests still pass (`bundle exec rake`)
|
|
11
|
+
* Create a pull request on Github (these are also a great place to start a conversation around a WIP patch as early as possible)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Continuous Integration
|
|
15
|
+
|
|
16
|
+
Formtastic supports multiple versions of Rails and Ruby. Here's the approach to managing the complexity:
|
|
17
|
+
|
|
18
|
+
* The gemspec has a `required_ruby_version` that matches the minimum Ruby version supported by the minimum Rails version we currently support.
|
|
19
|
+
* The gemspec has a dependency on `actionpack` matching the minimum Rails version we currently support.
|
|
20
|
+
* The gemspec has several development dependencies, but we're not specific about which version. That complexity is handled by Appraisals and/or bundler.
|
|
21
|
+
* There is an Appraisal for each of the Rails versions we currently test with (eg Rails 7, 8 and edge) that can name specific versions of these dependencies and developer dependencies as needed.
|
|
22
|
+
* Use `bundle exec appraisal` to generate new `gemfiles/*` as needed. We do not check-in the `*.gemfile.lock`, so that each Ruby version in the CI matrix can select an appropriate version of each dependency.
|
|
23
|
+
* The GitHub `test.yml` workflow runs a matrix of builds agqainst multiple Ruby and Rails versions, excluding any that don't make sense based on the minimum Ruby version for certain Rails versions.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -2,24 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/formtastic/formtastic/actions)
|
|
4
4
|
[](https://inch-ci.org/github/justinfrench/formtastic)
|
|
5
|
-
[](https://qlty.sh/gh/formtastic/projects/formtastic)
|
|
6
6
|
[](https://badge.fury.io/rb/formtastic)
|
|
7
7
|
|
|
8
8
|
Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far easier to create beautiful, semantically rich, syntactically awesome, readily stylable and wonderfully accessible HTML forms in your Rails applications.
|
|
9
9
|
|
|
10
10
|
## Documentation & Support
|
|
11
11
|
|
|
12
|
-
* [Documentation is available on
|
|
12
|
+
* [Documentation is available on rubydoc.info](https://rubydoc.info/github/formtastic/formtastic)
|
|
13
13
|
* [We track issues & bugs on GitHub](https://github.com/formtastic/formtastic/issues)
|
|
14
14
|
* [We have a wiki on GitHub](https://github.com/formtastic/formtastic/wiki)
|
|
15
15
|
* [StackOverflow can help](https://stackoverflow.com/questions/tagged/formtastic)
|
|
16
16
|
|
|
17
17
|
## Compatibility
|
|
18
18
|
|
|
19
|
-
* Formtastic
|
|
20
|
-
* Formtastic
|
|
21
|
-
* Formtastic 3 requires Rails 3.2.13 minimum
|
|
22
|
-
* Formtastic 2 requires Rails 3
|
|
19
|
+
* Formtastic 6.x requires Rails 7.2 and Ruby 3.1 minimum, inline with Rails minimum supported versions
|
|
20
|
+
* Formtastic 5.x requires Rails 6.0 and Ruby 2.6 minimum
|
|
23
21
|
* Formtastic, much like Rails, is very ActiveRecord-centric. Many are successfully using other ActiveModel-like ORMs and objects (DataMapper, MongoMapper, Mongoid, Authlogic, Devise...) but we're not guaranteeing full compatibility at this stage. Patches are welcome!
|
|
24
22
|
|
|
25
23
|
## The Story
|
|
@@ -58,7 +56,7 @@ One day, I finally had enough, so I opened up my text editor, and wrote a DSL fo
|
|
|
58
56
|
<% end %>
|
|
59
57
|
```
|
|
60
58
|
|
|
61
|
-
I also wrote the accompanying HTML output I expected, favoring something very similar to the fieldsets, lists and other semantic elements Aaron Gustafson presented in [Learning to Love Forms](https://www.slideshare.net/
|
|
59
|
+
I also wrote the accompanying HTML output I expected, favoring something very similar to the fieldsets, lists and other semantic elements Aaron Gustafson presented in [Learning to Love Forms](https://www.slideshare.net/slideshow/learning-to-love-forms-webvisions-07/45589), hacking together enough Ruby to prove it could be done.
|
|
62
60
|
|
|
63
61
|
|
|
64
62
|
## It's awesome because...
|
|
@@ -101,37 +99,12 @@ $ rails generate formtastic:install
|
|
|
101
99
|
|
|
102
100
|
## Stylesheets
|
|
103
101
|
|
|
104
|
-
|
|
102
|
+
An optional proof-of-concept stylesheet can be generated and installed into your app:
|
|
105
103
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
```css
|
|
109
|
-
# app/assets/stylesheets/application.css
|
|
110
|
-
*= require formtastic
|
|
111
|
-
*= require my_formtastic_changes
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Conditional stylesheets need to be compiled separately to prevent them being bundled and included with other application styles. Remove `require_tree .` from application.css and specify required stylesheets individually.
|
|
115
|
-
|
|
116
|
-
```css
|
|
117
|
-
# app/assets/stylesheets/ie6.css
|
|
118
|
-
*= require formtastic_ie6
|
|
119
|
-
|
|
120
|
-
# app/assets/stylesheets/ie7.css
|
|
121
|
-
*= require formtastic_ie7
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
```erb
|
|
125
|
-
# app/views/layouts/application.html.erb
|
|
126
|
-
<%= stylesheet_link_tag 'application' %>
|
|
127
|
-
<!--[if IE 6]><%= stylesheet_link_tag 'ie6' %><![endif]-->
|
|
128
|
-
<!--[if IE 7]><%= stylesheet_link_tag 'ie7' %><![endif]-->
|
|
104
|
+
```shell
|
|
105
|
+
$ rails generate formtastic:stylesheet
|
|
129
106
|
```
|
|
130
107
|
|
|
131
|
-
```ruby
|
|
132
|
-
# config/environments/production.rb
|
|
133
|
-
config.assets.precompile += %w( ie6.css ie7.css )
|
|
134
|
-
```
|
|
135
108
|
|
|
136
109
|
## Usage
|
|
137
110
|
|
|
@@ -342,7 +315,7 @@ The Formtastic input types:
|
|
|
342
315
|
* `:search` - a text field (just like string). Default for columns with name matching `"search"`. New in HTML5. Works on Safari.
|
|
343
316
|
* `:hidden` - a hidden field. Creates a hidden field (added for compatibility).
|
|
344
317
|
* `:range` - a slider field.
|
|
345
|
-
* `:datalist` - a text field with a accompanying [datalist tag](https://developer.mozilla.org/en/docs/Web/HTML/
|
|
318
|
+
* `:datalist` - a text field with a accompanying [datalist tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/datalist) which provides options for autocompletion
|
|
346
319
|
|
|
347
320
|
The comments in the code are pretty good for each of these (what it does, what the output is, what the options are, etc.) so go check it out.
|
|
348
321
|
|
|
@@ -518,7 +491,7 @@ For more flexible forms; Formtastic finds translations using a bottom-up approac
|
|
|
518
491
|
Values for `labels`/`hints`/`actions` are can take values: `String` (explicit value), `Symbol` (i18n-lookup-key relative to the current "type", e.g. actions:), `true` (force I18n lookup), `false` (force no I18n lookup). Titles (legends) can only take: `String` and `Symbol` - true/false have no meaning.
|
|
519
492
|
|
|
520
493
|
*7. Basic Translations*
|
|
521
|
-
If you want some basic translations, take a look on the [formtastic_i18n gem](https://github.com/
|
|
494
|
+
If you want some basic translations, take a look on the [formtastic_i18n gem](https://github.com/formtastic/formtastic_i18n).
|
|
522
495
|
|
|
523
496
|
## Semantic errors
|
|
524
497
|
|
|
@@ -608,25 +581,20 @@ You can use your new input with `:as => :date_picker`.
|
|
|
608
581
|
|
|
609
582
|
There are none other than Rails itself, but...
|
|
610
583
|
|
|
611
|
-
* If you want to use the `:country` input, you'll need to install the [country-select plugin](https://github.com/
|
|
584
|
+
* If you want to use the `:country` input, you'll need to install the [country-select plugin](https://github.com/countries/country_select) (or any other country_select plugin with the same API).
|
|
612
585
|
* There are a bunch of development dependencies if you plan to contribute to Formtastic
|
|
613
586
|
|
|
614
587
|
|
|
615
588
|
## How to contribute
|
|
616
589
|
|
|
617
|
-
|
|
618
|
-
* Install development dependencies (`bundle install` and `bin/appraisal install`)
|
|
619
|
-
* Create a topic branch for your changes
|
|
620
|
-
* Ensure that you provide *documentation* and *test coverage* for your changes (patches won't be accepted without)
|
|
621
|
-
* Ensure that all tests pass (`bundle exec rake`)
|
|
622
|
-
* Create a pull request on Github (these are also a great place to start a conversation around a patch as early as possible)
|
|
590
|
+
See `CONTRIBUTING.md`
|
|
623
591
|
|
|
624
592
|
|
|
625
593
|
## Project Info
|
|
626
594
|
|
|
627
|
-
Formtastic was created by [Justin French](https://
|
|
595
|
+
Formtastic was created by [Justin French](https://justinfrench.com) with contributions from around 180 awesome developers. Run `git shortlog -n -s` to see the awesome.
|
|
628
596
|
|
|
629
597
|
The project is hosted on Github: [https://github.com/formtastic/formtastic](https://github.com/formtastic/formtastic), where your contributions, forkings, comments, issues and feedback are greatly welcomed.
|
|
630
598
|
|
|
631
|
-
Copyright (c) 2007-
|
|
599
|
+
Copyright (c) 2007-2025, released under the MIT license.
|
|
632
600
|
|
data/RELEASE_PROCESS
CHANGED
data/Rakefile
CHANGED
|
@@ -25,7 +25,7 @@ namespace :appraisal do
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def for_all_gemfiles(*args)
|
|
28
|
-
Dir.glob("gemfiles
|
|
28
|
+
Dir.glob("gemfiles/*.gemfile").sort.each do |gemfile|
|
|
29
29
|
Bundler.with_original_env do
|
|
30
30
|
sh({ "APPRAISAL_INITIALIZED" => "true", "BUNDLE_GEMFILE" => gemfile }, "bundle", *args)
|
|
31
31
|
end
|
data/formtastic.gemspec
CHANGED
|
@@ -21,18 +21,25 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
22
22
|
s.extra_rdoc_files = ["README.md"]
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
s.
|
|
26
|
-
s.rubygems_version = %q{1.3.6}
|
|
24
|
+
# Minimum Ruby version is probably the same as whatever the minimum Rails version currently expects.
|
|
25
|
+
s.required_ruby_version = '>= 3.1.0'
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
# Minimum Ruby Gems version also matches whatever the minimum Rails version currently expects.
|
|
28
|
+
s.required_rubygems_version = ">= 1.8.11"
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
s.
|
|
30
|
+
# User dependency is really just Rails, where we want describe the minimum version we support,
|
|
31
|
+
# which is probably the oldest version that hasn't reached end-of-life for security updates.
|
|
32
|
+
s.add_dependency(%q<actionpack>, [">= 7.2.0"])
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
# Development dependencies (for people working on Formtastic) are different to the minimum support
|
|
35
|
+
# version. Instead of specifying a specific version of each, we just specify the stack, and let the
|
|
36
|
+
# details of which versions work with each version of rails be managed in the Appraisal.
|
|
37
|
+
s.add_development_dependency(%q<appraisal>)
|
|
38
|
+
s.add_development_dependency(%q<rspec-rails>)
|
|
39
|
+
s.add_development_dependency(%q<rspec-dom-testing>)
|
|
40
|
+
s.add_development_dependency(%q<rspec-mocks>)
|
|
41
|
+
s.add_development_dependency(%q<yard>)
|
|
42
|
+
s.add_development_dependency(%q<ammeter>)
|
|
36
43
|
s.add_development_dependency(%q<rake>)
|
|
37
|
-
s.add_development_dependency(%q<sqlite3
|
|
44
|
+
s.add_development_dependency(%q<sqlite3>)
|
|
38
45
|
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "actionpack", git: "https://github.com/rails/rails.git", branch: "main"
|
|
6
|
+
gem "activesupport", git: "https://github.com/rails/rails.git", branch: "main"
|
|
7
|
+
gem "activerecord", git: "https://github.com/rails/rails.git", branch: "main"
|
|
8
|
+
|
|
9
|
+
gemspec path: "../"
|
|
@@ -6,7 +6,7 @@ module Formtastic
|
|
|
6
6
|
# wrapper. This the default for `:submit` and `:reset` actions, but `:as => :button` is also
|
|
7
7
|
# available as an alternative.
|
|
8
8
|
#
|
|
9
|
-
# @example The `:as` can be
|
|
9
|
+
# @example The `:as` can be omitted, these are functionally equivalent
|
|
10
10
|
# <%= f.action :submit, :as => :input %>
|
|
11
11
|
# <%= f.action :submit %>
|
|
12
12
|
#
|
|
@@ -5,7 +5,7 @@ module Formtastic
|
|
|
5
5
|
# The link's URL defaults to Rails' built-in `:back` macro (the HTTP referrer, or Javascript for the
|
|
6
6
|
# browser's history), but can be altered with the `:url` option.
|
|
7
7
|
#
|
|
8
|
-
# @example The `:as` can be
|
|
8
|
+
# @example The `:as` can be omitted, these are functionally equivalent
|
|
9
9
|
# <%= f.action :cancel, :as => :link %>
|
|
10
10
|
# <%= f.action :cancel %>
|
|
11
11
|
#
|
|
@@ -16,40 +16,40 @@ module Formtastic
|
|
|
16
16
|
self.send(:"#{name}=", default)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
configure :
|
|
21
|
-
configure :
|
|
22
|
-
configure :default_text_area_width
|
|
19
|
+
# Check {Formtastic::ActionClassFinder} to see how are inputs resolved.
|
|
20
|
+
configure :action_class_finder, Formtastic::ActionClassFinder
|
|
21
|
+
configure :action_namespaces, [::Object, ::Formtastic::Actions]
|
|
23
22
|
configure :all_fields_required_by_default, true
|
|
24
|
-
configure :include_blank_for_select_by_default, true
|
|
25
|
-
configure :required_string, proc { %{<abbr title="#{Formtastic::I18n.t(:required)}">*</abbr>}.html_safe }
|
|
26
|
-
configure :optional_string, ''
|
|
27
|
-
configure :inline_errors, :sentence
|
|
28
|
-
configure :label_str_method, :humanize
|
|
29
23
|
configure :collection_label_methods, %w[to_label display_name full_name name title username login value to_s]
|
|
30
24
|
configure :collection_value_methods, %w[id to_s]
|
|
31
|
-
configure :
|
|
32
|
-
configure :file_metadata_suffixes, ['content_type', 'file_name', 'file_size']
|
|
33
|
-
configure :priority_countries, ["Australia", "Canada", "United Kingdom", "United States"]
|
|
34
|
-
configure :i18n_lookups_by_default, true
|
|
35
|
-
configure :i18n_cache_lookups, true
|
|
36
|
-
configure :i18n_localizer, Formtastic::Localizer
|
|
37
|
-
configure :escape_html_entities_in_hints_and_labels, true
|
|
25
|
+
configure :custom_namespace
|
|
38
26
|
configure :default_commit_button_accesskey
|
|
39
|
-
configure :default_inline_error_class, 'inline-errors'
|
|
40
27
|
configure :default_error_list_class, 'errors'
|
|
41
28
|
configure :default_hint_class, 'inline-hints'
|
|
42
|
-
configure :
|
|
43
|
-
configure :
|
|
29
|
+
configure :default_inline_error_class, 'inline-errors'
|
|
30
|
+
configure :default_text_area_height, 20
|
|
31
|
+
configure :default_text_area_width
|
|
32
|
+
configure :default_text_field_size
|
|
33
|
+
configure :escape_html_entities_in_hints_and_labels, true
|
|
34
|
+
configure :file_metadata_suffixes, ['content_type', 'file_name', 'file_size']
|
|
35
|
+
configure :file_methods, [ :file?, :public_filename, :filename ]
|
|
36
|
+
configure :i18n_cache_lookups, true
|
|
37
|
+
configure :i18n_localizer, Formtastic::Localizer
|
|
38
|
+
configure :i18n_lookups_by_default, true
|
|
39
|
+
configure :include_blank_for_select_by_default, true
|
|
40
|
+
configure :inline_errors, :sentence
|
|
44
41
|
# Check {Formtastic::InputClassFinder} to see how are inputs resolved.
|
|
45
|
-
configure :input_namespaces, [::Object, ::Formtastic::Inputs]
|
|
46
42
|
configure :input_class_finder, Formtastic::InputClassFinder
|
|
47
|
-
|
|
48
|
-
configure :
|
|
49
|
-
configure :
|
|
50
|
-
|
|
51
|
-
configure :
|
|
43
|
+
configure :input_namespaces, [::Object, ::Formtastic::Inputs]
|
|
44
|
+
configure :label_str_method, :humanize
|
|
45
|
+
configure :optional_string, ''
|
|
46
|
+
configure :perform_browser_validations, false
|
|
47
|
+
configure :priority_countries, ["Australia", "Canada", "United Kingdom", "United States"]
|
|
52
48
|
configure :priority_time_zones, []
|
|
49
|
+
configure :required_string, proc { %{<abbr title="#{Formtastic::I18n.t(:required)}">*</abbr>}.html_safe }
|
|
50
|
+
configure :semantic_errors_link_to_inputs, false
|
|
51
|
+
configure :skipped_columns, [:created_at, :updated_at, :created_on, :updated_on, :lock_version, :version]
|
|
52
|
+
configure :use_required_attribute, false
|
|
53
53
|
|
|
54
54
|
attr_reader :template
|
|
55
55
|
|
|
@@ -71,8 +71,8 @@ module Formtastic
|
|
|
71
71
|
# When constructing a `fields_for` form fragment *outside* of `semantic_form_for`, please use
|
|
72
72
|
# `Formtastic::Helpers::FormHelper#semantic_fields_for`.
|
|
73
73
|
#
|
|
74
|
-
# @see
|
|
75
|
-
# @see
|
|
74
|
+
# @see https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-fields_for ActionView::Helpers::FormBuilder#fields_for
|
|
75
|
+
# @see https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for ActionView::Helpers::FormHelper#fields_for
|
|
76
76
|
# @see Formtastic::Helpers::FormHelper#semantic_fields_for
|
|
77
77
|
#
|
|
78
78
|
# @example
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Formtastic
|
|
3
3
|
module Helpers
|
|
4
|
-
# ActionsHelper encapsulates the
|
|
4
|
+
# ActionsHelper encapsulates the responsibilities of the {#actions} DSL for acting on
|
|
5
5
|
# (submitting, cancelling, resetting) forms.
|
|
6
6
|
#
|
|
7
7
|
# {#actions} is a block helper used to wrap the form's actions (buttons, links) in a
|