diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-03 08:00:38 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-03 08:00:38 +0000 |
commit | 481cac9658848a32838a5a3899610f52844ba2f0 (patch) | |
tree | 90bd09fad3b25ccfdeeea9fb550506aed4f8b758 /actionpack/lib | |
parent | da4b15fe188dfd1fea42cadde6f984f9a1bd3a85 (diff) | |
download | rails-481cac9658848a32838a5a3899610f52844ba2f0.tar.gz rails-481cac9658848a32838a5a3899610f52844ba2f0.tar.bz2 rails-481cac9658848a32838a5a3899610f52844ba2f0.zip |
AJAX error handling fix, Prototype event handling #1589 [Thomas Fuchs]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1617 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/javascript_helper.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/prototype.js | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 5b7d739d4f..b562e626fc 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -164,17 +164,19 @@ module ActionView def remote_function(options) #:nodoc: for now javascript_options = options_for_ajax(options) - update = [] + update = '' if options[:update] and options[:update].is_a?Hash + update = [] update << "success:'#{options[:update][:success]}'" if options[:update][:success] update << "failure:'#{options[:update][:failure]}'" if options[:update][:failure] + update = '{' + update.join(',') + '}' elsif options[:update] - update << "success:'#{options[:update]}'" + update << "'#{options[:update]}'" end function = update.empty? ? "new Ajax.Request(" : - "new Ajax.Updater({#{update.join(',')}}, " + "new Ajax.Updater(#{update}, " function << "'#{url_for(options[:url])}'" function << ", #{javascript_options})" diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js index 4946ec0b70..64b4109367 100644 --- a/actionpack/lib/action_view/helpers/javascripts/prototype.js +++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js @@ -265,7 +265,8 @@ Ajax.Updater.prototype = (new Ajax.Base()).extend({ initialize: function(container, url, options) { this.containers = { success: container.success ? $(container.success) : $(container), - failure: container.failure ? $(container.failure) : $(container) + failure: container.failure ? $(container.failure) : + (container.success ? null : $(container)) } this.setOptions(options); @@ -836,7 +837,7 @@ Object.extend(Event, { KEY_DELETE: 46, element: function(event) { - return event.srcElement || event.currentTarget; + return event.target || event.srcElement; }, isLeftClick: function(event) { |