aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/tags/time_field.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2012-05-17 23:13:39 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2012-05-17 23:13:39 -0700
commitd8e8ab1c5351a3b8707143a787fed514b75a4144 (patch)
tree413b070e34022ddf4a8889b0045dd4582a8a65bc /actionpack/lib/action_view/helpers/tags/time_field.rb
parentb23ac936a6ef980547666da002681a77d8340573 (diff)
parent446940c366d588e7e895a64caf325f5f99cba0fb (diff)
downloadrails-d8e8ab1c5351a3b8707143a787fed514b75a4144.tar.gz
rails-d8e8ab1c5351a3b8707143a787fed514b75a4144.tar.bz2
rails-d8e8ab1c5351a3b8707143a787fed514b75a4144.zip
Merge pull request #5715 from soulim/add_time_input_control
Add HTML5 input[type="time"] helper
Diffstat (limited to 'actionpack/lib/action_view/helpers/tags/time_field.rb')
-rw-r--r--actionpack/lib/action_view/helpers/tags/time_field.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/time_field.rb b/actionpack/lib/action_view/helpers/tags/time_field.rb
new file mode 100644
index 0000000000..271dc00c54
--- /dev/null
+++ b/actionpack/lib/action_view/helpers/tags/time_field.rb
@@ -0,0 +1,14 @@
+module ActionView
+ module Helpers
+ module Tags
+ class TimeField < TextField #:nodoc:
+ def render
+ options = @options.stringify_keys
+ options["value"] = @options.fetch("value") { value(object).try(:strftime, "%T.%L") }
+ @options = options
+ super
+ end
+ end
+ end
+ end
+end