simple_form 2.0.0.rc → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of simple_form might be problematic. Click here for more details.
- data/CHANGELOG.md +16 -6
- data/README.md +18 -19
- data/lib/generators/simple_form/install_generator.rb +1 -1
- data/lib/generators/simple_form/templates/_form.html.erb +2 -2
- data/lib/generators/simple_form/templates/_form.html.haml +2 -2
- data/lib/generators/simple_form/templates/_form.html.slim +4 -4
- data/lib/generators/simple_form/templates/config/initializers/simple_form.rb.tt +23 -20
- data/lib/simple_form.rb +13 -9
- data/lib/simple_form/action_view_extensions/builder.rb +64 -22
- data/lib/simple_form/action_view_extensions/form_helper.rb +1 -1
- data/lib/simple_form/components/errors.rb +1 -1
- data/lib/simple_form/components/labels.rb +8 -2
- data/lib/simple_form/error_notification.rb +1 -2
- data/lib/simple_form/form_builder.rb +19 -6
- data/lib/simple_form/helpers/required.rb +5 -3
- data/lib/simple_form/inputs/base.rb +4 -1
- data/lib/simple_form/inputs/boolean_input.rb +4 -1
- data/lib/simple_form/inputs/collection_check_boxes_input.rb +2 -2
- data/lib/simple_form/inputs/collection_radio_buttons_input.rb +3 -5
- data/lib/simple_form/inputs/date_time_input.rb +8 -4
- data/lib/simple_form/inputs/grouped_collection_select_input.rb +1 -1
- data/lib/simple_form/version.rb +1 -1
- data/lib/simple_form/wrappers/builder.rb +46 -18
- data/lib/simple_form/wrappers/many.rb +1 -0
- data/lib/simple_form/wrappers/root.rb +1 -1
- data/test/action_view_extensions/builder_test.rb +100 -12
- data/test/action_view_extensions/form_helper_test.rb +13 -13
- data/test/components/label_test.rb +24 -0
- data/test/form_builder/association_test.rb +10 -0
- data/test/form_builder/button_test.rb +19 -0
- data/test/form_builder/error_notification_test.rb +16 -0
- data/test/form_builder/error_test.rb +21 -1
- data/test/form_builder/general_test.rb +8 -0
- data/test/form_builder/hint_test.rb +10 -2
- data/test/form_builder/input_field_test.rb +13 -1
- data/test/form_builder/label_test.rb +14 -0
- data/test/form_builder/wrapper_test.rb +10 -1
- data/test/inputs/boolean_input_test.rb +10 -0
- data/test/inputs/datetime_input_test.rb +20 -6
- data/test/inputs/grouped_collection_select_input_test.rb +9 -0
- data/test/inputs/priority_input_test.rb +1 -1
- data/test/inputs/string_input_test.rb +1 -1
- data/test/support/misc_helpers.rb +11 -12
- data/test/test_helper.rb +6 -4
- metadata +13 -10
@@ -1,11 +1,10 @@
|
|
1
1
|
module MiscHelpers
|
2
2
|
def store_translations(locale, translations, &block)
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
3
|
+
I18n.backend.store_translations locale, translations
|
4
|
+
yield
|
5
|
+
ensure
|
6
|
+
I18n.reload!
|
7
|
+
I18n.backend.send :init_translations
|
9
8
|
end
|
10
9
|
|
11
10
|
def assert_no_select(selector, value = nil)
|
@@ -36,22 +35,22 @@ module MiscHelpers
|
|
36
35
|
def custom_wrapper
|
37
36
|
SimpleForm.build :tag => :section, :class => "custom_wrapper", :pattern => false do |b|
|
38
37
|
b.use :pattern
|
39
|
-
b.
|
38
|
+
b.wrapper :another, :class => "another_wrapper" do |ba|
|
40
39
|
ba.use :label
|
41
40
|
ba.use :input
|
42
41
|
end
|
43
|
-
b.
|
44
|
-
be.use :error, :tag => :span, :class => "omg_error"
|
42
|
+
b.wrapper :error_wrapper, :tag => :div, :class => "error_wrapper" do |be|
|
43
|
+
be.use :error, :wrap_with => { :tag => :span, :class => "omg_error" }
|
45
44
|
end
|
46
|
-
b.use :hint, :
|
45
|
+
b.use :hint, :wrap_with => { :class => "omg_hint" }
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
50
49
|
def custom_wrapper_without_top_level
|
51
50
|
SimpleForm.build :tag => false, :class => 'custom_wrapper_without_top_level' do |b|
|
52
51
|
b.use :label_input
|
53
|
-
b.use :hint, :tag => :span, :class => :hint
|
54
|
-
b.use :error, :tag => :span, :class => :error
|
52
|
+
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
|
53
|
+
b.use :error, :wrap_with => { :tag => :span, :class => :error }
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
data/test/test_helper.rb
CHANGED
@@ -25,7 +25,9 @@ require 'simple_form'
|
|
25
25
|
require "rails/generators/test_case"
|
26
26
|
require 'generators/simple_form/install_generator'
|
27
27
|
|
28
|
-
Dir["#{File.dirname(__FILE__)}/support/*.rb"].each
|
28
|
+
Dir["#{File.dirname(__FILE__)}/support/*.rb"].each do |file|
|
29
|
+
require file unless file.end_with?('discovery_inputs.rb')
|
30
|
+
end
|
29
31
|
I18n.default_locale = :en
|
30
32
|
|
31
33
|
require 'country_select'
|
@@ -49,14 +51,14 @@ class ActionView::TestCase
|
|
49
51
|
def setup_new_user(options={})
|
50
52
|
@user = User.new({
|
51
53
|
:id => 1,
|
52
|
-
:name => 'New in
|
54
|
+
:name => 'New in SimpleForm!',
|
53
55
|
:description => 'Hello!',
|
54
56
|
:created_at => Time.now
|
55
57
|
}.merge(options))
|
56
58
|
|
57
59
|
@validating_user = ValidatingUser.new({
|
58
60
|
:id => 1,
|
59
|
-
:name => 'New in
|
61
|
+
:name => 'New in SimpleForm!',
|
60
62
|
:description => 'Hello!',
|
61
63
|
:home_picture => 'Home picture',
|
62
64
|
:created_at => Time.now,
|
@@ -68,7 +70,7 @@ class ActionView::TestCase
|
|
68
70
|
|
69
71
|
@other_validating_user = OtherValidatingUser.new({
|
70
72
|
:id => 1,
|
71
|
-
:name => 'New in
|
73
|
+
:name => 'New in SimpleForm!',
|
72
74
|
:description => 'Hello!',
|
73
75
|
:created_at => Time.now,
|
74
76
|
:age => 19,
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- José Valim
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-02-
|
14
|
+
date: 2012-02-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activemodel
|
18
|
-
requirement: &
|
18
|
+
requirement: &70196111502700 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '3.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70196111502700
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
|
-
requirement: &
|
29
|
+
requirement: &70196111500600 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: '3.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70196111500600
|
38
38
|
description: Forms made easy!
|
39
39
|
email: contact@plataformatec.com.br
|
40
40
|
executables: []
|
@@ -152,13 +152,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
152
|
version: '0'
|
153
153
|
segments:
|
154
154
|
- 0
|
155
|
-
hash:
|
155
|
+
hash: 284620577294605378
|
156
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
157
|
none: false
|
158
158
|
requirements:
|
159
|
-
- - ! '
|
159
|
+
- - ! '>='
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
161
|
+
version: '0'
|
162
|
+
segments:
|
163
|
+
- 0
|
164
|
+
hash: 284620577294605378
|
162
165
|
requirements: []
|
163
166
|
rubyforge_project: simple_form
|
164
167
|
rubygems_version: 1.8.11
|