aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-14 16:28:44 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-14 16:28:44 +0000
commit82aff27c043d3335277e18e3bd283e5b09b198fb (patch)
tree46340220a15d97e4b7e37618f0f1308b4c51e5a1
parent971fa4cd364d86bc5e999520517e85804c5a6d58 (diff)
downloadrails-82aff27c043d3335277e18e3bd283e5b09b198fb.tar.gz
rails-82aff27c043d3335277e18e3bd283e5b09b198fb.tar.bz2
rails-82aff27c043d3335277e18e3bd283e5b09b198fb.zip
Remove the duplicated remote_function and make the real deal public
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@905 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb34
1 files changed, 11 insertions, 23 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 619ce94341..814314a4be 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -57,9 +57,18 @@ module ActionView
end
def remote_function(options)
+ callbacks = build_callbacks(options)
+
function = options[:update] ?
- "update_with_response('#{options[:update]}', '#{url_for(options[:url])}'#{', Form.serialize(this)' if options[:form]})" :
- "xml_request('#{url_for(options[:url])}'#{', Form.serialize(this)' if options[:form]})"
+ "update_with_response('#{options[:update]}', " :
+ "xml_request("
+
+ function << "'#{url_for(options[:url])}'"
+ function << ', Form.serialize(this)' if options[:form]
+ function << ', null' if !options[:form] && callbacks
+ function << ", true" if callbacks || options[:type] != :sync
+ function << ", #{callbacks}" if callbacks
+ function << ')'
function = "#{options[:before]}; #{function}" if options[:before]
function = "#{function}; #{options[:after]}" if options[:after]
@@ -267,27 +276,6 @@ module ActionView
callbacks << "}" if callbacks
callbacks
end
-
- def remote_function(options)
- callbacks = build_callbacks(options)
-
- function = options[:update] ?
- "update_with_response('#{options[:update]}', " :
- "xml_request("
-
- function << "'#{url_for(options[:url])}'"
- function << ', Form.serialize(this)' if options[:form]
- function << ', null' if !options[:form] && callbacks
- function << ", true" if callbacks || options[:type] != :sync
- function << ", #{callbacks}" if callbacks
- function << ')'
-
- function = "#{options[:before]}; #{function}" if options[:before]
- function = "#{function}; #{options[:after]}" if options[:after]
- function = "if (#{options[:condition]}) { #{function}; }" if options[:condition]
-
- return function
- end
end
end
end