1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
David Heinemeier Hansson 2005-03-14 16:28:44 +00:00
parent 971fa4cd36
commit 82aff27c04

View file

@ -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