simple_form 1.4.0 → 1.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.
- data/.gitignore +1 -0
- data/.travis.yml +10 -1
- data/CHANGELOG.rdoc +36 -0
- data/Gemfile +6 -5
- data/README.rdoc +25 -4
- data/Rakefile +1 -1
- data/lib/generators/simple_form/install_generator.rb +2 -6
- data/lib/generators/simple_form/templates/{simple_form.rb → config/initializers/simple_form.rb} +2 -2
- data/lib/simple_form/action_view_extensions/builder.rb +12 -5
- data/lib/simple_form/action_view_extensions/form_helper.rb +29 -18
- data/lib/simple_form/components/errors.rb +10 -2
- data/lib/simple_form/components/hints.rb +10 -0
- data/lib/simple_form/components/label_input.rb +5 -3
- data/lib/simple_form/components/labels.rb +10 -4
- data/lib/simple_form/components/placeholders.rb +10 -4
- data/lib/simple_form/components.rb +1 -1
- data/lib/simple_form/error_notification.rb +1 -1
- data/lib/simple_form/form_builder.rb +13 -10
- data/lib/simple_form/helpers/has_errors.rb +15 -0
- data/lib/simple_form/helpers/maxlength.rb +24 -0
- data/lib/simple_form/helpers/pattern.rb +28 -0
- data/lib/simple_form/helpers/required.rb +36 -0
- data/lib/simple_form/helpers/validators.rb +44 -0
- data/lib/simple_form/helpers.rb +9 -0
- data/lib/simple_form/inputs/base.rb +30 -45
- data/lib/simple_form/inputs/boolean_input.rb +1 -1
- data/lib/simple_form/inputs/collection_input.rb +1 -1
- data/lib/simple_form/inputs/date_time_input.rb +1 -1
- data/lib/simple_form/inputs/file_input.rb +9 -0
- data/lib/simple_form/inputs/hidden_input.rb +1 -1
- data/lib/simple_form/inputs/numeric_input.rb +20 -13
- data/lib/simple_form/inputs/password_input.rb +13 -0
- data/lib/simple_form/inputs/range_input.rb +16 -0
- data/lib/simple_form/inputs/string_input.rb +7 -24
- data/lib/simple_form/inputs/text_input.rb +12 -0
- data/lib/simple_form/inputs.rb +5 -2
- data/lib/simple_form/version.rb +1 -1
- data/lib/simple_form.rb +1 -1
- data/simple_form.gemspec +3 -0
- data/test/action_view_extensions/builder_test.rb +59 -0
- data/test/action_view_extensions/form_helper_test.rb +33 -0
- data/test/components/label_test.rb +19 -0
- data/test/discovery_inputs.rb +2 -2
- data/test/form_builder_test.rb +100 -6
- data/test/inputs_test.rb +193 -20
- data/test/support/mock_controller.rb +9 -0
- data/test/support/models.rb +28 -2
- data/test/test_helper.rb +1 -0
- metadata +47 -12
- data/Gemfile.lock +0 -82
- data/init.rb +0 -1
- data/lib/simple_form/has_errors.rb +0 -14
- data/lib/simple_form/inputs/mapping_input.rb +0 -29
- /data/lib/generators/simple_form/templates/{en.yml → config/locales/simple_form.en.yml} +0 -0
data/Gemfile.lock
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
GEM
|
|
2
|
-
remote: http://rubygems.org/
|
|
3
|
-
specs:
|
|
4
|
-
abstract (1.0.0)
|
|
5
|
-
actionmailer (3.0.7)
|
|
6
|
-
actionpack (= 3.0.7)
|
|
7
|
-
mail (~> 2.2.15)
|
|
8
|
-
actionpack (3.0.7)
|
|
9
|
-
activemodel (= 3.0.7)
|
|
10
|
-
activesupport (= 3.0.7)
|
|
11
|
-
builder (~> 2.1.2)
|
|
12
|
-
erubis (~> 2.6.6)
|
|
13
|
-
i18n (~> 0.5.0)
|
|
14
|
-
rack (~> 1.2.1)
|
|
15
|
-
rack-mount (~> 0.6.14)
|
|
16
|
-
rack-test (~> 0.5.7)
|
|
17
|
-
tzinfo (~> 0.3.23)
|
|
18
|
-
activemodel (3.0.7)
|
|
19
|
-
activesupport (= 3.0.7)
|
|
20
|
-
builder (~> 2.1.2)
|
|
21
|
-
i18n (~> 0.5.0)
|
|
22
|
-
activerecord (3.0.7)
|
|
23
|
-
activemodel (= 3.0.7)
|
|
24
|
-
activesupport (= 3.0.7)
|
|
25
|
-
arel (~> 2.0.2)
|
|
26
|
-
tzinfo (~> 0.3.23)
|
|
27
|
-
activeresource (3.0.7)
|
|
28
|
-
activemodel (= 3.0.7)
|
|
29
|
-
activesupport (= 3.0.7)
|
|
30
|
-
activesupport (3.0.7)
|
|
31
|
-
arel (2.0.9)
|
|
32
|
-
builder (2.1.2)
|
|
33
|
-
columnize (0.3.2)
|
|
34
|
-
erubis (2.6.6)
|
|
35
|
-
abstract (>= 1.0.0)
|
|
36
|
-
i18n (0.5.0)
|
|
37
|
-
linecache (0.43)
|
|
38
|
-
mail (2.2.18)
|
|
39
|
-
activesupport (>= 2.3.6)
|
|
40
|
-
i18n (>= 0.4.0)
|
|
41
|
-
mime-types (~> 1.16)
|
|
42
|
-
treetop (~> 1.4.8)
|
|
43
|
-
mime-types (1.16)
|
|
44
|
-
mocha (0.9.10)
|
|
45
|
-
rake
|
|
46
|
-
polyglot (0.3.1)
|
|
47
|
-
rack (1.2.2)
|
|
48
|
-
rack-mount (0.6.14)
|
|
49
|
-
rack (>= 1.0.0)
|
|
50
|
-
rack-test (0.5.7)
|
|
51
|
-
rack (>= 1.0)
|
|
52
|
-
rails (3.0.7)
|
|
53
|
-
actionmailer (= 3.0.7)
|
|
54
|
-
actionpack (= 3.0.7)
|
|
55
|
-
activerecord (= 3.0.7)
|
|
56
|
-
activeresource (= 3.0.7)
|
|
57
|
-
activesupport (= 3.0.7)
|
|
58
|
-
bundler (~> 1.0)
|
|
59
|
-
railties (= 3.0.7)
|
|
60
|
-
railties (3.0.7)
|
|
61
|
-
actionpack (= 3.0.7)
|
|
62
|
-
activesupport (= 3.0.7)
|
|
63
|
-
rake (>= 0.8.7)
|
|
64
|
-
thor (~> 0.14.4)
|
|
65
|
-
rake (0.8.7)
|
|
66
|
-
ruby-debug (0.10.4)
|
|
67
|
-
columnize (>= 0.1)
|
|
68
|
-
ruby-debug-base (~> 0.10.4.0)
|
|
69
|
-
ruby-debug-base (0.10.4)
|
|
70
|
-
linecache (>= 0.3)
|
|
71
|
-
thor (0.14.6)
|
|
72
|
-
treetop (1.4.9)
|
|
73
|
-
polyglot (>= 0.3.1)
|
|
74
|
-
tzinfo (0.3.27)
|
|
75
|
-
|
|
76
|
-
PLATFORMS
|
|
77
|
-
ruby
|
|
78
|
-
|
|
79
|
-
DEPENDENCIES
|
|
80
|
-
mocha
|
|
81
|
-
rails (~> 3.0.7)
|
|
82
|
-
ruby-debug
|
data/init.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require 'simple_form'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module SimpleForm
|
|
2
|
-
module Inputs
|
|
3
|
-
# Uses MapType to handle basic input types.
|
|
4
|
-
class MappingInput < Base
|
|
5
|
-
extend MapType
|
|
6
|
-
|
|
7
|
-
map_type :text, :to => :text_area
|
|
8
|
-
map_type :file, :to => :file_field
|
|
9
|
-
|
|
10
|
-
def input
|
|
11
|
-
@builder.send(input_method, attribute_name, input_html_options)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def has_placeholder?
|
|
17
|
-
(text? || password?) && placeholder_present?
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def password?
|
|
21
|
-
input_type == :password
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def text?
|
|
25
|
-
input_type == :text
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
File without changes
|