Use html language and make the table prettier [ci skip]

This commit is contained in:
David Rodríguez de Dios 2013-09-22 11:28:23 +02:00
parent fc2aee47a0
commit f2cd73e4fd
1 changed files with 27 additions and 28 deletions

View File

@ -480,36 +480,35 @@ end
## Available input types and defaults for each column type ## Available input types and defaults for each column type
The following table shows the type of input you will get (column `Input`) for The following table shows the html element you will get for each attribute
each attribute according to its database definition (column `Column Type`). according to its database definition. These defaults can be changed by
Column `Mapping` shows the name of the helper method you need to specify as the specifying the helper method in the column `Mapping` as the `as:` option.
`as:` option to enforce the generation of that specific input type.
```text ```text
Mapping Input Column Type Mapping | Generated HTML Element | Database Column Type
--------------|--------------------------------------|---------------------------------------------------------
boolean checkbox boolean boolean | input[type="checkbox"] | boolean
string text field string string | input[type="text] | string
email email field string with name matching "email" email | input[type="email"] | string with name matching "email"
url url field string with name matching "url" url | input[type="url"] | string with name matching "url"
tel tel field string with name matching "phone" tel | input[type="tel"] | string with name matching "phone"
password password field string with name matching "password" password | input[type="password"] | string with name matching "password"
search search - search | input[type="search"] | -
text textarea text text | textarea | text
file file field string, responding to file methods file | input[type="file"] | string, responding to file methods
hidden hidden field - hidden | input[type="hidden"] | -
integer number field integer integer | input[type="number"] | integer
float number field float float | input[type="number"] | float
decimal number field decimal decimal | input[type="number"] | decimal
range range field - range | input[type="range"] | -
datetime datetime select datetime/timestamp datetime | input[type="datetime"] | datetime/timestamp
date date select date date | input[type="date"] | date
time time select time time | input[type="time"] | time
select collection select belongs_to/has_many/has_and_belongs_to_many associations select | select | belongs_to/has_many/has_and_belongs_to_many associations
radio_buttons collection radio buttons belongs_to radio_buttons | collection of input[type="radio"] | belongs_to associations
check_boxes collection check boxes has_many/has_and_belongs_to_many associations check_boxes | collection of input[type="checkbox"] | has_many/has_and_belongs_to_many associations
country country select string with name matching "country" country | select (countries as options) | string with name matching "country"
time_zone time zone select string with name matching "time_zone" time_zone | select (timezones as options) | string with name matching "time_zone"
``` ```
## Custom inputs ## Custom inputs