From b923f3cf10b274124369599292dd78f5e74586d0 Mon Sep 17 00:00:00 2001 From: Justin Schier Date: Thu, 9 Dec 2010 13:07:38 +0800 Subject: [PATCH 1/2] Final README clarifications. --- README.rdoc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index 1ed16791..0c80d2fe 100644 --- a/README.rdoc +++ b/README.rdoc @@ -45,10 +45,20 @@ Copy rails.js from http://github.com/rails/jquery-ujs/raw/master/src/rails.js in === Step 3 (optional) -Switch the javascript_include_tag :defaults to use jquery instead of the default prototype helpers. Uncomment following line from file config/application.rb +Uncomment following line from file config/application.rb config.action_view.javascript_expansions[:defaults] = %w(jquery rails application) +To load jQuery from a CDN such as Google, just specify the full path. Change the above to + + config.action_view.javascript_expansions[:defaults] = %w(https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js rails application) + +Alternatively, you can specify the exact files to load in app/views/layouts/application.html.erb. Change javascript_include_tag :defaults to use jQuery + <%= javascript_include_tag 'jquery' %> + or + <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js' %> +instead of the default prototype helpers. + = Testing == Installation From 0d2cdcd42efb402aa4c3502776fe2dda09d4ab0c Mon Sep 17 00:00:00 2001 From: Jerrett Date: Tue, 14 Dec 2010 15:03:28 -0800 Subject: [PATCH 2/2] fixing broken beforeSend callback --- src/rails.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rails.js b/src/rails.js index 4ed98998..20ffb83d 100644 --- a/src/rails.js +++ b/src/rails.js @@ -53,7 +53,7 @@ jQuery(function ($) { type: method.toUpperCase(), beforeSend: function (xhr) { xhr.setRequestHeader("Accept", "text/javascript"); - if ($this.triggerHandler('ajax:beforeSend') === false) { + if (el.triggerAndReturn('ajax:beforeSend') === false) { return false; } }, @@ -139,7 +139,7 @@ jQuery(function ($) { }); }; - $(disable_with_form_remote_selector).live('ajax:before.rails', disable_with_input_function); + $(disable_with_form_remote_selector).live('ajax:beforeSend.rails', disable_with_input_function); $(disable_with_form_not_remote_selector).live('submit.rails', disable_with_input_function); $(disable_with_form_remote_selector).live('ajax:complete.rails', function () {