README.md in simple_form-2.0.0.rc vs README.md in simple_form-2.0.0
- old
+ new
@@ -1,15 +1,19 @@
# SimpleForm - Rails forms made easy.
[![Build Status](https://secure.travis-ci.org/plataformatec/simple_form.png)](http://travis-ci.org/plataformatec/simple_form)
**SimpleForm** aims to be as flexible as possible while helping you with powerful components to create
-your forms. The basic goal of simple form is to not touch your way of defining the layout, letting
+your forms. The basic goal of SimpleForm is to not touch your way of defining the layout, letting
you find the better design for your eyes. Most of the DSL was inherited from Formtastic,
which we are thankful for and should make you feel right at home.
-INFO: This README is [also available in a friendly navigable format](http://simple-form.plataformatec.com.br/).
+INFO: This README is [also available in a friendly navigable format](http://simple-form.plataformatec.com.br/)
+and refers to **SimpleForm** 2.0. If you are using **SimpleForm** in the versions 1.x, you should
+check this branch:
+https://github.com/plataformatec/simple_form/tree/v1.5
+
## Installation
Add it to your Gemfile:
`gem 'simple_form'`
@@ -25,15 +29,10 @@
Also, if you want to use the country select, you will need the
[country_select gem](https://rubygems.org/gems/country_select), add it to your Gemfile:
`gem 'country_select'`
-And you are ready to go. Since this branch aims Rails 3 support, if you want to use it with
-Rails 2.3 you should check this branch:
-
-`http://github.com/plataformatec/simple_form/tree/v1.0`
-
## Configuration
**SimpleForm** has several configuration options. You can read and change them in the initializer
created by **SimpleForm**, so if you haven't executed the command below yet, please do:
@@ -71,12 +70,12 @@
b.use :placeholder
b.use :readonly
# Form components
b.use :label_input
- b.use :hint, :tag => :span, :class => :hint
- b.use :error, :tag => :span, :class => :error
+ b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
+ b.use :error, :wrap_with => { :tag => :span, :class => :error }
end
```
The _Form components_ will generate the form tags like labels, inputs, hints or errors contents.
@@ -87,13 +86,13 @@
```ruby
config.wrappers do |b|
b.use :placeholder
b.use :label_input
- b.use :tag => :div, :class => 'separator' do |component|
- component.use :hint, :tag => :span, :class => :hint
- component.use :error, :tag => :span, :class => :error
+ b.wrapper :tag => :div, :class => 'separator' do |component|
+ component.use :hint, :wrap_with => { :tag => :span, :class => :hint }
+ component.use :error, :wrap_with => { :tag => :span, :class => :error }
end
end
```
this will wrap the hint and error components within a `div` tag using the class `'separator'`.
@@ -102,13 +101,13 @@
```ruby
config.wrappers do |b|
b.use :placeholder
b.use :label_input
- b.use :my_wrapper, :tag => :div, :class => 'separator' do |component|
- component.use :hint, :tag => :span, :class => :hint
- component.use :error, :tag => :span, :class => :error
+ b.wrapper :my_wrapper, :tag => :div, :class => 'separator' do |component|
+ component.use :hint, :wrap_with => { :tag => :span, :class => :hint }
+ component.use :error, :wrap_with => { :tag => :span, :class => :error }
end
end
```
and now you can pass options to your `input` calls to customize the `:my_wrapper` _Form component_.
@@ -154,13 +153,13 @@
```ruby
config.wrappers :placeholder => false do |b|
b.use :placeholder
b.use :label_input
- b.use :tag => :div, :class => 'separator' do |component|
- component.optional :hint, :tag => :span, :class => :hint
- component.use :error, :tag => :span, :class => :error
+ b.wrapper :tag => :div, :class => 'separator' do |component|
+ component.optional :hint, :wrap_with => { :tag => :span, :class => :hint }
+ component.use :error, :wrap_with => { :tag => :span, :class => :error }
end
end
```
By setting it as `optional`, a hint will only be generated when `:hint => true` is explicitly used.
@@ -484,10 +483,10 @@
**SimpleForm** also comes with some extra helpers you can use inside rails default forms without relying
on `simple_form_for` helper. They are listed below.
### Simple Fields For
-Wrapper to use simple form inside a default rails form
+Wrapper to use SimpleForm inside a default rails form
```ruby
form_for @user do |f|
f.simple_fields_for :posts do |posts_form|
# Here you have all simple_form methods available