ehoch_simple_form 2.0.2.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/CHANGELOG.md +257 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +797 -0
  4. data/lib/generators/simple_form/USAGE +3 -0
  5. data/lib/generators/simple_form/install_generator.rb +32 -0
  6. data/lib/generators/simple_form/templates/README +12 -0
  7. data/lib/generators/simple_form/templates/_form.html.erb +13 -0
  8. data/lib/generators/simple_form/templates/_form.html.haml +10 -0
  9. data/lib/generators/simple_form/templates/_form.html.slim +10 -0
  10. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb.tt +181 -0
  11. data/lib/generators/simple_form/templates/config/locales/simple_form.en.yml +26 -0
  12. data/lib/simple_form.rb +215 -0
  13. data/lib/simple_form/action_view_extensions/builder.rb +338 -0
  14. data/lib/simple_form/action_view_extensions/form_helper.rb +74 -0
  15. data/lib/simple_form/components.rb +20 -0
  16. data/lib/simple_form/components/errors.rb +35 -0
  17. data/lib/simple_form/components/hints.rb +18 -0
  18. data/lib/simple_form/components/html5.rb +26 -0
  19. data/lib/simple_form/components/label_input.rb +15 -0
  20. data/lib/simple_form/components/labels.rb +79 -0
  21. data/lib/simple_form/components/maxlength.rb +41 -0
  22. data/lib/simple_form/components/min_max.rb +50 -0
  23. data/lib/simple_form/components/pattern.rb +34 -0
  24. data/lib/simple_form/components/placeholders.rb +16 -0
  25. data/lib/simple_form/components/readonly.rb +22 -0
  26. data/lib/simple_form/core_ext/hash.rb +16 -0
  27. data/lib/simple_form/error_notification.rb +48 -0
  28. data/lib/simple_form/form_builder.rb +472 -0
  29. data/lib/simple_form/helpers.rb +12 -0
  30. data/lib/simple_form/helpers/autofocus.rb +11 -0
  31. data/lib/simple_form/helpers/disabled.rb +15 -0
  32. data/lib/simple_form/helpers/readonly.rb +15 -0
  33. data/lib/simple_form/helpers/required.rb +35 -0
  34. data/lib/simple_form/helpers/validators.rb +44 -0
  35. data/lib/simple_form/i18n_cache.rb +22 -0
  36. data/lib/simple_form/inputs.rb +21 -0
  37. data/lib/simple_form/inputs/base.rb +162 -0
  38. data/lib/simple_form/inputs/block_input.rb +14 -0
  39. data/lib/simple_form/inputs/boolean_input.rb +64 -0
  40. data/lib/simple_form/inputs/collection_check_boxes_input.rb +21 -0
  41. data/lib/simple_form/inputs/collection_input.rb +101 -0
  42. data/lib/simple_form/inputs/collection_radio_buttons_input.rb +63 -0
  43. data/lib/simple_form/inputs/collection_select_input.rb +14 -0
  44. data/lib/simple_form/inputs/date_time_input.rb +28 -0
  45. data/lib/simple_form/inputs/file_input.rb +9 -0
  46. data/lib/simple_form/inputs/grouped_collection_select_input.rb +41 -0
  47. data/lib/simple_form/inputs/hidden_input.rb +17 -0
  48. data/lib/simple_form/inputs/numeric_input.rb +24 -0
  49. data/lib/simple_form/inputs/password_input.rb +12 -0
  50. data/lib/simple_form/inputs/priority_input.rb +24 -0
  51. data/lib/simple_form/inputs/range_input.rb +14 -0
  52. data/lib/simple_form/inputs/string_input.rb +23 -0
  53. data/lib/simple_form/inputs/text_input.rb +11 -0
  54. data/lib/simple_form/map_type.rb +16 -0
  55. data/lib/simple_form/version.rb +3 -0
  56. data/lib/simple_form/wrappers.rb +8 -0
  57. data/lib/simple_form/wrappers/builder.rb +103 -0
  58. data/lib/simple_form/wrappers/many.rb +69 -0
  59. data/lib/simple_form/wrappers/root.rb +34 -0
  60. data/lib/simple_form/wrappers/single.rb +18 -0
  61. data/test/action_view_extensions/builder_test.rb +577 -0
  62. data/test/action_view_extensions/form_helper_test.rb +104 -0
  63. data/test/components/label_test.rb +310 -0
  64. data/test/form_builder/association_test.rb +177 -0
  65. data/test/form_builder/button_test.rb +47 -0
  66. data/test/form_builder/error_notification_test.rb +79 -0
  67. data/test/form_builder/error_test.rb +121 -0
  68. data/test/form_builder/general_test.rb +356 -0
  69. data/test/form_builder/hint_test.rb +139 -0
  70. data/test/form_builder/input_field_test.rb +63 -0
  71. data/test/form_builder/label_test.rb +71 -0
  72. data/test/form_builder/wrapper_test.rb +149 -0
  73. data/test/generators/simple_form_generator_test.rb +32 -0
  74. data/test/inputs/boolean_input_test.rb +108 -0
  75. data/test/inputs/collection_check_boxes_input_test.rb +224 -0
  76. data/test/inputs/collection_radio_buttons_input_test.rb +326 -0
  77. data/test/inputs/collection_select_input_test.rb +241 -0
  78. data/test/inputs/datetime_input_test.rb +99 -0
  79. data/test/inputs/disabled_test.rb +38 -0
  80. data/test/inputs/discovery_test.rb +61 -0
  81. data/test/inputs/file_input_test.rb +16 -0
  82. data/test/inputs/general_test.rb +69 -0
  83. data/test/inputs/grouped_collection_select_input_test.rb +118 -0
  84. data/test/inputs/hidden_input_test.rb +30 -0
  85. data/test/inputs/numeric_input_test.rb +173 -0
  86. data/test/inputs/priority_input_test.rb +43 -0
  87. data/test/inputs/readonly_test.rb +61 -0
  88. data/test/inputs/required_test.rb +113 -0
  89. data/test/inputs/string_input_test.rb +140 -0
  90. data/test/inputs/text_input_test.rb +24 -0
  91. data/test/simple_form_test.rb +9 -0
  92. data/test/support/discovery_inputs.rb +21 -0
  93. data/test/support/misc_helpers.rb +102 -0
  94. data/test/support/mock_controller.rb +24 -0
  95. data/test/support/models.rb +210 -0
  96. data/test/test_helper.rb +90 -0
  97. metadata +210 -0
@@ -0,0 +1,90 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'test/unit'
5
+ require 'mocha'
6
+
7
+ require 'active_model'
8
+ require 'action_controller'
9
+ require 'action_view'
10
+ require 'action_view/template'
11
+
12
+ # Rails 3.0.4 is missing this "deprecation" require.
13
+ require 'active_support/core_ext/module/deprecation'
14
+ require 'action_view/test_case'
15
+
16
+ module Rails
17
+ def self.env
18
+ ActiveSupport::StringInquirer.new("test")
19
+ end
20
+ end
21
+
22
+ $:.unshift File.expand_path("../../lib", __FILE__)
23
+ require 'simple_form'
24
+
25
+ require "rails/generators/test_case"
26
+ require 'generators/simple_form/install_generator'
27
+
28
+ Dir["#{File.dirname(__FILE__)}/support/*.rb"].each do |file|
29
+ require file unless file.end_with?('discovery_inputs.rb')
30
+ end
31
+ I18n.default_locale = :en
32
+
33
+ require 'country_select'
34
+
35
+ ActionDispatch::Assertions::NO_STRIP << "label"
36
+
37
+ class ActionView::TestCase
38
+ include MiscHelpers
39
+ include SimpleForm::ActionViewExtensions::FormHelper
40
+
41
+ setup :set_controller
42
+ setup :setup_new_user
43
+
44
+ def set_controller
45
+ @controller = MockController.new
46
+ end
47
+
48
+ def setup_new_user(options={})
49
+ @user = User.new({
50
+ :id => 1,
51
+ :name => 'New in SimpleForm!',
52
+ :description => 'Hello!',
53
+ :created_at => Time.now
54
+ }.merge(options))
55
+
56
+ @validating_user = ValidatingUser.new({
57
+ :id => 1,
58
+ :name => 'New in SimpleForm!',
59
+ :description => 'Hello!',
60
+ :home_picture => 'Home picture',
61
+ :created_at => Time.now,
62
+ :age => 19,
63
+ :amount => 15,
64
+ :attempts => 1,
65
+ :company => [1]
66
+ }.merge(options))
67
+
68
+ @other_validating_user = OtherValidatingUser.new({
69
+ :id => 1,
70
+ :name => 'New in SimpleForm!',
71
+ :description => 'Hello!',
72
+ :created_at => Time.now,
73
+ :age => 19,
74
+ :company => 1
75
+ }.merge(options))
76
+ end
77
+
78
+ def protect_against_forgery?
79
+ false
80
+ end
81
+
82
+ def user_path(*args)
83
+ '/users'
84
+ end
85
+ alias :users_path :user_path
86
+ alias :super_user_path :user_path
87
+ alias :validating_user_path :user_path
88
+ alias :validating_users_path :user_path
89
+ alias :other_validating_user_path :user_path
90
+ end
metadata ADDED
@@ -0,0 +1,210 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ehoch_simple_form
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.2.dev
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - José Valim
9
+ - Carlos Antônio
10
+ - Rafael França
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-04-02 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activemodel
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: '3.0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '3.0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: actionpack
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ description: Forms made easy!
49
+ email: contact@plataformatec.com.br
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - CHANGELOG.md
55
+ - MIT-LICENSE
56
+ - README.md
57
+ - lib/generators/simple_form/install_generator.rb
58
+ - lib/generators/simple_form/templates/_form.html.erb
59
+ - lib/generators/simple_form/templates/_form.html.haml
60
+ - lib/generators/simple_form/templates/_form.html.slim
61
+ - lib/generators/simple_form/templates/config/initializers/simple_form.rb.tt
62
+ - lib/generators/simple_form/templates/config/locales/simple_form.en.yml
63
+ - lib/generators/simple_form/templates/README
64
+ - lib/generators/simple_form/USAGE
65
+ - lib/simple_form/action_view_extensions/builder.rb
66
+ - lib/simple_form/action_view_extensions/form_helper.rb
67
+ - lib/simple_form/components/errors.rb
68
+ - lib/simple_form/components/hints.rb
69
+ - lib/simple_form/components/html5.rb
70
+ - lib/simple_form/components/label_input.rb
71
+ - lib/simple_form/components/labels.rb
72
+ - lib/simple_form/components/maxlength.rb
73
+ - lib/simple_form/components/min_max.rb
74
+ - lib/simple_form/components/pattern.rb
75
+ - lib/simple_form/components/placeholders.rb
76
+ - lib/simple_form/components/readonly.rb
77
+ - lib/simple_form/components.rb
78
+ - lib/simple_form/core_ext/hash.rb
79
+ - lib/simple_form/error_notification.rb
80
+ - lib/simple_form/form_builder.rb
81
+ - lib/simple_form/helpers/autofocus.rb
82
+ - lib/simple_form/helpers/disabled.rb
83
+ - lib/simple_form/helpers/readonly.rb
84
+ - lib/simple_form/helpers/required.rb
85
+ - lib/simple_form/helpers/validators.rb
86
+ - lib/simple_form/helpers.rb
87
+ - lib/simple_form/i18n_cache.rb
88
+ - lib/simple_form/inputs/base.rb
89
+ - lib/simple_form/inputs/block_input.rb
90
+ - lib/simple_form/inputs/boolean_input.rb
91
+ - lib/simple_form/inputs/collection_check_boxes_input.rb
92
+ - lib/simple_form/inputs/collection_input.rb
93
+ - lib/simple_form/inputs/collection_radio_buttons_input.rb
94
+ - lib/simple_form/inputs/collection_select_input.rb
95
+ - lib/simple_form/inputs/date_time_input.rb
96
+ - lib/simple_form/inputs/file_input.rb
97
+ - lib/simple_form/inputs/grouped_collection_select_input.rb
98
+ - lib/simple_form/inputs/hidden_input.rb
99
+ - lib/simple_form/inputs/numeric_input.rb
100
+ - lib/simple_form/inputs/password_input.rb
101
+ - lib/simple_form/inputs/priority_input.rb
102
+ - lib/simple_form/inputs/range_input.rb
103
+ - lib/simple_form/inputs/string_input.rb
104
+ - lib/simple_form/inputs/text_input.rb
105
+ - lib/simple_form/inputs.rb
106
+ - lib/simple_form/map_type.rb
107
+ - lib/simple_form/version.rb
108
+ - lib/simple_form/wrappers/builder.rb
109
+ - lib/simple_form/wrappers/many.rb
110
+ - lib/simple_form/wrappers/root.rb
111
+ - lib/simple_form/wrappers/single.rb
112
+ - lib/simple_form/wrappers.rb
113
+ - lib/simple_form.rb
114
+ - test/action_view_extensions/builder_test.rb
115
+ - test/action_view_extensions/form_helper_test.rb
116
+ - test/components/label_test.rb
117
+ - test/form_builder/association_test.rb
118
+ - test/form_builder/button_test.rb
119
+ - test/form_builder/error_notification_test.rb
120
+ - test/form_builder/error_test.rb
121
+ - test/form_builder/general_test.rb
122
+ - test/form_builder/hint_test.rb
123
+ - test/form_builder/input_field_test.rb
124
+ - test/form_builder/label_test.rb
125
+ - test/form_builder/wrapper_test.rb
126
+ - test/generators/simple_form_generator_test.rb
127
+ - test/inputs/boolean_input_test.rb
128
+ - test/inputs/collection_check_boxes_input_test.rb
129
+ - test/inputs/collection_radio_buttons_input_test.rb
130
+ - test/inputs/collection_select_input_test.rb
131
+ - test/inputs/datetime_input_test.rb
132
+ - test/inputs/disabled_test.rb
133
+ - test/inputs/discovery_test.rb
134
+ - test/inputs/file_input_test.rb
135
+ - test/inputs/general_test.rb
136
+ - test/inputs/grouped_collection_select_input_test.rb
137
+ - test/inputs/hidden_input_test.rb
138
+ - test/inputs/numeric_input_test.rb
139
+ - test/inputs/priority_input_test.rb
140
+ - test/inputs/readonly_test.rb
141
+ - test/inputs/required_test.rb
142
+ - test/inputs/string_input_test.rb
143
+ - test/inputs/text_input_test.rb
144
+ - test/simple_form_test.rb
145
+ - test/support/discovery_inputs.rb
146
+ - test/support/misc_helpers.rb
147
+ - test/support/mock_controller.rb
148
+ - test/support/models.rb
149
+ - test/test_helper.rb
150
+ homepage: https://github.com/plataformatec/simple_form
151
+ licenses: []
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ! '>'
166
+ - !ruby/object:Gem::Version
167
+ version: 1.3.1
168
+ requirements: []
169
+ rubyforge_project: simple_form
170
+ rubygems_version: 1.8.21
171
+ signing_key:
172
+ specification_version: 3
173
+ summary: Forms made easy!
174
+ test_files:
175
+ - test/action_view_extensions/builder_test.rb
176
+ - test/action_view_extensions/form_helper_test.rb
177
+ - test/components/label_test.rb
178
+ - test/form_builder/association_test.rb
179
+ - test/form_builder/button_test.rb
180
+ - test/form_builder/error_notification_test.rb
181
+ - test/form_builder/error_test.rb
182
+ - test/form_builder/general_test.rb
183
+ - test/form_builder/hint_test.rb
184
+ - test/form_builder/input_field_test.rb
185
+ - test/form_builder/label_test.rb
186
+ - test/form_builder/wrapper_test.rb
187
+ - test/generators/simple_form_generator_test.rb
188
+ - test/inputs/boolean_input_test.rb
189
+ - test/inputs/collection_check_boxes_input_test.rb
190
+ - test/inputs/collection_radio_buttons_input_test.rb
191
+ - test/inputs/collection_select_input_test.rb
192
+ - test/inputs/datetime_input_test.rb
193
+ - test/inputs/disabled_test.rb
194
+ - test/inputs/discovery_test.rb
195
+ - test/inputs/file_input_test.rb
196
+ - test/inputs/general_test.rb
197
+ - test/inputs/grouped_collection_select_input_test.rb
198
+ - test/inputs/hidden_input_test.rb
199
+ - test/inputs/numeric_input_test.rb
200
+ - test/inputs/priority_input_test.rb
201
+ - test/inputs/readonly_test.rb
202
+ - test/inputs/required_test.rb
203
+ - test/inputs/string_input_test.rb
204
+ - test/inputs/text_input_test.rb
205
+ - test/simple_form_test.rb
206
+ - test/support/discovery_inputs.rb
207
+ - test/support/misc_helpers.rb
208
+ - test/support/mock_controller.rb
209
+ - test/support/models.rb
210
+ - test/test_helper.rb