diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-06-01 09:38:09 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-06-01 09:38:09 +0100 |
commit | 9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78 (patch) | |
tree | 5a711cacac76a83ad12551023da8524f94e7365b /actionpack/lib/action_view/helpers | |
parent | dc7323efd34327c13d26031b68e51314c24360f6 (diff) | |
parent | 9537fd0e3a7625afe4bee75d749647ca1837195a (diff) | |
download | rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.tar.gz rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.tar.bz2 rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 13 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 3 |
2 files changed, 12 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 9e39536653..b4197479a0 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -124,7 +124,11 @@ module ActionView # Use an alternate output buffer for the duration of the block. # Defaults to a new empty string. - def with_output_buffer(buf = '') #:nodoc: + def with_output_buffer(buf = nil) #:nodoc: + unless buf + buf = '' + buf.force_encoding(output_buffer.encoding) if buf.respond_to?(:force_encoding) + end self.output_buffer, old_buffer = buf, output_buffer yield output_buffer @@ -134,9 +138,12 @@ module ActionView # Add the output buffer to the response body and start a new one. def flush_output_buffer #:nodoc: - if output_buffer && output_buffer != '' + if output_buffer && !output_buffer.empty? response.body_parts << output_buffer - self.output_buffer = '' + new = '' + new.force_encoding(output_buffer.encoding) if new.respond_to?(:force_encoding) + self.output_buffer = new + nil end end end diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index daf38fe3da..c96b1fc8d2 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -353,7 +353,8 @@ module ActionView disable_with << ";#{options.delete('onclick')}" if options['onclick'] options["onclick"] = "if (window.hiddenCommit) { window.hiddenCommit.setAttribute('value', this.value); }" - options["onclick"] << "else { hiddenCommit = this.cloneNode(false);hiddenCommit.setAttribute('type', 'hidden');this.form.appendChild(hiddenCommit); }" + 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;" |