simple_form 2.0.4 → 2.1.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.

Files changed (36) hide show
  1. data/CHANGELOG.md +33 -301
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +30 -12
  4. data/lib/generators/simple_form/install_generator.rb +7 -4
  5. data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +26 -0
  6. data/lib/simple_form.rb +11 -8
  7. data/lib/simple_form/action_view_extensions/builder.rb +32 -18
  8. data/lib/simple_form/action_view_extensions/builder.rb.orig +247 -0
  9. data/lib/simple_form/components.rb +12 -10
  10. data/lib/simple_form/components/hints.rb +1 -1
  11. data/lib/simple_form/components/label_input.rb +1 -1
  12. data/lib/simple_form/components/maxlength.rb +1 -1
  13. data/lib/simple_form/components/min_max.rb +1 -1
  14. data/lib/simple_form/components/pattern.rb +1 -1
  15. data/lib/simple_form/form_builder.rb +6 -3
  16. data/lib/simple_form/form_builder.rb.orig +486 -0
  17. data/lib/simple_form/helpers/validators.rb +2 -2
  18. data/lib/simple_form/inputs.rb +19 -17
  19. data/lib/simple_form/inputs/base.rb +8 -2
  20. data/lib/simple_form/inputs/date_time_input.rb +0 -4
  21. data/lib/simple_form/version.rb +1 -1
  22. data/lib/simple_form/version.rb.orig +7 -0
  23. data/lib/simple_form/wrappers/root.rb +3 -1
  24. data/test/action_view_extensions/builder_test.rb +113 -67
  25. data/test/action_view_extensions/form_helper_test.rb +5 -0
  26. data/test/components/label_test.rb +27 -17
  27. data/test/form_builder/association_test.rb +10 -7
  28. data/test/form_builder/general_test.rb +48 -25
  29. data/test/form_builder/input_field_test.rb +45 -0
  30. data/test/form_builder/wrapper_test.rb +22 -0
  31. data/test/generators/simple_form_generator_test.rb +8 -0
  32. data/test/inputs/datetime_input_test.rb +2 -2
  33. data/test/inputs/grouped_collection_select_input_test.rb +15 -0
  34. data/test/support/misc_helpers.rb +6 -0
  35. data/test/test_helper.rb +6 -1
  36. metadata +12 -2
data/CHANGELOG.md CHANGED
@@ -1,305 +1,37 @@
1
- ## 2.0.4
2
-
3
- ### bug fix
4
-
5
- * Remove invalid files from the gem package.
6
- Closes [#673](https://github.com/plataformatec/simple_form/issues/673)
7
-
8
- ## 2.0.3
9
-
10
- ### enhancements
11
- * Allow to specify custom wrappers for input types.
12
- ([@nashby](https://github.com/nashby))
13
- Closes [#636](https://github.com/plataformatec/simple_form/issues/636)
14
- * Use separate config file to do bootstrap specific configuration.
15
- ([@nashby](https://github.com/nashby))
16
-
17
- ### bug fix
18
- * Allow to specify checked and uncked values for boolean input
19
- ([@nashby](https://github.com/nashby)).
20
- Closes [#643](https://github.com/plataformatec/simple_form/issues/643)
21
- * Allow to add additional classes only for wrapper.
22
- ([@nashby](https://github.com/nashby)).
23
- Closes [#629](https://github.com/plataformatec/simple_form/issues/629)
24
- * Boolean hidden field now respects `:name` attribute when nested.
25
- ([@amiel](https://github.com/amiel)).
26
- Closes [#619](https://github.com/plataformatec/simple_form/issues/619)
27
- * Prevent generation of `class=""`. ([@pkmiec](https://github.com/pkmiec))
28
- * Fix namespace html propagation to single wrapper of `label` and `input`
29
- * Association creates blank select if `:collection` is `nil`.
30
- ([@nashby](https://github.com/nashby)).
31
- Closes [#595](https://github.com/plataformatec/simple_form/issues/595)
32
- * Fix readonly attribute check. ([@retoo](https://github.com/retoo))
33
- * Fix error when `collection_check_boxes` used with `form_for` instead of `simple_form_for`.
34
- ([@RohanM](https://github.com/RohanM))
35
- * Ensure ActionView::Base.field_error_proc is preserved when exceptions occur within
36
- `with_simple_form_field_error_proc`.
37
- ([@jim](https://github.com/jim))
38
- * Handle array of strings in `:checked` option.
39
- ([@nashby](https://github.com/nashby))
40
-
41
- ## 2.0.2
42
-
43
- ### enhancements
44
- * Add `:inline_label` option to nested booleans to display text inline with checkbox.
45
- If the value is `true` it uses the default label text. ([@ehoch](https://github.com/ehoch))
46
- * Add html support for hints. ([@findrails](https://github.com/findrails))
47
-
48
- ### bug fix
49
- * Fix `min_max` component to not output maximum value. ([@julian7](https://github.com/julian7)).
50
- Closes [#483](https://github.com/plataformatec/simple_form/issues/483)
51
- * Remove leading and trailing whitespace from `label_text`.
52
- Closes [#492](https://github.com/plataformatec/simple_form/issues/492)
53
- * Fix checked radio button issue when value is false. ([@georgehemmings](https://github.com/georgehemmings)).
54
- * Propagate defaults options to nested forms.
55
- Closes [#553](https://github.com/plataformatec/simple_form/issues/533).
56
- ([@nashby](https://github.com/nashby))
57
- * Fix limit and maxlength with decimal points. ([@shwoodard](https://github.com/shwoodard))
58
- * Fix issue when html are duplicated.
59
- Closes [#488](https://github.com/plataformatec/simple_form/issues/488).
60
- ([@ebonical](https://github.com/ebonical))
61
-
62
- ## 2.0.1
63
-
64
- ### bug fix
65
- * Sanitaze html attributes to `label` method. ([@nashby](https://github.com/nashby)).
66
- Closes [#472](https://github.com/plataformatec/simple_form/issues/472)
67
- * Make `collection_check_boxes` and `collection_radio_buttons` work with local variables.
68
- Closes [#474](https://github.com/plataformatec/simple_form/issues/474)
69
- * Use `html5` component by default in the bootstrap generator. ([@isc](https://github.com/isc)).
70
- Closes [#471](https://github.com/plataformatec/simple_form/issues/471)
71
-
72
- ## 2.0.0
1
+ ## 2.1.0
73
2
 
74
3
  ### enhancements
75
- * Add `button_class` configuration to change the class of buttons. ([@sryche](https://github.com/sryche))
76
- * Add `disabled` class to a disabled input.
77
- * Generate configuration file with `browser_validations` disabled.
78
- * Add option and configuration to specify the collection wrapper class. ([@mfila](https://github.com/mfila))
79
- * Add proc support to `collection` option. ([@jeffkreeftmeijer](https://github.com/jeffkreeftmeijer))
80
- * `simple_form_for` allows default options for its inputs `:defaults => {}`.
81
- * Add `readonly` as option of input method. ([@Untainted123](https://github.com/Untainted123))
82
- * `simple_fields_for` for inherits wrapper option form the form builder. ([@nashby](https://github.com/nashby))
83
- * Use action prefix in the form css class. Closes [#360](https://github.com/plataformatec/simple_form/issues/360).
84
- This is not backward compatible with the previous versions of SimpleForm.
85
- For more informations see [this comment](https://github.com/plataformatec/simple_form/issues/360#issuecomment-3000780).
4
+ * `input_field` supports components that don't generate tags
5
+ as `:min_max`, `:maxlength`, `:placeholder`, `:pattern`, `:readonly`.
6
+ Closes[#362](https://github.com/plataformatec/simple_form/issues/632).
86
7
  ([@nashby](https://github.com/nashby))
87
- * Add a readonly component that does automatically readonly lookup from object
88
- * Add support for proc or lambda as option for format validator ([@nashby](https://github.com/nashby))
89
- * Handle validates_length_of :is option in maxlength ([@nashby](https://github.com/nashby))
90
- * Add field_with_hint css class to the wrapper when the input has a hint, similar to field_with_errors ([@nashby](https://github.com/nashby))
91
- * Add :grouped_select input type, mapping to Rails grouped_collection_select helper ([@semaperepelitsa](https://github.com/semaperepelitsa))
92
- * Add automatic translation of options for collection inputs given a collection of symbols ([@klobuczek](https://github.com/klobuczek))
93
- * Add `:boolean_style` config to change how check boxes and radios will be displayed.
94
- Options are `:inline = input + label` (default) and `:nested = label > input`.
95
- * Add possibility to give a block to `collection_radio` and `collection_check_boxes`,
96
- yielding a custom builder to generate custom label and input structure. It
97
- is used internally with the :nested option for `:boolean_style`, and is useful
98
- to allow some more customization if required.
99
- * Do not generate hidden check box field when using nested boolean style, as it is considered
100
- invalid markup in HTML5. This will work by default in Rails > 3.2.1 (not released at this time),
101
- and is backported inside SimpleForm builder extensions.
102
- More info in [#215](https://github.com/plataformatec/simple_form/issues/215)
103
- * Add `item_wrapper_class` configuration option for collection radio buttons / check boxes inputs.
104
- * Change default generator templates to use .form-inputs and .form-actions classes in wrapper divs.
105
- (the latter is the default in bootstrap, so this makes it easier to integrate).
106
- * Field error now accepts HTML tags ([@edison](https://github.com/edison))
107
- * Add `generate_additional_classes_for` config option to selectively disable extra
108
- css classes for components - wrapper, label and input. ([krzyzak](https://github.com/krzyzak))
109
-
110
- ### deprecation
111
- * Deprecate part of the old configuration API in favor of the wrapper API which allows you to customize your inputs
112
- in a more flexible way. See [this guide](https://github.com/plataformatec/simple_form/wiki/Upgrading-to-Simple-Form-2.0)
113
- to know how upgrade.
114
- * Deprecate the `translate` configuration in favor of `translate_labels`
115
- * Deprecate the `html5` configuration in favor of a new `html5` component
116
- * Deprecate `:radio` input type in favor of `:radio_buttons`
117
- * Deprecate `collection_radio` form helper in favor of `collection_radio_buttons`
118
- (the label class has changed as well)
119
- * Remove `error_notification_id` configuration
120
-
121
- ### bug fix
122
- * Fix i18n lookup with attributes with same name of models.
123
- Closes [#149](https://github.com/plataformatec/simple_form/issues/149)
124
- and [#364](https://github.com/plataformatec/simple_form/issues/364).
125
- ([@nashby](https://github.com/nashby) and [@MarceloCajueiro](https://github.com/MarceloCajueiro))
126
- * Do not generate `for` attribute for the collection label when it is a checkbox or radio.
127
- Closes [#344](https://github.com/plataformatec/simple_form/issues/344).
128
- ([@nashby](https://github.com/nashby) and [@mfila](https://github.com/mfila))
129
- * Select can have required option when the `:include_blank` option is passed.
130
- Closes [#340](https://github.com/plataformatec/simple_form/issues/340). ([@nashby](https://github.com/nashby))
131
- * `:checked` option should override the existing associations on `collection_check_boxes`.
132
- Closes [#341](https://github.com/plataformatec/simple_form/issues/341). ([@nashby](https://github.com/nashby))
133
- * Move default attribute translations out of root - use "defaults" key instead
134
- Closes [#384](https://github.com/plataformatec/simple_form/issues/384). ([@fringd](https://github.com/fringd))
135
- * Fix label to datetime inputs to point to first select. ([@georgehemmings](https://github.com/georgehemmings))
136
- * Fix usage of f.button :button with Rails 3.2.
137
- Closes [#449](https://github.com/plataformatec/simple_form/issues/449).
138
-
139
- ## 1.5.2
140
-
141
- ### bug fix
142
- * Remove the internal usage of deprecated `:components`
143
-
144
- ## 1.5.1
145
-
146
- ### deprecation
147
- * `:components` options is now deprecated
148
-
149
- ### bug fix
150
- * Fallback to default label when block is provided. ([@pivotal-casebook](https://github.com/pivotal-casebook))
151
- * Do not override default selection through attribute value in collection select when label/value methods are lambdas.
152
-
153
- ## 1.5.0
154
-
155
- ### enhancements
156
- * Simplified generator by using directory action. ([@rupert654](https://github.com/rupert654))
157
- * Support for `maxlength` on string inputs inferred from validation. ([@srbartlett](https://github.com/srbartlett))
158
- * Change form css class handling to only add the dom class when one is not given to the form call.
159
- ([@patrick99e99](https://github.com/patrick99e99))
160
- * Support for required attributes when action validations are present. ([@csegura](http://github.com/csegura))
161
- * Do not generate `size` attribute for numeric input. ([@csegura](https://github.com/jasonmp85))
162
- * Support for `maxlength` on text area inputs inferred from validation.
163
- * Support for `pattern` on text field inferred from validation when `:pattern` is true.
164
- * Break Text, Password and File into their own inputs.
165
- * Support easy enabling and disabling of components for specific inputs.
166
- * Add HTML5 range input.
167
-
168
- ### bug fix
169
- * Fix bug when `simple_fields_for` is used with a hash like models and Rails 3.1.
170
- * Fix bug that does not remove the `:item_wrapper_tag` or the `:collection_wrapper_tag` on collection
171
- inputs when nil or false value is passed to these options. ([@dw2](https://gitbub.com/dw2))
172
- * Fix bug that disable the entire select and wrapper when `disabled` option is a string or array.
173
- * Fix bug when using label/value methods as procs together with disabled/selected options as procs for select inputs.
174
-
175
- ## 1.4.2
176
-
177
- ### enhancements
178
- * Rails 3.1 support.
179
-
180
- ## 1.4.1
181
-
182
- ### enhancements
183
- * ignore required attribute when conditional validations are present.
184
-
185
- ### bug fix
186
- * Do not use `required='required'` when browser validations are turned off.
187
- * Sanitize HMTL attributes in error and hint helpers when options are present.
188
- * Improve i18n lookup by ignoring explicit child index given to form builder.
189
- (tests by [@rywall](https://github.com/rywall))
190
- * Fixes the form specific validation option if specified on the form itself. ([@medihack](https://github.com/medihack))
191
-
192
- ## 1.4.0
193
-
194
- ### enhancements
195
- * Add label class configuration option. ([@reu](http://github.com/reu))
196
- * Improve i18n lookup (labels/hints/placeholders) for nested models.
197
- * Use the given custom builder with `simple_fields_for`. ([@giniedp](https://github.com/giniedp))
198
- * Add slim form generator. ([@fagiani](https://github.com/fagiani))
199
- * Add `form_class` configuration option. ([@fagiani](https://github.com/fagiani))
200
- * Default step of `any` for number input with non integer attributes. ([@fedesoria](https://github.com/fedesoria))
201
- * Add option to disable HTML5 browser validations on all forms. ([@coryschires](https://github.com/coryschires))
202
- * Add option to disable all HTML5 extensions. ([@wolframarnold](https://github.com/wolframarnold))
203
- * Add `input_field` helper to form builder. ([@jeroenhouben](https://github.com/jeroenhouben))
204
- * Allow inputs to be discovered on demand by placing them at app/inputs (a la formtastic).
205
- * Add `full_error` on that shows the error with the attribute name.
206
-
207
- ### bug fix
208
- * Fix for file attributes automatic detection, to work with virtual attributes.
209
- * Fix for numeric fields validation options using symbols and procs.
210
- * Fix password attributes to add `size` and `maxlength` options the same way as string. ([@fedesoria](https://github.com/fedesoria))
211
- * Fix bug with custom form builders and new mappings being added to the superclass builder. ([@rdvdijk](https://github.com/rdvdijk))
212
- * Fix HTML validation issue with `collection_check_boxes`.
213
-
214
- ## 1.3.1
215
-
216
- ### enhancements
217
- * Add `:autofocus` HTML5 attribute support. ([@jpzwarte](https://github.com/jpzwarte))
218
- * Add possibility to specify custom builder and inherit mappings. ([@rejeep](https://github.com/rejeep))
219
- * Make custom mappings work with all attributes types. ([@rafaelfranca](https://github.com/rafaelfranca))
220
- * Add support for procs/lambdas in text/value methods for `collection_select`.
221
-
222
- ### deprecation
223
- * removed the deprecated `:remote_form_for`
224
-
225
- ### bug fix
226
- * Only add the `required` HTML 5 attribute for valid inputs, disable in selects (not allowed).
227
- * Fix error when using hints without an attribute.
228
- ([@butsjoh](https://github.com/butsjoh) and [@rafaelfranca](https://github.com/rafaelfranca))
229
- * Fix messy html output for hint, error and label components.
230
- ([@butsjoh](https://github.com/butsjoh) and [@rafaelfranca](https://github.com/rafaelfranca))
231
- * Allow direct setting of for attribute on label. ([@Bertg](https://github.com/Bertg))
232
-
233
- ## 1.3.0
234
-
235
- ### enhancements
236
- * Allow collection input to accept a collection of symbols.
237
- * Add default css class to button.
238
- * Allow forms for objects that do not respond to the `errors` method.
239
- * `collection_check_boxes` and `collection_radio` now wrap the input in the label.
240
- * Automatic add min/max values for numeric attributes based on validations and step for integers - HTML5.
241
- ([@dasch](https://github.com/dasch))
242
- * Add `:placeholder` option for string inputs, allowing customization through I18n - HTML5.
243
- ([@jonathan](https://github.com/jonathan))
244
- * Add `:search` and `:tel` input types, with `:tel` mapping automatically from attributes matching "phone" - HTML5.
245
- * Add `:required` html attribute for required inputs - HTML5.
246
- * Add optional `:components` option to input to control component rendering. ([@khoan](https://github.com/khoan))
247
- * Add `SimpleForm.translate` as an easy way to turn off SimpleForm internal translations.
248
- * Add `:disabled` option for all inputs. ([@fabiob](https://github.com/fabiob))
249
- * Add collection wrapper tag and item wrapper tag to wrap elements in collection helpers - radio / check boxes.
250
- * Add `SimpleForm.input_mappings` to allow configuring custom mappings for inputs. ([@TMaYaD](https://github.com/TMaYaD))
251
-
252
- ### bug fix
253
- * Search for validations on both association and attribute.
254
- * Use `controller.action_name` to lookup action only when available, to fix issue with Rspec views tests.
255
- ([@rafaelfranca](https://github.com/rafaelfranca))
256
-
257
- ## 1.2.2
258
-
259
- ### enhancements
260
- * Compatibility with Rails 3 RC.
261
-
262
- ## 1.2.1
263
-
264
- ### enhancements
265
- * Added haml generator support. ([@grimen](https://github.com/grimen))
266
- * Added `error_notification` message to form builder.
267
- * Added required by default as configuration option.
268
- * Added `label_input` as component, allowing boolean to change its order (input appearing first than label).
269
- * Added `error_method` to tidy up how errors are exhibited.
270
- * Added error class on wrappers. ([@jduff](https://github.com/jduff))
271
- * Changed numeric types to have `type=number` for HTML5.
272
-
273
- ## 1.2.0
274
-
275
- ### deprecation
276
- * Changed `simple_form_install` generator to `simple_form:install`.
277
-
278
- ### enhancements
279
- * Added support to presence validation to check if attribute is required or not. ([@gcirne](https://github.com/gcirne))
280
- * Added `input` as class to wrapper tag.
281
- * Added config options for hint and error tags. ([@tjogin](https://github.com/tjogin))
282
-
283
- ## 1.1.3
284
-
285
- ### deprecation
286
- * removed `:conditions`, `:order`, `:joins` and `:include` support in `f.association`.
287
-
288
- ## 1.1.2
289
-
290
- ### bug fix
291
- * Ensure type is set to "text" and not "string".
292
-
293
- ## 1.1.1
294
-
295
- ### bug fix
296
- * Fix some escaping issues.
297
-
298
- ## 1.1.0
299
-
300
- ### enhancements
301
- * Rails 3 support with generators, templates and HTML 5.
302
-
303
- ## 1.0
8
+ * support for Rails eager loading.
9
+ Closes [#478](https://github.com/plataformatec/simple_form/issues/478).
10
+ * generate required attribute for `date_time` input.
11
+ ([@nashby](https://github.com/nashby))
12
+ Closes [#730](https://github.com/plataformatec/simple_form/issues/730).
13
+ * `grouped_collection_select` now accepts proc/lambda as label and value method.
14
+ ([@svendahlstrand](https://github.com/svendahlstrand))
15
+ Closes [#623](https://github.com/plataformatec/simple_form/issues/623).
16
+ * Add Zurb Foundation 3 integration.
17
+ ([@balexand](https://github.com/balexand))
18
+ * Generates additional wrapper class based on object + attribute name.
19
+ ([@lucasmazza](https://github.com/lucasmazza))
20
+ Closes [#576](https://github.com/plataformatec/simple_form/issues/576).
21
+ * Allow `input_field` to work with `:defaults` options.
22
+ ([@smidwap](https://github.com/smidwap))
23
+
24
+ ### bug fix
25
+ * Do not lookup for hints if it was explicitly given false.
26
+ After #405 we added hint classes for the wrappers, but this has forced the
27
+ loading of the hint text doing I18n lookups, even though it was explicitly
28
+ given false. This checks for the option in `#has_hint?`, avoiding the lookup
29
+ in such cases. This issues has been caught with #627, thanks to
30
+ ([@shwoodard](https://github.com/shwoodard)).
31
+ * Fix default I18n lookup for association input.
32
+ ([@nashby](https://github.com/nashby))
33
+ Closes [#679](https://github.com/plataformatec/simple_form/issues/679).
34
+ * Fix escaping issue in `label_input` component
35
+ ([@allomov](https://github.com/allomov))
304
36
 
305
- * First release.
37
+ Please check [v2.0](https://github.com/plataformatec/simple_form/blob/v2.0/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Plataformatec http://plataformatec.com.br/
1
+ Copyright (c) 2009-2013 Plataformatec http://plataformatec.com.br/
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,42 +1,48 @@
1
1
  # SimpleForm - Rails forms made easy.
2
- [![Build Status](https://secure.travis-ci.org/plataformatec/simple_form.png)](http://travis-ci.org/plataformatec/simple_form)
2
+ [![Build Status](https://secure.travis-ci.org/plataformatec/simple_form.png?branch=master)](http://travis-ci.org/plataformatec/simple_form)
3
3
 
4
4
  **SimpleForm** aims to be as flexible as possible while helping you with powerful components to create
5
5
  your forms. The basic goal of SimpleForm is to not touch your way of defining the layout, letting
6
6
  you find the better design for your eyes. Most of the DSL was inherited from Formtastic,
7
7
  which we are thankful for and should make you feel right at home.
8
8
 
9
- INFO: This README is [also available in a friendly navigable format](http://simple-form.plataformatec.com.br/)
10
- and refers to **SimpleForm** 2.0. If you are using **SimpleForm** in the versions 1.x, you should
11
- check this branch:
12
-
13
- https://github.com/plataformatec/simple_form/tree/v1.5
9
+ INFO: This README refers to **SimpleForm** 2.1. For older releases, check the related branch for your version.
14
10
 
15
11
  ## Installation
16
12
 
17
13
  Add it to your Gemfile:
18
14
 
19
- `gem 'simple_form'`
15
+ ```ruby
16
+ gem 'simple_form'
17
+ ```
20
18
 
21
19
  Run the following command to install it:
22
20
 
23
- `bundle install`
21
+ ```console
22
+ bundle install
23
+ ```
24
24
 
25
25
  Run the generator:
26
26
 
27
- `rails generate simple_form:install`
27
+ ```console
28
+ rails generate simple_form:install
29
+ ```
28
30
 
29
31
  Also, if you want to use the country select, you will need the
30
32
  [country_select gem](https://rubygems.org/gems/country_select), add it to your Gemfile:
31
33
 
32
- `gem 'country_select'`
34
+ ```ruby
35
+ gem 'country_select'
36
+ ```
33
37
 
34
38
  ### Twitter Bootstrap
35
39
 
36
40
  **SimpleForm** 2.0 can be easily integrated to the [Twitter Bootstrap](http://twitter.github.com/bootstrap).
37
41
  To do that you have to use the `bootstrap` option in the install generator, like this:
38
42
 
39
- `rails generate simple_form:install --bootstrap`
43
+ ```console
44
+ rails generate simple_form:install --bootstrap
45
+ ```
40
46
 
41
47
  You have to be sure that you added a copy of the [Twitter Bootstrap](http://twitter.github.com/bootstrap)
42
48
  assets on your application.
@@ -47,6 +53,18 @@ For more information see the generator output, our
47
53
 
48
54
  **NOTE**: **SimpleForm** integration requires Twitter Bootstrap version 2.0 or higher.
49
55
 
56
+ ### Zurb Foundation 3
57
+
58
+ To generate wrappers that are compatible with [Zurb Foundation 3](http://foundation.zurb.com/), pass the `foundation` option to the generator, like this:
59
+
60
+ ```console
61
+ rails generate simple_form:install --foundation
62
+ ```
63
+
64
+ Please note that the Foundation wrapper does not support the `:hint` option by default. In order to enable hints, please uncomment the appropriate line in `config/initializers/simple_form_foundation.rb`. You will need to provide your own CSS styles for hints.
65
+
66
+ Please see the [instructions on how to install Foundation in a Rails app](http://foundation.zurb.com/docs/rails.php).
67
+
50
68
  ## Usage
51
69
 
52
70
  **SimpleForm** was designed to be customized as you need to. Basically it's a stack of components that
@@ -857,4 +875,4 @@ https://github.com/plataformatec/simple_form/issues
857
875
 
858
876
  ## License
859
877
 
860
- MIT License. Copyright 2012 Plataformatec. http://plataformatec.com.br
878
+ MIT License. Copyright 2009-2013 Plataformatec. http://plataformatec.com.br
@@ -5,12 +5,13 @@ module SimpleForm
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
  class_option :template_engine, :desc => 'Template engine to be invoked (erb, haml or slim).'
7
7
  class_option :bootstrap, :type => :boolean, :desc => 'Add the Twitter Bootstrap wrappers to the SimpleForm initializer.'
8
+ class_option :foundation, :type => :boolean, :desc => 'Add the Zurb Foundation 3 wrappers to the SimpleForm initializer.'
8
9
 
9
10
  def info_bootstrap
10
- return if options.bootstrap?
11
- puts "SimpleForm 2 supports Twitter bootstrap. In case you want to " \
12
- "generate bootstrap configuration, please re-run this " \
13
- "generator passing --bootstrap as option."
11
+ return if options.bootstrap? || options.foundation?
12
+ puts "SimpleForm 2 supports Twitter Bootstrap and Zurb Foundation 3. If you want "\
13
+ "a configuration that is compatible with one of these frameworks, then please " \
14
+ "re-run this generator with --bootstrap or --foundation as an option."
14
15
  end
15
16
 
16
17
  def copy_config
@@ -18,6 +19,8 @@ module SimpleForm
18
19
 
19
20
  if options[:bootstrap]
20
21
  template "config/initializers/simple_form_bootstrap.rb"
22
+ elsif options[:foundation]
23
+ template "config/initializers/simple_form_foundation.rb"
21
24
  end
22
25
 
23
26
  directory 'config/locales'