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:
parent
971fa4cd36
commit
82aff27c04
1 changed files with 11 additions and 23 deletions
|
@ -57,9 +57,18 @@ module ActionView
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_function(options)
|
def remote_function(options)
|
||||||
|
callbacks = build_callbacks(options)
|
||||||
|
|
||||||
function = options[:update] ?
|
function = options[:update] ?
|
||||||
"update_with_response('#{options[:update]}', '#{url_for(options[:url])}'#{', Form.serialize(this)' if options[:form]})" :
|
"update_with_response('#{options[:update]}', " :
|
||||||
"xml_request('#{url_for(options[:url])}'#{', Form.serialize(this)' if options[:form]})"
|
"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 = "#{options[:before]}; #{function}" if options[:before]
|
||||||
function = "#{function}; #{options[:after]}" if options[:after]
|
function = "#{function}; #{options[:after]}" if options[:after]
|
||||||
|
@ -267,27 +276,6 @@ module ActionView
|
||||||
callbacks << "}" if callbacks
|
callbacks << "}" if callbacks
|
||||||
callbacks
|
callbacks
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue