diff options
author | Paco Guzman <fjguzman@aspgems.com> | 2010-10-11 09:02:53 +0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-10-11 13:24:07 -0200 |
commit | 31358d8c3c9309c3394d743bdaded29778fa060f (patch) | |
tree | d306bbd82b32a63c10f70d1b308b8f9a950544f9 /actionpack/lib/action_view | |
parent | e0b76d6151821527f16b3f163abde3ebea1b2a50 (diff) | |
download | rails-31358d8c3c9309c3394d743bdaded29778fa060f.tar.gz rails-31358d8c3c9309c3394d743bdaded29778fa060f.tar.bz2 rails-31358d8c3c9309c3394d743bdaded29778fa060f.zip |
data-disable-with in button_to helper
[#4993 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index da42d94318..adf9b965cb 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -587,9 +587,11 @@ module ActionView html_options = html_options.stringify_keys html_options['data-remote'] = 'true' if link_to_remote_options?(options) || link_to_remote_options?(html_options) + disable_with = html_options.delete("disable_with") confirm = html_options.delete('confirm') method = html_options.delete('method') + add_disable_with_to_attributes!(html_options, disable_with) if disable_with add_confirm_to_attributes!(html_options, confirm) if confirm add_method_to_attributes!(html_options, method) if method @@ -605,6 +607,10 @@ module ActionView html_options["data-confirm"] = confirm if confirm end + def add_disable_with_to_attributes!(html_options, disable_with) + html_options["data-disable-with"] = disable_with if disable_with + end + def add_method_to_attributes!(html_options, method) html_options["rel"] = "nofollow" if method && method.to_s.downcase != "get" html_options["data-method"] = method if method |