formtastic 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +13 -13
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +99 -64
- data/README.md +7 -2
- data/formtastic.gemspec +5 -3
- data/gemfiles/{rails_5.2 → rails_7.0}/Gemfile +1 -1
- data/gemfiles/rails_7.1/Gemfile +5 -0
- data/gemfiles/rails_edge/Gemfile +1 -1
- data/lib/formtastic/action_class_finder.rb +1 -0
- data/lib/formtastic/actions/base.rb +1 -0
- data/lib/formtastic/actions/button_action.rb +1 -0
- data/lib/formtastic/actions/buttonish.rb +1 -0
- data/lib/formtastic/actions/input_action.rb +1 -0
- data/lib/formtastic/actions/link_action.rb +1 -0
- data/lib/formtastic/actions.rb +1 -0
- data/lib/formtastic/deprecation.rb +2 -1
- data/lib/formtastic/engine.rb +1 -0
- data/lib/formtastic/form_builder.rb +1 -0
- data/lib/formtastic/helpers/action_helper.rb +1 -0
- data/lib/formtastic/helpers/actions_helper.rb +1 -0
- data/lib/formtastic/helpers/enum.rb +1 -0
- data/lib/formtastic/helpers/errors_helper.rb +1 -0
- data/lib/formtastic/helpers/fieldset_wrapper.rb +1 -0
- data/lib/formtastic/helpers/file_column_detection.rb +1 -0
- data/lib/formtastic/helpers/form_helper.rb +1 -0
- data/lib/formtastic/helpers/input_helper.rb +2 -4
- data/lib/formtastic/helpers/inputs_helper.rb +2 -1
- data/lib/formtastic/helpers/reflection.rb +1 -0
- data/lib/formtastic/helpers.rb +1 -1
- data/lib/formtastic/html_attributes.rb +1 -0
- data/lib/formtastic/i18n.rb +1 -0
- data/lib/formtastic/input_class_finder.rb +1 -0
- data/lib/formtastic/inputs/base/associations.rb +1 -0
- data/lib/formtastic/inputs/base/choices.rb +2 -1
- data/lib/formtastic/inputs/base/collections.rb +4 -1
- data/lib/formtastic/inputs/base/database.rb +5 -7
- data/lib/formtastic/inputs/base/datetime_pickerish.rb +1 -0
- data/lib/formtastic/inputs/base/errors.rb +3 -2
- data/lib/formtastic/inputs/base/fileish.rb +1 -0
- data/lib/formtastic/inputs/base/hints.rb +1 -0
- data/lib/formtastic/inputs/base/html.rb +2 -1
- data/lib/formtastic/inputs/base/labelling.rb +3 -2
- data/lib/formtastic/inputs/base/naming.rb +1 -0
- data/lib/formtastic/inputs/base/numeric.rb +1 -0
- data/lib/formtastic/inputs/base/options.rb +1 -0
- data/lib/formtastic/inputs/base/placeholder.rb +1 -0
- data/lib/formtastic/inputs/base/stringish.rb +1 -0
- data/lib/formtastic/inputs/base/timeish.rb +4 -3
- data/lib/formtastic/inputs/base/validations.rb +2 -1
- data/lib/formtastic/inputs/base/wrapping.rb +1 -0
- data/lib/formtastic/inputs/base.rb +3 -2
- data/lib/formtastic/inputs/boolean_input.rb +2 -1
- data/lib/formtastic/inputs/check_boxes_input.rb +2 -1
- data/lib/formtastic/inputs/color_input.rb +1 -0
- data/lib/formtastic/inputs/country_input.rb +1 -0
- data/lib/formtastic/inputs/datalist_input.rb +1 -0
- data/lib/formtastic/inputs/date_picker_input.rb +1 -0
- data/lib/formtastic/inputs/date_select_input.rb +1 -0
- data/lib/formtastic/inputs/datetime_picker_input.rb +1 -0
- data/lib/formtastic/inputs/datetime_select_input.rb +1 -0
- data/lib/formtastic/inputs/email_input.rb +1 -0
- data/lib/formtastic/inputs/file_input.rb +1 -0
- data/lib/formtastic/inputs/hidden_input.rb +3 -2
- data/lib/formtastic/inputs/number_input.rb +1 -0
- data/lib/formtastic/inputs/password_input.rb +1 -0
- data/lib/formtastic/inputs/phone_input.rb +1 -0
- data/lib/formtastic/inputs/radio_input.rb +1 -0
- data/lib/formtastic/inputs/range_input.rb +1 -0
- data/lib/formtastic/inputs/search_input.rb +1 -0
- data/lib/formtastic/inputs/select_input.rb +1 -0
- data/lib/formtastic/inputs/string_input.rb +1 -0
- data/lib/formtastic/inputs/text_input.rb +1 -0
- data/lib/formtastic/inputs/time_picker_input.rb +1 -0
- data/lib/formtastic/inputs/time_select_input.rb +1 -0
- data/lib/formtastic/inputs/time_zone_input.rb +1 -0
- data/lib/formtastic/inputs/url_input.rb +1 -0
- data/lib/formtastic/inputs.rb +1 -0
- data/lib/formtastic/localized_string.rb +1 -0
- data/lib/formtastic/localizer.rb +1 -0
- data/lib/formtastic/namespaced_class_finder.rb +7 -8
- data/lib/formtastic/version.rb +2 -1
- data/lib/formtastic.rb +1 -0
- data/lib/generators/formtastic/form/form_generator.rb +1 -0
- data/lib/generators/formtastic/input/input_generator.rb +1 -0
- data/lib/generators/formtastic/install/install_generator.rb +1 -0
- data/lib/generators/templates/formtastic.rb +1 -0
- data/script/integration-template.rb +2 -3
- data/spec/action_class_finder_spec.rb +1 -0
- data/spec/actions/button_action_spec.rb +17 -16
- data/spec/actions/generic_action_spec.rb +130 -129
- data/spec/actions/input_action_spec.rb +16 -15
- data/spec/actions/link_action_spec.rb +25 -24
- data/spec/builder/custom_builder_spec.rb +5 -4
- data/spec/builder/error_proc_spec.rb +2 -1
- data/spec/builder/semantic_fields_for_spec.rb +26 -25
- data/spec/fast_spec_helper.rb +1 -0
- data/spec/generators/formtastic/form/form_generator_spec.rb +8 -7
- data/spec/generators/formtastic/input/input_generator_spec.rb +1 -0
- data/spec/generators/formtastic/install/install_generator_spec.rb +1 -0
- data/spec/helpers/action_helper_spec.rb +15 -14
- data/spec/helpers/actions_helper_spec.rb +42 -41
- data/spec/helpers/form_helper_spec.rb +26 -19
- data/spec/helpers/input_helper_spec.rb +70 -69
- data/spec/helpers/inputs_helper_spec.rb +179 -179
- data/spec/helpers/reflection_helper_spec.rb +4 -3
- data/spec/helpers/semantic_errors_helper_spec.rb +4 -3
- data/spec/i18n_spec.rb +13 -12
- data/spec/input_class_finder_spec.rb +1 -0
- data/spec/inputs/base/collections_spec.rb +2 -0
- data/spec/inputs/base/validations_spec.rb +1 -0
- data/spec/inputs/boolean_input_spec.rb +66 -65
- data/spec/inputs/check_boxes_input_spec.rb +89 -88
- data/spec/inputs/color_input_spec.rb +7 -6
- data/spec/inputs/country_input_spec.rb +10 -9
- data/spec/inputs/custom_input_spec.rb +1 -0
- data/spec/inputs/datalist_input_spec.rb +2 -1
- data/spec/inputs/date_picker_input_spec.rb +109 -108
- data/spec/inputs/date_select_input_spec.rb +63 -62
- data/spec/inputs/datetime_picker_input_spec.rb +118 -117
- data/spec/inputs/datetime_select_input_spec.rb +72 -71
- data/spec/inputs/email_input_spec.rb +16 -15
- data/spec/inputs/file_input_spec.rb +17 -16
- data/spec/inputs/hidden_input_spec.rb +29 -28
- data/spec/inputs/include_blank_spec.rb +7 -6
- data/spec/inputs/label_spec.rb +25 -24
- data/spec/inputs/number_input_spec.rb +159 -158
- data/spec/inputs/password_input_spec.rb +16 -15
- data/spec/inputs/phone_input_spec.rb +16 -15
- data/spec/inputs/placeholder_spec.rb +17 -16
- data/spec/inputs/radio_input_spec.rb +58 -57
- data/spec/inputs/range_input_spec.rb +108 -107
- data/spec/inputs/readonly_spec.rb +5 -4
- data/spec/inputs/search_input_spec.rb +15 -14
- data/spec/inputs/select_input_spec.rb +144 -93
- data/spec/inputs/string_input_spec.rb +36 -35
- data/spec/inputs/text_input_spec.rb +32 -31
- data/spec/inputs/time_picker_input_spec.rb +110 -109
- data/spec/inputs/time_select_input_spec.rb +71 -70
- data/spec/inputs/time_zone_input_spec.rb +21 -20
- data/spec/inputs/url_input_spec.rb +16 -15
- data/spec/inputs/with_options_spec.rb +8 -7
- data/spec/localizer_spec.rb +1 -0
- data/spec/namespaced_class_finder_spec.rb +17 -5
- data/spec/schema.rb +1 -0
- data/spec/spec_helper.rb +8 -8
- data/spec/support/custom_macros.rb +64 -63
- data/spec/support/deprecation.rb +2 -1
- data/spec/support/shared_examples.rb +2 -1
- data/spec/support/specialized_class_finder_shared_example.rb +1 -0
- data/spec/support/test_environment.rb +1 -0
- metadata +29 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70272678a1b436280de8d89add80583ca886cac153f6d4e43be93e6a641c344f
|
4
|
+
data.tar.gz: d2549407b0a3c5d21e7afe24cfd21bd008c9ca957bd06cf2d59fb7b3101fa042
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4164b15cb0dc3eb5d2d90f257977d59b8459a1708f4520ba6ff1708eaf9dd898f2713d9f59945c1d50c2b481e2175c0e3d7af6259c9f1e715a836aac0dd0e53b
|
7
|
+
data.tar.gz: e93800c9ca16ea4afb445f5a95cb56e1dd0224f06654ef8af7b13dba8ddb4c520e09c4b49c760d10a7e71d6f381f9b6fb91bbe61e26e1cab83823c7e2dc827de
|
data/.github/workflows/test.yml
CHANGED
@@ -5,6 +5,11 @@ on:
|
|
5
5
|
pull_request:
|
6
6
|
|
7
7
|
jobs:
|
8
|
+
ci:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
needs: test
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
8
13
|
test:
|
9
14
|
runs-on: ubuntu-20.04
|
10
15
|
|
@@ -13,31 +18,25 @@ jobs:
|
|
13
18
|
|
14
19
|
matrix:
|
15
20
|
gemfile:
|
16
|
-
- gemfiles/rails_5.2/Gemfile
|
17
21
|
- gemfiles/rails_6.0/Gemfile
|
18
22
|
- gemfiles/rails_6.1/Gemfile
|
23
|
+
- gemfiles/rails_7.0/Gemfile
|
24
|
+
- gemfiles/rails_7.1/Gemfile
|
19
25
|
- gemfiles/rails_edge/Gemfile
|
20
26
|
|
21
27
|
ruby:
|
22
|
-
- 2.4.10
|
23
|
-
- 2.5.8
|
24
28
|
- 2.6.6
|
25
29
|
- 2.7.2
|
26
30
|
- 3.0.0
|
27
31
|
|
28
32
|
exclude:
|
29
|
-
- ruby: 2.
|
30
|
-
gemfile: gemfiles/
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
- ruby: 2.4.10
|
33
|
+
- ruby: 2.6.6
|
34
|
+
gemfile: gemfiles/rails_7.0/Gemfile
|
35
|
+
- ruby: 2.6.6
|
36
|
+
gemfile: gemfiles/rails_7.1/Gemfile
|
37
|
+
- ruby: 2.6.6
|
36
38
|
gemfile: gemfiles/rails_edge/Gemfile
|
37
39
|
|
38
|
-
- ruby: 3.0.0
|
39
|
-
gemfile: gemfiles/rails_5.2/Gemfile
|
40
|
-
|
41
40
|
env:
|
42
41
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
43
42
|
|
@@ -53,6 +52,7 @@ jobs:
|
|
53
52
|
with:
|
54
53
|
ruby-version: ${{ matrix.ruby }}
|
55
54
|
bundler-cache: true
|
55
|
+
bundler: latest
|
56
56
|
|
57
57
|
- name: Run tests
|
58
58
|
run: |
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
##
|
1
|
+
## 5.0.0
|
2
|
+
* Added support for Rails 7.1 ([#1371](https://github.com/formtastic/formtastic/pull/1371))
|
3
|
+
* Removed support for Rails < 6.0.0 ([#1354](https://github.com/formtastic/formtastic/pull/1354))
|
4
|
+
* Removed support for Rubies < 2.6.0 ([#1332](https://github.com/formtastic/formtastic/pull/1332), [#1355](https://github.com/formtastic/formtastic.git/pull/1355))
|
5
|
+
* Added support for scopes in relations ([#1343](https://github.com/formtastic/formtastic/pull/1343))
|
6
|
+
* Fixed I18n lookup for enum values in nested select fields ([#1342](https://github.com/formtastic/formtastic/pull/1342))
|
7
|
+
* Fixed faster input class lookup ([#1336](https://github.com/formtastic/formtastic/pull/1336))
|
8
|
+
* Use frozen_string_literal internally ([#1339](https://github.com/formtastic/formtastic/pull/1339))
|
9
|
+
|
10
|
+
## 4.0.0
|
2
11
|
* Fixed default_columns_for_object when object has non-standard foreign keys (#1241)
|
3
12
|
* Fixed missing constants in production (#911)
|
4
13
|
* Removed support for Rails 3 and 4.0 (#1108)
|
data/Gemfile.lock
CHANGED
@@ -1,93 +1,127 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
formtastic (4.0.0
|
5
|
-
actionpack (>=
|
4
|
+
formtastic (4.0.0)
|
5
|
+
actionpack (>= 6.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (
|
11
|
-
actionview (=
|
12
|
-
activesupport (=
|
13
|
-
|
10
|
+
actionpack (7.1.1)
|
11
|
+
actionview (= 7.1.1)
|
12
|
+
activesupport (= 7.1.1)
|
13
|
+
nokogiri (>= 1.8.5)
|
14
|
+
rack (>= 2.2.4)
|
15
|
+
rack-session (>= 1.0.1)
|
14
16
|
rack-test (>= 0.6.3)
|
15
|
-
rails-dom-testing (~> 2.
|
16
|
-
rails-html-sanitizer (~> 1.
|
17
|
-
actionview (
|
18
|
-
activesupport (=
|
17
|
+
rails-dom-testing (~> 2.2)
|
18
|
+
rails-html-sanitizer (~> 1.6)
|
19
|
+
actionview (7.1.1)
|
20
|
+
activesupport (= 7.1.1)
|
19
21
|
builder (~> 3.1)
|
20
|
-
erubi (~> 1.
|
21
|
-
rails-dom-testing (~> 2.
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
activesupport (
|
22
|
+
erubi (~> 1.11)
|
23
|
+
rails-dom-testing (~> 2.2)
|
24
|
+
rails-html-sanitizer (~> 1.6)
|
25
|
+
activesupport (7.1.1)
|
26
|
+
base64
|
27
|
+
bigdecimal
|
24
28
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
29
|
+
connection_pool (>= 2.2.5)
|
30
|
+
drb
|
25
31
|
i18n (>= 1.6, < 2)
|
26
32
|
minitest (>= 5.1)
|
33
|
+
mutex_m
|
27
34
|
tzinfo (~> 2.0)
|
28
|
-
|
29
|
-
ammeter (1.1.4)
|
35
|
+
ammeter (1.1.5)
|
30
36
|
activesupport (>= 3.0)
|
31
37
|
railties (>= 3.0)
|
32
38
|
rspec-rails (>= 2.2)
|
39
|
+
base64 (0.1.1)
|
40
|
+
bigdecimal (3.1.4)
|
33
41
|
builder (3.2.4)
|
34
|
-
concurrent-ruby (1.
|
42
|
+
concurrent-ruby (1.2.2)
|
43
|
+
connection_pool (2.4.1)
|
35
44
|
crass (1.0.6)
|
36
|
-
diff-lcs (1.
|
37
|
-
|
38
|
-
|
45
|
+
diff-lcs (1.5.0)
|
46
|
+
drb (2.1.1)
|
47
|
+
ruby2_keywords
|
48
|
+
erubi (1.12.0)
|
49
|
+
i18n (1.14.1)
|
39
50
|
concurrent-ruby (~> 1.0)
|
40
|
-
|
51
|
+
io-console (0.6.0)
|
52
|
+
irb (1.8.1)
|
53
|
+
rdoc
|
54
|
+
reline (>= 0.3.8)
|
55
|
+
loofah (2.21.4)
|
41
56
|
crass (~> 1.0.2)
|
42
|
-
nokogiri (>= 1.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
nokogiri (1.
|
47
|
-
mini_portile2 (~> 2.
|
57
|
+
nokogiri (>= 1.12.0)
|
58
|
+
mini_portile2 (2.8.4)
|
59
|
+
minitest (5.20.0)
|
60
|
+
mutex_m (0.1.2)
|
61
|
+
nokogiri (1.15.4)
|
62
|
+
mini_portile2 (~> 2.8.2)
|
48
63
|
racc (~> 1.4)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
64
|
+
psych (5.1.1)
|
65
|
+
stringio
|
66
|
+
racc (1.7.1)
|
67
|
+
rack (3.0.8)
|
68
|
+
rack-session (2.0.0)
|
69
|
+
rack (>= 3.0.0)
|
70
|
+
rack-test (2.1.0)
|
71
|
+
rack (>= 1.3)
|
72
|
+
rackup (2.1.0)
|
73
|
+
rack (>= 3)
|
74
|
+
webrick (~> 1.8)
|
75
|
+
rails-dom-testing (2.2.0)
|
76
|
+
activesupport (>= 5.0.0)
|
77
|
+
minitest
|
55
78
|
nokogiri (>= 1.6)
|
56
|
-
rails-html-sanitizer (1.
|
57
|
-
loofah (~> 2.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
79
|
+
rails-html-sanitizer (1.6.0)
|
80
|
+
loofah (~> 2.21)
|
81
|
+
nokogiri (~> 1.14)
|
82
|
+
railties (7.1.1)
|
83
|
+
actionpack (= 7.1.1)
|
84
|
+
activesupport (= 7.1.1)
|
85
|
+
irb
|
86
|
+
rackup (>= 1.0.0)
|
87
|
+
rake (>= 12.2)
|
88
|
+
thor (~> 1.0, >= 1.2.2)
|
89
|
+
zeitwerk (~> 2.6)
|
90
|
+
rake (13.0.6)
|
91
|
+
rdoc (6.5.0)
|
92
|
+
psych (>= 4.0.0)
|
93
|
+
reline (0.3.9)
|
94
|
+
io-console (~> 0.5)
|
95
|
+
rspec-core (3.12.2)
|
96
|
+
rspec-support (~> 3.12.0)
|
67
97
|
rspec-dom-testing (0.1.0)
|
68
98
|
rails-dom-testing (>= 1.0, < 3)
|
69
99
|
rspec-expectations (~> 3.0)
|
70
|
-
rspec-expectations (3.
|
100
|
+
rspec-expectations (3.12.3)
|
71
101
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
-
rspec-support (~> 3.
|
73
|
-
rspec-mocks (3.
|
102
|
+
rspec-support (~> 3.12.0)
|
103
|
+
rspec-mocks (3.12.6)
|
74
104
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
-
rspec-support (~> 3.
|
76
|
-
rspec-rails (
|
77
|
-
actionpack (>=
|
78
|
-
activesupport (>=
|
79
|
-
railties (>=
|
80
|
-
rspec-core (~> 3.
|
81
|
-
rspec-expectations (~> 3.
|
82
|
-
rspec-mocks (~> 3.
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-support (3.
|
85
|
-
|
86
|
-
|
87
|
-
|
105
|
+
rspec-support (~> 3.12.0)
|
106
|
+
rspec-rails (6.0.3)
|
107
|
+
actionpack (>= 6.1)
|
108
|
+
activesupport (>= 6.1)
|
109
|
+
railties (>= 6.1)
|
110
|
+
rspec-core (~> 3.12)
|
111
|
+
rspec-expectations (~> 3.12)
|
112
|
+
rspec-mocks (~> 3.12)
|
113
|
+
rspec-support (~> 3.12)
|
114
|
+
rspec-support (3.12.1)
|
115
|
+
ruby2_keywords (0.0.5)
|
116
|
+
sqlite3 (1.6.7)
|
117
|
+
mini_portile2 (~> 2.8.0)
|
118
|
+
stringio (3.0.8)
|
119
|
+
thor (1.2.2)
|
120
|
+
tzinfo (2.0.6)
|
88
121
|
concurrent-ruby (~> 1.0)
|
89
|
-
|
90
|
-
|
122
|
+
webrick (1.8.1)
|
123
|
+
yard (0.9.34)
|
124
|
+
zeitwerk (2.6.12)
|
91
125
|
|
92
126
|
PLATFORMS
|
93
127
|
ruby
|
@@ -97,9 +131,10 @@ DEPENDENCIES
|
|
97
131
|
formtastic!
|
98
132
|
rake
|
99
133
|
rspec-dom-testing (>= 0.1.0)
|
100
|
-
rspec-
|
134
|
+
rspec-mocks (~> 3.12.2)
|
135
|
+
rspec-rails (>= 4.0)
|
101
136
|
sqlite3 (~> 1.4)
|
102
137
|
yard (~> 0.9.20)
|
103
138
|
|
104
139
|
BUNDLED WITH
|
105
|
-
2.
|
140
|
+
2.3.18
|
data/README.md
CHANGED
@@ -16,7 +16,8 @@ Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far e
|
|
16
16
|
|
17
17
|
## Compatibility
|
18
18
|
|
19
|
-
* Formtastic
|
19
|
+
* Formtastic 5 requires Rails 6.0 and Ruby 2.6 minimum
|
20
|
+
* Formtastic 4 requires Rails 5.2 and Ruby 2.4 minimum
|
20
21
|
* Formtastic 3 requires Rails 3.2.13 minimum
|
21
22
|
* Formtastic 2 requires Rails 3
|
22
23
|
* 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!
|
@@ -88,7 +89,7 @@ I also wrote the accompanying HTML output I expected, favoring something very si
|
|
88
89
|
Simply add Formtastic to your Gemfile and bundle it up:
|
89
90
|
|
90
91
|
```ruby
|
91
|
-
gem 'formtastic', '~>
|
92
|
+
gem 'formtastic', '~> 5.0'
|
92
93
|
```
|
93
94
|
|
94
95
|
Run the installation generator:
|
@@ -570,6 +571,10 @@ To create your own new types of inputs based on existing inputs, the process is
|
|
570
571
|
def input_html_options
|
571
572
|
super.merge(:class => "flexible-text-area")
|
572
573
|
end
|
574
|
+
|
575
|
+
def options
|
576
|
+
super.merge(hint: 'This is a flexible text area')
|
577
|
+
end
|
573
578
|
end
|
574
579
|
```
|
575
580
|
|
data/formtastic.gemspec
CHANGED
@@ -21,14 +21,16 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
22
22
|
s.extra_rdoc_files = ["README.md"]
|
23
23
|
|
24
|
-
s.required_ruby_version = '>= 2.
|
24
|
+
s.required_ruby_version = '>= 2.6.0'
|
25
25
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
26
26
|
s.rubygems_version = %q{1.3.6}
|
27
27
|
|
28
|
-
s.add_dependency(%q<actionpack>, [">=
|
28
|
+
s.add_dependency(%q<actionpack>, [">= 6.0.0"])
|
29
29
|
|
30
|
-
s.add_development_dependency(%q<rspec-rails>, ["
|
30
|
+
s.add_development_dependency(%q<rspec-rails>, [">= 4.0"])
|
31
31
|
s.add_development_dependency(%q<rspec-dom-testing>, [">= 0.1.0"])
|
32
|
+
s.add_development_dependency(%q<rspec-mocks>, ["~> 3.12.2"])
|
33
|
+
|
32
34
|
s.add_development_dependency(%q<yard>, ["~> 0.9.20"])
|
33
35
|
s.add_development_dependency(%q<ammeter>, ["~> 1.1.3"])
|
34
36
|
s.add_development_dependency(%q<rake>)
|
data/gemfiles/rails_edge/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem "rails", git: "https://github.com/rails/rails.git"
|
3
|
+
gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
|
4
4
|
gem "rack", git: "https://github.com/rack/rack.git"
|
5
5
|
gem "i18n", git: "https://github.com/svenfuchs/i18n.git"
|
6
6
|
gem "arel", git: "https://github.com/rails/arel.git"
|
data/lib/formtastic/actions.rb
CHANGED
data/lib/formtastic/engine.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
module Formtastic
|
3
4
|
module Helpers
|
4
5
|
|
@@ -310,10 +311,7 @@ module Formtastic
|
|
310
311
|
when @object.class.respond_to?(:column_for_attribute)
|
311
312
|
@object.class.column_for_attribute(method)
|
312
313
|
when @object.respond_to?(:column_for_attribute)
|
313
|
-
|
314
|
-
ActiveSupport::Deprecation.silence do
|
315
|
-
@object.column_for_attribute(method)
|
316
|
-
end
|
314
|
+
@object.column_for_attribute(method)
|
317
315
|
else nil
|
318
316
|
end
|
319
317
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Formtastic
|
2
3
|
module Helpers
|
3
4
|
|
@@ -377,7 +378,7 @@ module Formtastic
|
|
377
378
|
args << options.merge!(:parent => { :builder => self, :for => options[:for] })
|
378
379
|
|
379
380
|
fields_for_block = if block_given?
|
380
|
-
raise ArgumentError, 'You gave :for option with a block to inputs method, '
|
381
|
+
raise ArgumentError, 'You gave :for option with a block to inputs method, ' +
|
381
382
|
'but the block does not accept any argument.' if block.arity <= 0
|
382
383
|
lambda do |f|
|
383
384
|
contents = f.inputs(*args) do
|
data/lib/formtastic/helpers.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Formtastic
|
2
3
|
module Helpers
|
3
|
-
autoload :ButtonsHelper, 'formtastic/helpers/buttons_helper'
|
4
4
|
autoload :ActionHelper, 'formtastic/helpers/action_helper'
|
5
5
|
autoload :ActionsHelper, 'formtastic/helpers/actions_helper'
|
6
6
|
autoload :ErrorsHelper, 'formtastic/helpers/errors_helper'
|
data/lib/formtastic/i18n.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Formtastic
|
2
3
|
module Inputs
|
3
4
|
module Base
|
@@ -78,6 +79,8 @@ module Formtastic
|
|
78
79
|
) if reflection.options[:polymorphic] == true
|
79
80
|
end
|
80
81
|
|
82
|
+
return reflection.klass.merge(reflection.scope) if reflection.scope
|
83
|
+
|
81
84
|
conditions_from_reflection = (reflection.respond_to?(:options) && reflection.options[:conditions]) || {}
|
82
85
|
conditions_from_reflection = conditions_from_reflection.call if conditions_from_reflection.is_a?(Proc)
|
83
86
|
|
@@ -114,7 +117,7 @@ module Formtastic
|
|
114
117
|
|
115
118
|
enum_options_hash = object.defined_enums[method_name]
|
116
119
|
enum_options_hash.map do |name, value|
|
117
|
-
key = "activerecord.attributes.#{
|
120
|
+
key = "activerecord.attributes.#{object.model_name.i18n_key}.#{method_name.pluralize}.#{name}"
|
118
121
|
label = ::I18n.translate(key, :default => name.humanize)
|
119
122
|
[label, name]
|
120
123
|
end
|
@@ -1,21 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Formtastic
|
2
3
|
module Inputs
|
3
4
|
module Base
|
4
5
|
module Database
|
5
|
-
|
6
|
+
|
6
7
|
def column
|
7
8
|
if object.respond_to?(:column_for_attribute)
|
8
|
-
|
9
|
-
ActiveSupport::Deprecation.silence do
|
10
|
-
object.column_for_attribute(method)
|
11
|
-
end
|
9
|
+
object.column_for_attribute(method)
|
12
10
|
end
|
13
11
|
end
|
14
|
-
|
12
|
+
|
15
13
|
def column?
|
16
14
|
!column.nil?
|
17
15
|
end
|
18
|
-
|
16
|
+
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Formtastic
|
2
3
|
module Inputs
|
3
4
|
module Base
|
4
5
|
module Errors
|
5
6
|
|
6
7
|
def error_html
|
7
|
-
errors? ? send(:"error_#{builder.inline_errors}_html") : ""
|
8
|
+
errors? ? send(:"error_#{builder.inline_errors}_html") : +""
|
8
9
|
end
|
9
10
|
|
10
11
|
def error_sentence_html
|
@@ -27,7 +28,7 @@ module Formtastic
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def error_none_html
|
30
|
-
""
|
31
|
+
+""
|
31
32
|
end
|
32
33
|
|
33
34
|
def errors?
|