diff options
author | Olek Janiszewski <olek.janiszewski@gmail.com> | 2012-02-12 13:32:53 +0100 |
---|---|---|
committer | Olek Janiszewski <olek.janiszewski@gmail.com> | 2012-02-12 16:23:43 +0100 |
commit | d6b26a6040db97a55e23a7f10f2e9ba859eb11dc (patch) | |
tree | 490a06d52b15ce36c1d0e1686654fd2cb7f8c0e3 /actionpack/lib/action_view/helpers/tags/date_field.rb | |
parent | 8671802fe8153e82e54b11c64537f5177f8670a3 (diff) | |
download | rails-d6b26a6040db97a55e23a7f10f2e9ba859eb11dc.tar.gz rails-d6b26a6040db97a55e23a7f10f2e9ba859eb11dc.tar.bz2 rails-d6b26a6040db97a55e23a7f10f2e9ba859eb11dc.zip |
Add HTML5 input[type="date"] helper
Diffstat (limited to 'actionpack/lib/action_view/helpers/tags/date_field.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/tags/date_field.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/date_field.rb b/actionpack/lib/action_view/helpers/tags/date_field.rb new file mode 100644 index 0000000000..bb968e9f39 --- /dev/null +++ b/actionpack/lib/action_view/helpers/tags/date_field.rb @@ -0,0 +1,15 @@ +module ActionView + module Helpers + module Tags + class DateField < TextField #:nodoc: + def render + options = @options.stringify_keys + options["value"] = @options.fetch("value") { value(object).try(:to_date) } + options["size"] = nil + @options = options + super + end + end + end + end +end |