simple_form 3.4.0 → 3.5.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.
Potentially problematic release.
This version of simple_form might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -5
- data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +2 -2
- data/lib/simple_form/version.rb +1 -1
- data/test/form_builder/general_test.rb +17 -0
- data/test/support/mock_controller.rb +3 -1
- data/test/support/models.rb +9 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21876f0dc22464c3d3cc192c6cb1b387d87a3ffa
|
4
|
+
data.tar.gz: 5dca755be1ecf07cf96360b81c338333787976fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdda2693ca2da6c6b33e393b960969c46de2a1fbea4475cb412429020bb029c4ce1e6fb210e7bfeb6f7e5d19630b9b68f6f89f29eaf02cb200ecf36d22d3ff60
|
7
|
+
data.tar.gz: 912d804b0b3d7b832b7ddc1a1f3e1a57a88fe5ed2d9907d472bd12a3882e1b1b2442e0eae2a95dd9abaa1fa2f4cd74832f6f80ed17144162d6b528ce7d5856ee
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -113,7 +113,7 @@ an error, or even a placeholder. For boolean inputs, you can add an inline label
|
|
113
113
|
<% end %>
|
114
114
|
```
|
115
115
|
|
116
|
-
In some cases you may want to disable labels, hints or
|
116
|
+
In some cases you may want to disable labels, hints or errors. Or you may want to configure the html
|
117
117
|
of any of them:
|
118
118
|
|
119
119
|
```erb
|
@@ -164,7 +164,7 @@ any html attribute to that wrapper as well using the `:wrapper_html` option, lik
|
|
164
164
|
|
165
165
|
Required fields are marked with an * prepended to their labels.
|
166
166
|
|
167
|
-
By default all inputs are required. When the form object includes `ActiveModel::Validations`
|
167
|
+
By default all inputs are required. When the form object includes `ActiveModel::Validations`
|
168
168
|
(which, for example, happens with Active Record models), fields are required only when there is `presence` validation.
|
169
169
|
Otherwise, **Simple Form** will mark fields as optional. For performance reasons, this
|
170
170
|
detection is skipped on validations that make use of conditional options, such as `:if` and `:unless`.
|
@@ -214,7 +214,7 @@ the wrapper as well:
|
|
214
214
|
<% end %>
|
215
215
|
```
|
216
216
|
|
217
|
-
**Simple Form**
|
217
|
+
**Simple Form** inputs accept the same options as their corresponding input type helper in Rails:
|
218
218
|
|
219
219
|
```erb
|
220
220
|
<%= simple_form_for @user do |f| %>
|
@@ -812,7 +812,7 @@ object itself. Thus, similarly, if a form for an `Admin::User` object is defined
|
|
812
812
|
`simple_form_for @admin_user, as: :some_user`, **Simple Form** will look for translations
|
813
813
|
under `some_user` instead of `admin_user`.
|
814
814
|
|
815
|
-
When
|
815
|
+
When translating `simple_fields_for` attributes be sure to use the same name you pass to it, e.g. `simple_fields_for :posts` should be placed under `posts` not `post`:
|
816
816
|
|
817
817
|
```yaml
|
818
818
|
en:
|
@@ -1057,7 +1057,7 @@ http://rubydoc.info/github/plataformatec/simple_form/master/frames
|
|
1057
1057
|
### Bug reports
|
1058
1058
|
|
1059
1059
|
If you discover any bugs, feel free to create an issue on GitHub. Please add as much information as
|
1060
|
-
possible to help us fixing the
|
1060
|
+
possible to help us in fixing the potential bug. We also encourage you to help even more by forking and
|
1061
1061
|
sending us a pull request.
|
1062
1062
|
|
1063
1063
|
https://github.com/plataformatec/simple_form/issues
|
@@ -4,7 +4,7 @@ SimpleForm.setup do |config|
|
|
4
4
|
# all the grid-related classes)
|
5
5
|
#
|
6
6
|
# Please note that hints are commented out by default since Foundation
|
7
|
-
#
|
7
|
+
# doesn't provide styles for hints. You will need to provide your own CSS styles for hints.
|
8
8
|
# Uncomment them to enable hints.
|
9
9
|
|
10
10
|
config.wrappers :vertical_form, class: :input, hint_class: :field_with_hint, error_class: :error do |b|
|
@@ -98,7 +98,7 @@ SimpleForm.setup do |config|
|
|
98
98
|
config.button_class = 'button'
|
99
99
|
|
100
100
|
# Set this to div to make the checkbox and radio properly work
|
101
|
-
# otherwise simple_form adds a label tag instead of a div
|
101
|
+
# otherwise simple_form adds a label tag instead of a div around
|
102
102
|
# the nested label
|
103
103
|
config.item_wrapper_tag = :div
|
104
104
|
|
data/lib/simple_form/version.rb
CHANGED
@@ -119,9 +119,22 @@ class FormBuilderTest < ActionView::TestCase
|
|
119
119
|
|
120
120
|
test 'builder generates text areas for text columns' do
|
121
121
|
with_form_for @user, :description
|
122
|
+
assert_no_select 'form input#user_description.string'
|
122
123
|
assert_select 'form textarea#user_description.text'
|
123
124
|
end
|
124
125
|
|
126
|
+
test 'builder generates text areas for text columns when hinted' do
|
127
|
+
with_form_for @user, :description, as: :text
|
128
|
+
assert_no_select 'form input#user_description.string'
|
129
|
+
assert_select 'form textarea#user_description.text'
|
130
|
+
end
|
131
|
+
|
132
|
+
test 'builder generates text field for text columns when hinted' do
|
133
|
+
with_form_for @user, :description, as: :string
|
134
|
+
assert_no_select 'form textarea#user_description.text'
|
135
|
+
assert_select 'form input#user_description.string'
|
136
|
+
end
|
137
|
+
|
125
138
|
test 'builder generates a checkbox for boolean columns' do
|
126
139
|
with_form_for @user, :active
|
127
140
|
assert_select 'form input[type=checkbox]#user_active.boolean'
|
@@ -221,11 +234,15 @@ class FormBuilderTest < ActionView::TestCase
|
|
221
234
|
with_form_for @user, :name, as: :text
|
222
235
|
assert_no_select 'form input#user_name'
|
223
236
|
assert_select 'form textarea#user_name.text'
|
237
|
+
end
|
224
238
|
|
239
|
+
test 'builder allows overriding default input type for radio_buttons' do
|
225
240
|
with_form_for @user, :active, as: :radio_buttons
|
226
241
|
assert_no_select 'form input[type=checkbox]'
|
227
242
|
assert_select 'form input.radio_buttons[type=radio]', count: 2
|
243
|
+
end
|
228
244
|
|
245
|
+
test 'builder allows overriding default input type for string' do
|
229
246
|
with_form_for @user, :born_at, as: :string
|
230
247
|
assert_no_select 'form select'
|
231
248
|
assert_select 'form input#user_born_at.string'
|
@@ -9,7 +9,7 @@ class MockController
|
|
9
9
|
defined?(@action_name) ? @action_name : "edit"
|
10
10
|
end
|
11
11
|
|
12
|
-
def url_for(*
|
12
|
+
def url_for(*)
|
13
13
|
"http://example.com"
|
14
14
|
end
|
15
15
|
|
@@ -17,6 +17,8 @@ class MockController
|
|
17
17
|
{}
|
18
18
|
end
|
19
19
|
|
20
|
+
def polymorphic_mappings(*); {}; end
|
21
|
+
|
20
22
|
def hash_for_user_path(*); end
|
21
23
|
def hash_for_validating_user_path(*); end
|
22
24
|
def hash_for_other_validating_user_path(*); end
|
data/test/support/models.rb
CHANGED
@@ -128,6 +128,15 @@ class User
|
|
128
128
|
|
129
129
|
begin
|
130
130
|
require 'active_model/type'
|
131
|
+
begin
|
132
|
+
ActiveModel::Type.lookup(:text)
|
133
|
+
rescue ArgumentError # :text is no longer an ActiveModel::Type
|
134
|
+
# But we don't want our tests to depend on ActiveRecord
|
135
|
+
class ::ActiveModel::Type::Text < ActiveModel::Type::String
|
136
|
+
def type; :text; end
|
137
|
+
end
|
138
|
+
ActiveModel::Type.register(:text, ActiveModel::Type::Text)
|
139
|
+
end
|
131
140
|
def type_for_attribute(attribute)
|
132
141
|
column_type, limit = case attribute
|
133
142
|
when 'name', 'status', 'password' then [:string, 100]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-05-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '4'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '5.
|
24
|
+
version: '5.2'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
version: '4'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '5.
|
34
|
+
version: '5.2'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: actionpack
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
version: '4'
|
42
42
|
- - "<"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '5.
|
44
|
+
version: '5.2'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
version: '4'
|
52
52
|
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.2'
|
55
55
|
description: Forms made easy!
|
56
56
|
email: opensource@plataformatec.com.br
|
57
57
|
executables: []
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project: simple_form
|
182
|
-
rubygems_version: 2.6.
|
182
|
+
rubygems_version: 2.6.10
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Forms made easy!
|