diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-30 20:22:15 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-30 20:22:15 -0600 |
commit | 31820b9dd60dc94744028b41f818f1fdab36e271 (patch) | |
tree | 0ee6452adf0d0a079d1e9daa0af73963513098d2 /actionpack/lib/action_view | |
parent | 392817cf11e2e840eb564dd4f8713092cff167f8 (diff) | |
download | rails-31820b9dd60dc94744028b41f818f1fdab36e271.tar.gz rails-31820b9dd60dc94744028b41f818f1fdab36e271.tar.bz2 rails-31820b9dd60dc94744028b41f818f1fdab36e271.zip |
Generate UJS code for :disable_with
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 4 |
2 files changed, 1 insertions, 14 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 0e034d781a..fb32f78e5b 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -365,15 +365,7 @@ module ActionView options.stringify_keys! if disable_with = options.delete("disable_with") - disable_with = "this.value='#{disable_with}'" - disable_with << ";#{options.delete('onclick')}" if options['onclick'] - - options["onclick"] = "if (window.hiddenCommit) { window.hiddenCommit.setAttribute('value', this.value); }" - options["onclick"] << "else { hiddenCommit = document.createElement('input');hiddenCommit.type = 'hidden';" - options["onclick"] << "hiddenCommit.value = this.value;hiddenCommit.name = this.name;this.form.appendChild(hiddenCommit); }" - options["onclick"] << "this.setAttribute('originalValue', this.value);this.disabled = true;#{disable_with};" - options["onclick"] << "result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());" - options["onclick"] << "if (result == false) { this.value = this.getAttribute('originalValue');this.disabled = false; }return result;" + options["data-disable-with"] = disable_with if disable_with end if confirm = options.delete("confirm") @@ -490,7 +482,6 @@ module ActionView def sanitize_to_id(name) name.to_s.gsub(']','').gsub(/[^-a-zA-Z0-9:.]/, "_") end - end end end diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 9e52275537..7d42a2ef69 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -588,10 +588,6 @@ module ActionView html_options["data-method"] = method if method end - def add_disable_with_to_attributes!(html_options, disable_with) - html_options["data-disable-with"] = disable_with if disable_with - end - def options_for_javascript(options) if options.empty? '{}' |