diff options
author | Carlos Galdino + Rafael Mendonça França <rafael.franca+carlos.galdino@plataformatec.com.br> | 2012-07-21 16:19:40 -0300 |
---|---|---|
committer | Carlos Galdino + Rafael Mendonça França <rafael.franca+carlos.galdino@plataformatec.com.br> | 2012-07-21 16:25:34 -0300 |
commit | 0106e5fe4436df1853a68c0ed792dc0cf3b9e1a4 (patch) | |
tree | a08a72637fe02cfc642a3b23a01a204c87e11d03 /actionpack/lib/action_view/helpers/form_tag_helper.rb | |
parent | 9345a116af134e6963cda261c448c9ecdb3832ea (diff) | |
download | rails-0106e5fe4436df1853a68c0ed792dc0cf3b9e1a4.tar.gz rails-0106e5fe4436df1853a68c0ed792dc0cf3b9e1a4.tar.bz2 rails-0106e5fe4436df1853a68c0ed792dc0cf3b9e1a4.zip |
Add back `:disable_with` and change deprecation horizon to 4.1
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_tag_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 87f1f4d92f..d7d9c45120 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -391,6 +391,9 @@ module ActionView # * <tt>:confirm => 'question?'</tt> - If present the unobtrusive JavaScript # drivers will provide a prompt with the question specified. If the user accepts, # the form is processed normally, otherwise no action is taken. + # * <tt>:disable_with</tt> - 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. # # ==== Examples # submit_tag @@ -417,6 +420,12 @@ module ActionView def submit_tag(value = "Save changes", options = {}) options = options.stringify_keys + if disable_with = options.delete("disable_with") + ActiveSupport::Deprecation.warn ":disable_with option is deprecated and will be removed from Rails 4.1. Use ':data => { :disable_with => \'Text\' }' instead" + + options["data-disable-with"] = disable_with + end + if confirm = options.delete("confirm") ActiveSupport::Deprecation.warn ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead'" @@ -445,6 +454,10 @@ module ActionView # unobtrusive JavaScript drivers will provide a prompt with # the question specified. If the user accepts, the form is # processed normally, otherwise no action is taken. + # * <tt>:disable_with</tt> - 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. # # ==== Examples # button_tag @@ -457,11 +470,20 @@ module ActionView # # <strong>Ask me!</strong> # # </button> # + # button_tag "Checkout", :data => { disable_with => "Please wait..." } + # # => <button data-disable-with="Please wait..." name="button" type="submit">Checkout</button> + # 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") + ActiveSupport::Deprecation.warn ":disable_with option is deprecated and will be removed from Rails 4.1. Use ':data => { :disable_with => \'Text\' }' instead" + + options["data-disable-with"] = disable_with + end + if confirm = options.delete("confirm") ActiveSupport::Deprecation.warn ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead'" |