Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 82aff27c043d3335277e18e3bd283e5b09b198fb 1 parent 971fa4c
@dhh dhh authored
Showing with 11 additions and 23 deletions.
  1. +11 −23 actionpack/lib/action_view/helpers/javascript_helper.rb
View
34 actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -57,9 +57,18 @@ def form_remote_tag(options = {})
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 @@ def build_callbacks(options)
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
Please sign in to comment.
Something went wrong with that request. Please try again.