parent
01ccfcebd4
commit
19cb663518
|
@ -1,6 +1,7 @@
|
|||
## 3.1.0.rc2
|
||||
|
||||
### enhancements
|
||||
* Add mapping to `uuid` columns.
|
||||
* Add custom namespaces for custom inputs feature. [@vala](https://github.com/vala)
|
||||
* Add `:unless_blank` option to the wrapper API. [@IanVaughan](https://github.com/IanVaughan)
|
||||
* Add support to html markup in the I18n options. [@laurocaetano](https://github.com/laurocaetano)
|
||||
|
|
|
@ -521,6 +521,7 @@ specifying the helper method in the column `Mapping` as the `as:` option.
|
|||
`tel` | `input[type=tel]` | `string` with `name =~ /phone/`
|
||||
`password` | `input[type=password]` | `string` with `name =~ /password/`
|
||||
`search` | `input[type=search]` | -
|
||||
`uuid` | `input[type=text]` | `uuid`
|
||||
`text` | `textarea` | `text`
|
||||
`file` | `input[type=file]` | `string` responding to file methods
|
||||
`hidden` | `input[type=hidden]` | -
|
||||
|
|
|
@ -19,7 +19,7 @@ module SimpleForm
|
|||
|
||||
map_type :text, to: SimpleForm::Inputs::TextInput
|
||||
map_type :file, to: SimpleForm::Inputs::FileInput
|
||||
map_type :string, :email, :search, :tel, :url, to: SimpleForm::Inputs::StringInput
|
||||
map_type :string, :email, :search, :tel, :url, :uuid, to: SimpleForm::Inputs::StringInput
|
||||
map_type :password, to: SimpleForm::Inputs::PasswordInput
|
||||
map_type :integer, :decimal, :float, to: SimpleForm::Inputs::NumericInput
|
||||
map_type :range, to: SimpleForm::Inputs::RangeInput
|
||||
|
|
|
@ -126,6 +126,11 @@ class FormBuilderTest < ActionView::TestCase
|
|||
assert_select 'form input#user_credit_limit.numeric.decimal'
|
||||
end
|
||||
|
||||
test 'builder generates uuid fields for uuid columns' do
|
||||
with_form_for @user, :uuid
|
||||
assert_select 'form input#user_uuid.string.uuid'
|
||||
end
|
||||
|
||||
test 'builder generates password fields for columns that matches password' do
|
||||
with_form_for @user, :password
|
||||
assert_select 'form input#user_password.password'
|
||||
|
|
|
@ -74,7 +74,7 @@ class User
|
|||
:avatar, :home_picture, :email, :status, :residence_country, :phone_number,
|
||||
:post_count, :lock_version, :amount, :attempts, :action, :credit_card, :gender,
|
||||
:extra_special_company_id, :pictures, :picture_ids, :special_pictures,
|
||||
:special_picture_ids
|
||||
:special_picture_ids, :uuid
|
||||
|
||||
def self.build(extra_attributes = {})
|
||||
attributes = {
|
||||
|
@ -125,6 +125,7 @@ class User
|
|||
when :attempts then :integer
|
||||
when :action then :string
|
||||
when :credit_card then :string
|
||||
when :uuid then :uuid
|
||||
end
|
||||
Column.new(attribute, column_type, limit)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue