From 683fc4db00f496e5225928afb4d4e932e0fcdc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Galdino=20+=20Rafael=20Mendon=C3=A7a=20Fran=C3=A7?= =?UTF-8?q?a?= Date: Mon, 14 May 2012 16:40:43 -0300 Subject: Remove `:disable_with` in favor of `'data-disable-with'` option from `submit_tag`, `button_tag` and `button_to` helpers. --- .../lib/action_view/helpers/form_tag_helper.rb | 24 +++------------------- actionpack/lib/action_view/helpers/url_helper.rb | 6 ++---- 2 files changed, 5 insertions(+), 25 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 248cc2f6a3..74c7d8fa3f 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -386,9 +386,6 @@ module ActionView # drivers will provide a prompt with the question specified. If the user accepts, # the form is processed normally, otherwise no action is taken. # * :disabled - If true, the user will not be able to use this input. - # * :disable_with - Value of this parameter will be used as the value for a - # disabled version of the submit button when the form is submitted. This feature is - # provided by the unobtrusive JavaScript driver. # * Any other key creates standard HTML options for the tag. # # ==== Examples @@ -401,14 +398,14 @@ module ActionView # submit_tag "Save edits", :disabled => true # # => # - # submit_tag "Complete sale", :disable_with => "Please wait..." + # submit_tag "Complete sale", 'data-disable-with' => "Please wait..." # # => # # submit_tag nil, :class => "form_submit" # # => # - # submit_tag "Edit", :disable_with => "Editing...", :class => "edit_button" - # # => + # submit_tag "Edit", :class => "edit_button" + # # => # # submit_tag "Save", :confirm => "Are you sure?" # # => @@ -416,10 +413,6 @@ module ActionView def submit_tag(value = "Save changes", options = {}) options = options.stringify_keys - if disable_with = options.delete("disable_with") - options["data-disable-with"] = disable_with - end - if confirm = options.delete("confirm") options["data-confirm"] = confirm end @@ -441,10 +434,6 @@ module ActionView # processed normally, otherwise no action is taken. # * :disabled - If true, the user will not be able to # use this input. - # * :disable_with - Value of this parameter will be - # used as the value for a disabled version of the submit - # button when the form is submitted. This feature is provided - # by the unobtrusive JavaScript driver. # * Any other key creates standard HTML options for the tag. # # ==== Examples @@ -458,18 +447,11 @@ module ActionView # # Ask me! # # # - # button_tag "Checkout", :disable_with => "Please wait..." - # # => - # def button_tag(content_or_options = nil, options = nil, &block) options = content_or_options if block_given? && content_or_options.is_a?(Hash) options ||= {} options = options.stringify_keys - if disable_with = options.delete("disable_with") - options["data-disable-with"] = disable_with - end - if confirm = options.delete("confirm") options["data-confirm"] = confirm end diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 802bf9d29f..31ab0d858a 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -322,11 +322,11 @@ module ActionView # # # <%= button_to('Destroy', 'http://www.example.com', :confirm => 'Are you sure?', - # :method => "delete", :remote => true, :disable_with => 'loading...') %> + # :method => "delete", :remote => true) %> # # => "
# #
# # - # # + # # # # # #
# #
" @@ -616,11 +616,9 @@ 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') - html_options["data-disable-with"] = disable_with if disable_with html_options["data-confirm"] = confirm if confirm add_method_to_attributes!(html_options, method) if method -- cgit v1.2.3