aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorAlex Soulim <soulim@gmail.com>2012-04-03 16:01:00 +0400
committerAlex Soulim <soulim@gmail.com>2012-05-18 08:38:19 +0400
commit446940c366d588e7e895a64caf325f5f99cba0fb (patch)
tree413b070e34022ddf4a8889b0045dd4582a8a65bc /actionpack/lib/action_view/helpers/form_helper.rb
parentb23ac936a6ef980547666da002681a77d8340573 (diff)
downloadrails-446940c366d588e7e895a64caf325f5f99cba0fb.tar.gz
rails-446940c366d588e7e895a64caf325f5f99cba0fb.tar.bz2
rails-446940c366d588e7e895a64caf325f5f99cba0fb.zip
Add HTML5 input[type="time"] helper
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index cc1f133196..6510610034 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -990,6 +990,23 @@ module ActionView
Tags::DateField.new(object_name, method, self, options).render
end
+ # Returns a text_field of type "time".
+ #
+ # The default value is generated by trying to call +strftime+ with "%T.%L"
+ # on the objects's value. It is still possible to override that
+ # by passing the "value" option.
+ #
+ # === Options
+ # * Accepts same options as time_field_tag
+ #
+ # === Example
+ # time_field("task", "started_at")
+ # # => <input id="task_started_at" name="task[started_at]" type="time" />
+ #
+ def time_field(object_name, method, options = {})
+ Tags::TimeField.new(object_name, method, self, options).render
+ end
+
# Returns a text_field of type "url".
#
# url_field("user", "homepage")