simple_form 3.0.0.rc → 3.0.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 +17 -10
- data/README.md +65 -55
- data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +3 -0
- data/lib/simple_form.rb +4 -0
- data/lib/simple_form/action_view_extensions/builder.rb.orig +247 -0
- data/lib/simple_form/form_builder.rb +10 -4
- data/lib/simple_form/form_builder.rb.orig +486 -0
- data/lib/simple_form/inputs/base.rb +4 -0
- data/lib/simple_form/inputs/boolean_input.rb +1 -0
- 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/tags.rb +2 -1
- data/lib/simple_form/version.rb +1 -1
- data/lib/simple_form/version.rb.orig +7 -0
- data/test/action_view_extensions/builder_test.rb +3 -4
- data/test/form_builder/association_test.rb +8 -0
- data/test/form_builder/general_test.rb +13 -0
- data/test/form_builder/input_field_test.rb +17 -0
- data/test/form_builder/label_test.rb +1 -1
- data/test/inputs/boolean_input_test.rb +12 -0
- data/test/inputs/collection_check_boxes_input_test.rb +5 -0
- data/test/inputs/collection_radio_buttons_input_test.rb +5 -0
- data/test/inputs/collection_select_input_test.rb +7 -1
- data/test/inputs/datetime_input_test.rb +4 -4
- data/test/inputs/general_test.rb +16 -0
- data/test/inputs/grouped_collection_select_input_test.rb +13 -0
- data/test/support/models.rb +18 -1
- data/test/test_helper.rb +8 -21
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bda3ec212b0e4f1da3e765b704b417893098679
|
4
|
+
data.tar.gz: 81b0e670aae4612d40793b872f6fc553fd6d05ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e242bc383e74b99f508350376d007c18bd7aedb325632d2d3a8a28043275efa03a9c5b90e6d4a00cec68b53de6636bdb43b3a0af5a83160b8a8bad88919d6248
|
7
|
+
data.tar.gz: 70b1845d8a357e8e4ff85def7540d849a8fcd4d070a78e185f2c369da7a453b7def368309dc3339a5a5c2b2f8f47613db2be328ac0dbbb90c3fa74aef996f80a
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,27 @@
|
|
1
|
-
##
|
1
|
+
## 3.0.0
|
2
2
|
|
3
3
|
### enhancements
|
4
|
+
* New `input_class` global config option to set a class to be generated in all inputs.
|
5
|
+
* Collection tags accept html attributes as the last element of collection [@nashby](https://github.com/nashby)
|
6
|
+
* Change default `:value_method` of collection tags from `:last` to `:second` [@nashby](https://github.com/nashby)
|
7
|
+
* Support `Proc` object in `:conditions` option of associations [@bradly](https://github.com/bradly)
|
8
|
+
* `input_field` supports `html5` component [@nashby](https://github.com/nashby)
|
4
9
|
* Make `field_error_proc` configurable [@dfens](https://github.com/dfens)
|
5
|
-
|
6
|
-
### bug fix
|
7
|
-
* Remove deprecation warnings related to `Relation#all` from Rails 4.
|
8
|
-
* Form builder can be used outside the context of a controller [@jasonwebster](https://github.com/jasonwebster)
|
9
|
-
* Skip pattern attribute when using `validates_format_of` with `:without` option [@glebm](https://github.com/glebm)
|
10
|
-
|
11
|
-
## 3.0.0.beta1
|
12
|
-
|
13
|
-
### enhancements
|
14
10
|
* Support to Rails 4.
|
15
11
|
* Removed deprecated methods.
|
16
12
|
* SimpleForm no longer sets the `size` attribute automatically and the `default_input_size` setting
|
17
13
|
is now deprecated.
|
18
14
|
* Support to aria-required attribute to required fields [@ckundo](https://github.com/ckundo)
|
19
15
|
|
16
|
+
### bug fix
|
17
|
+
* Make `DateTimeInput#label_target` method to work with string values in `I18n.t('date.order')` (default
|
18
|
+
behaviour in Rails 4)
|
19
|
+
Closes [#846](https://github.com/plataformatec/simple_form/issues/846) [@mjankowski](https://github.com/mjankowski)
|
20
|
+
* Add "checkbox" class to the label of boolean input when there is no `:label`
|
21
|
+
in `generate_additional_classes_for` config option [@nashby](https://github.com/nashby)
|
22
|
+
* Support models with digits in their names [@webgago](https://github.com/webgago)
|
23
|
+
* Remove deprecation warnings related to `Relation#all` from Rails 4.
|
24
|
+
* Form builder can be used outside the context of a controller [@jasonwebster](https://github.com/jasonwebster)
|
25
|
+
* Skip pattern attribute when using `validates_format_of` with `:without` option [@glebm](https://github.com/glebm)
|
26
|
+
|
20
27
|
Please check [v2.1](https://github.com/plataformatec/simple_form/blob/v2.1/CHANGELOG.md) for previous changes.
|
data/README.md
CHANGED
@@ -8,13 +8,13 @@ By [Plataformatec](http://plataformatec.com.br/).
|
|
8
8
|
|
9
9
|
Rails forms made easy.
|
10
10
|
|
11
|
-
**
|
12
|
-
your forms. The basic goal of
|
11
|
+
**Simple Form** aims to be as flexible as possible while helping you with powerful components to create
|
12
|
+
your forms. The basic goal of **Simple Form** is to not touch your way of defining the layout, letting
|
13
13
|
you find the better design for your eyes. Most of the DSL was inherited from Formtastic,
|
14
14
|
which we are thankful for and should make you feel right at home.
|
15
15
|
|
16
16
|
INFO: This README is [also available in a friendly navigable format](http://simple-form.plataformatec.com.br/)
|
17
|
-
and refers to **
|
17
|
+
and refers to **Simple Form** 3.0. For older releases, check the related branch for your version.
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
@@ -45,7 +45,7 @@ gem 'country_select'
|
|
45
45
|
|
46
46
|
### Twitter Bootstrap
|
47
47
|
|
48
|
-
**
|
48
|
+
**Simple Form** can be easily integrated to the [Twitter Bootstrap](http://twitter.github.com/bootstrap).
|
49
49
|
To do that you have to use the `bootstrap` option in the install generator, like this:
|
50
50
|
|
51
51
|
```console
|
@@ -59,29 +59,32 @@ For more information see the generator output, our
|
|
59
59
|
[example application code](https://github.com/rafaelfranca/simple_form-bootstrap) and
|
60
60
|
[the live example app](http://simple-form-bootstrap.plataformatec.com.br/).
|
61
61
|
|
62
|
-
**NOTE**: **
|
62
|
+
**NOTE**: **Simple Form** integration requires Twitter Bootstrap version 2.0 or higher.
|
63
63
|
|
64
64
|
### Zurb Foundation 3
|
65
65
|
|
66
|
-
To generate wrappers that are compatible with [Zurb Foundation 3](http://foundation.zurb.com/), pass
|
66
|
+
To generate wrappers that are compatible with [Zurb Foundation 3](http://foundation.zurb.com/), pass
|
67
|
+
the `foundation` option to the generator, like this:
|
67
68
|
|
68
69
|
```console
|
69
70
|
rails generate simple_form:install --foundation
|
70
71
|
```
|
71
72
|
|
72
|
-
Please note that the Foundation wrapper does not support the `:hint` option by default. In order to
|
73
|
+
Please note that the Foundation wrapper does not support the `:hint` option by default. In order to
|
74
|
+
enable hints, please uncomment the appropriate line in `config/initializers/simple_form_foundation.rb`.
|
75
|
+
You will need to provide your own CSS styles for hints.
|
73
76
|
|
74
77
|
Please see the [instructions on how to install Foundation in a Rails app](http://foundation.zurb.com/old-docs/f3/rails.php).
|
75
78
|
|
76
79
|
## Usage
|
77
80
|
|
78
|
-
**
|
81
|
+
**Simple Form** was designed to be customized as you need to. Basically it's a stack of components that
|
79
82
|
are invoked to create a complete html input for you, which by default contains label, hints, errors
|
80
83
|
and the input itself. It does not aim to create a lot of different logic from the default Rails
|
81
|
-
form helpers, as they do a great work by themselves. Instead, **
|
84
|
+
form helpers, as they do a great work by themselves. Instead, **Simple Form** acts as a DSL and just
|
82
85
|
maps your input type (retrieved from the column definition in the database) to a specific helper method.
|
83
86
|
|
84
|
-
To start using **
|
87
|
+
To start using **Simple Form** you just have to use the helper it provides:
|
85
88
|
|
86
89
|
```erb
|
87
90
|
<%= simple_form_for @user do |f| %>
|
@@ -144,7 +147,7 @@ overwrite the defaults:
|
|
144
147
|
<% end %>
|
145
148
|
```
|
146
149
|
|
147
|
-
Since **
|
150
|
+
Since **Simple Form** generates a wrapper div around your label and input by default, you can pass
|
148
151
|
any html attribute to that wrapper as well using the `:wrapper_html` option, like so:
|
149
152
|
|
150
153
|
```erb
|
@@ -158,7 +161,9 @@ any html attribute to that wrapper as well using the `:wrapper_html` option, lik
|
|
158
161
|
|
159
162
|
Required fields are marked with an * prepended to their labels.
|
160
163
|
|
161
|
-
By default all inputs are required. When the form object has `presence` validations attached to its
|
164
|
+
By default all inputs are required. When the form object has `presence` validations attached to its
|
165
|
+
fields, **Simple Form** tells required and optional fields apart. For performance reasons, this
|
166
|
+
detection is skipped on validations that make use of conditional options, such as `:if` and `:unless`.
|
162
167
|
|
163
168
|
And of course, the `required` property of any input can be overwritten as needed:
|
164
169
|
|
@@ -171,7 +176,7 @@ And of course, the `required` property of any input can be overwritten as needed
|
|
171
176
|
<% end %>
|
172
177
|
```
|
173
178
|
|
174
|
-
**
|
179
|
+
**Simple Form** also lets you overwrite the default input type it creates:
|
175
180
|
|
176
181
|
```erb
|
177
182
|
<%= simple_form_for @user do |f| %>
|
@@ -187,7 +192,7 @@ So instead of a checkbox for the *accepts* attribute, you'll have a pair of radi
|
|
187
192
|
labels and a text area instead of a text field for the description. You can also render boolean
|
188
193
|
attributes using `as: :select` to show a dropdown.
|
189
194
|
|
190
|
-
It is also possible to give the `:disabled` option to **
|
195
|
+
It is also possible to give the `:disabled` option to **Simple Form**, and it'll automatically mark
|
191
196
|
the wrapper as disabled with a css class, so you can style labels, hints and other components inside
|
192
197
|
the wrapper as well:
|
193
198
|
|
@@ -198,7 +203,7 @@ the wrapper as well:
|
|
198
203
|
<% end %>
|
199
204
|
```
|
200
205
|
|
201
|
-
**
|
206
|
+
**Simple Form** accepts same options as their corresponding input type helper in Rails:
|
202
207
|
|
203
208
|
```erb
|
204
209
|
<%= simple_form_for @user do |f| %>
|
@@ -209,7 +214,7 @@ the wrapper as well:
|
|
209
214
|
<% end %>
|
210
215
|
```
|
211
216
|
|
212
|
-
**
|
217
|
+
**Simple Form** also allows you to use label, hint, input_field, error and full_error helpers
|
213
218
|
(please take a look at the rdocs for each method for more info):
|
214
219
|
|
215
220
|
```erb
|
@@ -227,12 +232,13 @@ Any extra option passed to these methods will be rendered as html option.
|
|
227
232
|
|
228
233
|
### Stripping away all wrapper divs
|
229
234
|
|
230
|
-
**
|
235
|
+
**Simple Form** also allows you to strip away all the div wrappers around the `<input>` field that is
|
236
|
+
generated with the usual `f.input`.
|
231
237
|
The easiest way to achieve this is to use `f.input_field`.
|
232
238
|
|
233
239
|
Example:
|
234
240
|
|
235
|
-
```
|
241
|
+
```ruby
|
236
242
|
simple_form_for @user do |f|
|
237
243
|
f.input_field :name
|
238
244
|
end
|
@@ -240,7 +246,7 @@ end
|
|
240
246
|
|
241
247
|
Produces:
|
242
248
|
|
243
|
-
```
|
249
|
+
```html
|
244
250
|
<input class="string required" id="user_name" maxlength="100"
|
245
251
|
name="user[name]" size="100" type="text" value="Carlos" />
|
246
252
|
```
|
@@ -262,7 +268,7 @@ overriding the `:collection` option:
|
|
262
268
|
|
263
269
|
Collections can be arrays or ranges, and when a `:collection` is given the `:select` input will be
|
264
270
|
rendered by default, so we don't need to pass the `as: :select` option. Other types of collection
|
265
|
-
are `:radio_buttons` and `:check_boxes`. Those are added by **
|
271
|
+
are `:radio_buttons` and `:check_boxes`. Those are added by **Simple Form** to Rails set of form
|
266
272
|
helpers (read Extra Helpers session below for more information).
|
267
273
|
|
268
274
|
Collection inputs accept two other options beside collections:
|
@@ -294,12 +300,12 @@ used to retrieve label/value attributes for the `option` tags. Besides that, you
|
|
294
300
|
each group (required)
|
295
301
|
|
296
302
|
* _group_label_method_ => the label method to be applied on the given collection to retrieve the label
|
297
|
-
for the _optgroup_ (**
|
303
|
+
for the _optgroup_ (**Simple Form** will attempt to guess the best one the same way it does with
|
298
304
|
`:label_method`)
|
299
305
|
|
300
306
|
### Priority
|
301
307
|
|
302
|
-
**
|
308
|
+
**Simple Form** also supports `:time_zone` and `:country`. When using such helpers, you can give
|
303
309
|
`:priority` as option to select which time zones and/or countries should be given higher priority:
|
304
310
|
|
305
311
|
```ruby
|
@@ -319,7 +325,7 @@ f.input :shipping_country, priority: [ "Brazil" ], collection: [ "Australia", "B
|
|
319
325
|
|
320
326
|
### Associations
|
321
327
|
|
322
|
-
To deal with associations, **
|
328
|
+
To deal with associations, **Simple Form** can generate select inputs, a series of radios buttons or check boxes.
|
323
329
|
Lets see how it works: imagine you have a user model that belongs to a company and has_and_belongs_to_many
|
324
330
|
roles. The structure would be something like:
|
325
331
|
|
@@ -372,9 +378,12 @@ In case you want to declare different labels and values:
|
|
372
378
|
f.association :company, label_method: :company_name, value_method: :id, include_blank: false
|
373
379
|
```
|
374
380
|
|
381
|
+
Please note that the association helper is currently only tested with Active Record. It currently
|
382
|
+
does not work well with Mongoid and depending on the ORM you're using your mileage may vary.
|
383
|
+
|
375
384
|
### Buttons
|
376
385
|
|
377
|
-
All web forms need buttons, right? **
|
386
|
+
All web forms need buttons, right? **Simple Form** wraps them in the DSL, acting like a proxy:
|
378
387
|
|
379
388
|
```erb
|
380
389
|
<%= simple_form_for @user do |f| %>
|
@@ -387,7 +396,7 @@ The above will simply call submit. You choose to use it or not, it's just a ques
|
|
387
396
|
|
388
397
|
### Wrapping Rails Form Helpers
|
389
398
|
|
390
|
-
Say you wanted to use a rails form helper but still wrap it in **
|
399
|
+
Say you wanted to use a rails form helper but still wrap it in **Simple Form** goodness? You can, by
|
391
400
|
calling input with a block like so:
|
392
401
|
|
393
402
|
```erb
|
@@ -401,12 +410,12 @@ hash of additional attributes for each option.
|
|
401
410
|
|
402
411
|
### Extra helpers
|
403
412
|
|
404
|
-
**
|
413
|
+
**Simple Form** also comes with some extra helpers you can use inside rails default forms without relying
|
405
414
|
on `simple_form_for` helper. They are listed below.
|
406
415
|
|
407
416
|
#### Simple Fields For
|
408
417
|
|
409
|
-
Wrapper to use **
|
418
|
+
Wrapper to use **Simple Form** inside a default rails form. It works in the same way that the `fields_for`
|
410
419
|
Rails helper, but change the builder to use the `SimpleForm::FormBuilder`.
|
411
420
|
|
412
421
|
```ruby
|
@@ -418,7 +427,6 @@ form_for @user do |f|
|
|
418
427
|
end
|
419
428
|
```
|
420
429
|
|
421
|
-
|
422
430
|
#### Collection Radio Buttons
|
423
431
|
|
424
432
|
Creates a collection of radio inputs with labels associated (same API as `collection_select`):
|
@@ -465,7 +473,7 @@ end
|
|
465
473
|
|
466
474
|
## Mappings/Inputs available
|
467
475
|
|
468
|
-
**
|
476
|
+
**Simple Form** comes with a lot of default mappings:
|
469
477
|
|
470
478
|
```text
|
471
479
|
Mapping Input Column Type
|
@@ -496,7 +504,7 @@ time_zone time zone select string with name matching "t
|
|
496
504
|
|
497
505
|
## Custom inputs
|
498
506
|
|
499
|
-
It is very easy to add custom inputs to **
|
507
|
+
It is very easy to add custom inputs to **Simple Form**. For instance, if you want to add a custom input
|
500
508
|
that extends the string one, you just need to add this file:
|
501
509
|
|
502
510
|
```ruby
|
@@ -514,7 +522,7 @@ And use it in your views:
|
|
514
522
|
f.input :money, as: :currency
|
515
523
|
```
|
516
524
|
|
517
|
-
You can also redefine existing **
|
525
|
+
You can also redefine existing **Simple Form** inputs by creating a new class with the same name. For
|
518
526
|
instance, if you want to wrap date/time/datetime in a div, you can do:
|
519
527
|
|
520
528
|
```ruby
|
@@ -539,7 +547,7 @@ end
|
|
539
547
|
|
540
548
|
## Custom form builder
|
541
549
|
|
542
|
-
You can create a custom form builder that uses **
|
550
|
+
You can create a custom form builder that uses **Simple Form**.
|
543
551
|
|
544
552
|
Create a helper method that calls `simple_form_for` with a custom builder:
|
545
553
|
|
@@ -563,7 +571,7 @@ end
|
|
563
571
|
|
564
572
|
## I18n
|
565
573
|
|
566
|
-
**
|
574
|
+
**Simple Form** uses all power of I18n API to lookup labels, hints and placeholders. To customize your
|
567
575
|
forms you can create a locale file like this:
|
568
576
|
|
569
577
|
```yaml
|
@@ -585,7 +593,7 @@ en:
|
|
585
593
|
|
586
594
|
And your forms will use this information to render the components for you.
|
587
595
|
|
588
|
-
**
|
596
|
+
**Simple Form** also lets you be more specific, separating lookups through actions for labels, hints and
|
589
597
|
placeholders. Let's say you want a different label for new and edit actions, the locale file would
|
590
598
|
be something like:
|
591
599
|
|
@@ -601,7 +609,7 @@ en:
|
|
601
609
|
password: 'Change password'
|
602
610
|
```
|
603
611
|
|
604
|
-
This way **
|
612
|
+
This way **Simple Form** will figure out the right translation for you, based on the action being
|
605
613
|
rendered. And to be a little bit DRYer with your locale file, you can specify defaults for all
|
606
614
|
models under the 'defaults' key:
|
607
615
|
|
@@ -624,24 +632,24 @@ en:
|
|
624
632
|
password: '****'
|
625
633
|
```
|
626
634
|
|
627
|
-
**
|
635
|
+
**Simple Form** will always look for a default attribute translation under the "defaults" key if no
|
628
636
|
specific is found inside the model key. Note that this syntax is different from 1.x. To migrate to
|
629
637
|
the new syntax, just move "labels.#{attribute}" to "labels.defaults.#{attribute}".
|
630
638
|
|
631
|
-
In addition, **
|
639
|
+
In addition, **Simple Form** will fallback to default human_attribute_name from Rails when no other
|
632
640
|
translation is found for labels. Finally, you can also overwrite any label, hint or placeholder
|
633
641
|
inside your view, just by passing the option manually. This way the I18n lookup will be skipped.
|
634
642
|
|
635
|
-
**
|
643
|
+
**Simple Form** also has support for translating options in collection helpers. For instance, given a
|
636
644
|
User with a `:gender` attribute, you might want to create a select box showing translated labels
|
637
|
-
that would post either `male` or `female` as value. With **
|
645
|
+
that would post either `male` or `female` as value. With **Simple Form** you could create an input
|
638
646
|
like this:
|
639
647
|
|
640
648
|
```ruby
|
641
649
|
f.input :gender, collection: [:male, :female]
|
642
650
|
```
|
643
651
|
|
644
|
-
And **
|
652
|
+
And **Simple Form** will try a lookup like this in your locale file, to find the right labels to show:
|
645
653
|
|
646
654
|
```yaml
|
647
655
|
en:
|
@@ -654,7 +662,7 @@ en:
|
|
654
662
|
```
|
655
663
|
|
656
664
|
You can also use the `defaults` key as you would do with labels, hints and placeholders. It is
|
657
|
-
important to notice that **
|
665
|
+
important to notice that **Simple Form** will only do the lookup for options if you give a collection
|
658
666
|
composed of symbols only. This is to avoid constant lookups to I18n.
|
659
667
|
|
660
668
|
It's also possible to translate buttons, using Rails' built-in I18n support:
|
@@ -697,22 +705,22 @@ en:
|
|
697
705
|
name: Name
|
698
706
|
```
|
699
707
|
|
700
|
-
This difference exists because **
|
708
|
+
This difference exists because **Simple Form** relies on `object_name` provided by Rails'
|
701
709
|
FormBuilder to determine the translation path for a given object instead of `i18n_key` from the
|
702
710
|
object itself. Thus, similarly, if a form for an `Admin::User` object is defined by calling
|
703
|
-
`simple_form_for @admin_user, as: :some_user`, **
|
711
|
+
`simple_form_for @admin_user, as: :some_user`, **Simple Form** will look for translations
|
704
712
|
under `some_user` instead of `admin_user`.
|
705
713
|
|
706
714
|
## Configuration
|
707
715
|
|
708
|
-
**
|
709
|
-
created by **
|
716
|
+
**Simple Form** has several configuration options. You can read and change them in the initializer
|
717
|
+
created by **Simple Form**, so if you haven't executed the command below yet, please do:
|
710
718
|
|
711
719
|
`rails generate simple_form:install`
|
712
720
|
|
713
721
|
### The wrappers API
|
714
722
|
|
715
|
-
With **
|
723
|
+
With **Simple Form** you can configure how your components will be rendered using the wrappers API.
|
716
724
|
The syntax looks like this:
|
717
725
|
|
718
726
|
```ruby
|
@@ -733,7 +741,8 @@ config.wrappers tag: :div, class: :input,
|
|
733
741
|
end
|
734
742
|
```
|
735
743
|
|
736
|
-
The _Form components_ will generate the form tags like labels, inputs, hints or errors contents.
|
744
|
+
The _Form components_ will generate the form tags like labels, inputs, hints or errors contents.
|
745
|
+
The available components are:
|
737
746
|
|
738
747
|
```ruby
|
739
748
|
:label # The <label> tag alone
|
@@ -811,7 +820,7 @@ simple_form_for @user do |f|
|
|
811
820
|
end
|
812
821
|
```
|
813
822
|
|
814
|
-
**
|
823
|
+
**Simple Form** also allows you to use optional elements. For instance, let's suppose you want to use
|
815
824
|
hints or placeholders, but you don't want them to be generated automatically. You can set their
|
816
825
|
default values to `false` or use the `optional` method. Is preferable to use the `optional` syntax:
|
817
826
|
|
@@ -831,7 +840,7 @@ The same for placeholder.
|
|
831
840
|
|
832
841
|
## HTML 5 Notice
|
833
842
|
|
834
|
-
By default, **
|
843
|
+
By default, **Simple Form** will generate input field types and attributes that are supported in HTML5,
|
835
844
|
but are considered invalid HTML for older document types such as HTML4 or XHTML1.0. The HTML5
|
836
845
|
extensions include the new field types such as email, number, search, url, tel, and the new
|
837
846
|
attributes such as required, autofocus, maxlength, min, max, step.
|
@@ -841,7 +850,7 @@ required attribute to force a value into an input and will prevent form submissi
|
|
841
850
|
Depending on the design of the application this may or may not be desired. In many cases it can
|
842
851
|
break existing UI's.
|
843
852
|
|
844
|
-
It is possible to disable all HTML 5 extensions in **
|
853
|
+
It is possible to disable all HTML 5 extensions in **Simple Form** with the following configuration:
|
845
854
|
|
846
855
|
```ruby
|
847
856
|
SimpleForm.html5 = false # default is true
|
@@ -864,11 +873,11 @@ You can also add `novalidate` to a specific form by setting the option on the fo
|
|
864
873
|
<%= simple_form_for(resource, html: {novalidate: true}) do |form| %>
|
865
874
|
```
|
866
875
|
|
867
|
-
Please notice that any of the configurations above will disable the `placeholder` component,
|
876
|
+
Please notice that any of the configurations above will not disable the `placeholder` component,
|
868
877
|
which is an HTML 5 feature. We believe most of the newest browsers are handling this attribute fine,
|
869
878
|
and if they aren't, any plugin you use would take of using the placeholder attribute to do it.
|
870
879
|
However, you can disable it if you want, by removing the placeholder component from the components
|
871
|
-
list in **
|
880
|
+
list in **Simple Form** configuration file.
|
872
881
|
|
873
882
|
## Information
|
874
883
|
|
@@ -881,11 +890,11 @@ http://groups.google.com/group/plataformatec-simpleform
|
|
881
890
|
|
882
891
|
### RDocs
|
883
892
|
|
884
|
-
You can view the **
|
893
|
+
You can view the **Simple Form** documentation in RDoc format here:
|
885
894
|
|
886
895
|
http://rubydoc.info/github/plataformatec/simple_form/master/frames
|
887
896
|
|
888
|
-
If you need to use **
|
897
|
+
If you need to use **Simple Form** with Rails 2.3, you can always run `gem server` from the command line
|
889
898
|
after you install the gem to access the old documentation.
|
890
899
|
|
891
900
|
### Bug reports
|
@@ -907,4 +916,5 @@ https://github.com/plataformatec/simple_form/issues
|
|
907
916
|
|
908
917
|
MIT License. Copyright 2009-2013 Plataformatec. http://plataformatec.com.br
|
909
918
|
|
910
|
-
You are not granted rights or licenses to the trademarks of the Plataformatec, including without
|
919
|
+
You are not granted rights or licenses to the trademarks of the Plataformatec, including without
|
920
|
+
limitation the Simple Form name or logo.
|