Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,11 +65,10 @@ class SemanticFormBuilder < ActionView::Helpers::FormBuilder | |
# * :boolean (a checkbox) - default for :boolean column types (you can also have booleans as :select and :radio) | ||
# * :string (a text field) - default for :string column types | ||
# * :numeric (a text field, like string) - default for :integer, :float and :decimal column types | ||
# * :country (a select menu of country names) - requires a country_select plugin to be installed | ||
# * :email (an email input) - New in HTML5 - needs to be explicitly provided with :as => :email | ||
# * :url (a url input) - New in HTML5 - needs to be explicitly provided with :as => :url | ||
# * :phone (a tel input) - New in HTML5 - needs to be explicitly provided with :as => :phone | ||
# * :search (a search input) - New in HTML5 - needs to be explicity provided with :as => :search | ||
# * :email (an email input) - default for :string column types with 'email' as the method name. | ||
# * :url (a url input) - default for :string column types with 'url' as the method name. | ||
# * :phone (a tel input) - default for :string column types with 'phone' or 'fax' in the method name. | ||
# * :search (a search input) - default for :string column types with 'search' as the method name. | ||
# * :country (a select menu of country names) - requires a country_select plugin to be installed | ||
# * :hidden (a hidden field) - creates a hidden field (added for compatibility) | ||
# | ||
|
@@ -82,7 +81,7 @@ class SemanticFormBuilder < ActionView::Helpers::FormBuilder | |
# <%= form.input :manager_id, :as => :radio %> | ||
# <%= form.input :hired_at, :as => :date, :label => "Date Hired" %> | ||
# <%= form.input :phone, :required => false, :hint => "Eg: +1 555 1234" %> | ||
# <%= form.input :email, :as => :email %> | ||
# <%= form.input :email %> | ||
# <%= form.input :website, :as => :url, :hint => "You may wish to omit the http://" %> | ||
# <% end %> | ||
# <% end %> | ||
|
@@ -1465,6 +1464,10 @@ def default_input_type(method, options = {}) #:nodoc: | |
return :password if method.to_s =~ /password/ | ||
return :country if method.to_s =~ /country$/ | ||
return :time_zone if method.to_s =~ /time_zone/ | ||
return :email if method.to_s =~ /^email$/ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
asanghi
Contributor
|
||
return :url if method.to_s =~ /^url$/ | ||
This comment has been minimized.
Sorry, something went wrong.
asanghi
Contributor
|
||
return :phone if method.to_s =~ /(phone|fax)/ | ||
return :search if method.to_s =~ /^search$/ | ||
when :integer | ||
return :select if method.to_s =~ /_id$/ | ||
return :numeric | ||
|
I think this will be better if is /email/ or /email$/ to match fields like customer_email, secundary_email or like that. Same for urls...
What you think?