ajax 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- ajax (1.1.4)
4
+ ajax (1.1.6)
5
5
  json
6
6
  rack
7
7
 
@@ -10,6 +10,7 @@ As of May 2010 Ajax is being used live in production on kazaa.com[http://www.kaz
10
10
 
11
11
  == Changelog
12
12
 
13
+ * v1.1.6: Fix redirect_to to handle Rails 3 resourceful redirects
13
14
  * v1.1.5: Fix inclusion of +controller+ and +layout+ in <tt>Ajax-Info</tt> response header. Improve RSpec 1.* integration
14
15
  * v1.1.4: Fix RSpec 2 integration
15
16
  * v1.1.3: Guard against possible nil values for the redirect_to url and the referrers
@@ -17,33 +18,29 @@ As of May 2010 Ajax is being used live in production on kazaa.com[http://www.kaz
17
18
  * v1.1.1: Backwards compatibility fix for Rails < 3
18
19
  * <b>v1.1.0: Rails 3 supported!</b>
19
20
 
20
- == Install
21
+ == Install for Rails
21
22
 
22
- === Rails 3
23
+ After getting the Gem installed, take a look at <b>Getting Started</b> for more information about setting up your application for Ajax.
23
24
 
24
- 1. Add the gem to your <tt>Gemspec</tt>
25
+ === Rails 3
25
26
 
26
- gem 'ajax'
27
+ Add the gem to your <tt>Gemspec</tt>:
27
28
 
28
- 2. <tt>bundle</tt>
29
- 3. <tt>rake ajax:install</tt>
30
- 4. Run <tt>rake routes</tt> to verify that the <tt>/ajax/framework</tt> path is being routed correctly. The route will automatically be added to your application but if you have catch-all routes they will take precedence, so if that is the case, you can add the route to <tt>config/routes.rb</tt> manually like so:
29
+ gem 'ajax'
31
30
 
32
- YourAppName::Application.routes.draw do
33
- Ajax::Routes.draw(self)
34
- end
31
+ Then run +bundle+.
35
32
 
36
- === Rails 2
33
+ === Rails 2 Gem
37
34
 
38
- <b> As a Gem</b>
35
+ 1. Follow the Rails 3 install if you are using a <tt>Gemfile</tt>.
39
36
 
40
- 1. Add the gem as a dependency in your <tt>config/environment.rb</tt>
37
+ If you are not using a <tt>Gemfile</tt> add the gem to your <tt>config/environment.rb</tt> configuration block with:
41
38
 
42
39
  config.gem 'ajax'
43
40
 
44
- 2. <tt>rake gems:install</tt>
41
+ Then run <tt>rake gems:install</tt>.
45
42
 
46
- 3. Add to your <tt>Rakefile</tt>
43
+ 2. Include the gem's Rake tasks in your <tt>Rakefile</tt>:
47
44
 
48
45
  begin
49
46
  require 'ajax/tasks'
@@ -51,72 +48,105 @@ As of May 2010 Ajax is being used live in production on kazaa.com[http://www.kaz
51
48
  puts "Warning, couldn't load gem tasks: #{e.message}! Skipping..."
52
49
  end
53
50
 
54
- 4. <tt>rake ajax:install</tt> to install required files. This command is safe to run multiple times. It will skip existing files.
51
+ 3. Add a route for the framework path to your <tt>config/routes.rb</tt>:
52
+
53
+ ActionController::Routing::Routes.draw do |map|
54
+ Ajax::Routes.draw(map)
55
+ end
56
+
57
+ === Rails 2 Plugin
58
+
59
+ Run <tt>script/plugin install http://github.com/kjvarga/ajax.git</tt> from your application's root directory.
60
+
61
+ == Getting Started
62
+
63
+ 1. First run <tt>rake -T ajax</tt> to see the Rake tasks provided and to verify that the gem and its Rake tasks are being included properly.
64
+
65
+
66
+ 2. Run <tt>rake ajax:install</tt> to install required asset files into various application directories. The output from running the command will list the files that are created.
67
+
68
+ 3. Run <tt>rake routes</tt> to verify that the <tt>/ajax/framework</tt> path is being routed correctly. It should route to <tt>AjaxController#framework</tt>.
69
+
70
+ The route will automatically be added to your application if you are running Rails 3 or Ajax is installed as a plugin. If you are running Rails 2 you must add it to your routes file yourself.
71
+
72
+ If you have catch-all routes they may take precedence, so if that is the case you will have to add it to the top of your <tt>config/routes.rb</tt> to ensure it comes first.
55
73
 
56
- 4. Add a route for the framework path to your <tt>config/routes.rb</tt>
74
+ <b>Rails 2</b>:
57
75
 
58
76
  ActionController::Routing::Routes.draw do |map|
59
77
  Ajax::Routes.draw(map)
60
78
  end
61
79
 
62
- 5. Run <tt>rake routes</tt> to verify that the <tt>/ajax/framework</tt> path is being routed correctly.
80
+ <b>Rails 3</b>:
63
81
 
64
- <b> As a Plugin</b>
82
+ YourAppName::Application.routes.draw do
83
+ Ajax::Routes.draw(self)
84
+ end
65
85
 
66
- 1. ./script/plugin install http://github.com/kjvarga/ajax.git
67
- 2. Run <tt>rake routes</tt> to verify that the <tt>/ajax/framework</tt> path is being routed correctly.
86
+ 5. Include the JavaScript files in your application layout file:
68
87
 
69
- === Rake Tasks
88
+ # app/views/layouts/application.html.erb
89
+ <%= javascript_include_tag 'jquery', 'jquery.json-2.2.min', 'jquery.address-1.3', 'ajax', 'application' %>
70
90
 
71
- $ rake -T ajax
72
- rake ajax:install # Install required Ajax files.
73
- rake ajax:install:specs # Copy Ajax integration spec into spec/integration/ajax_spec.rb.
74
- rake ajax:update:javascript # Overwrite public/javascripts/ajax.js with the latest version.
91
+ While you are in this file, add a container element that will be the default container to receive content loaded via the Ajax framework. Usually this is the main body of the page below the header. For example:
75
92
 
76
- $ rake ajax:install
77
- created: app/controllers/ajax_controller.rb
78
- created: app/views/ajax/framework.html.erb
79
- created: config/initializers/ajax.rb
80
- created: public/javascripts/ajax.js
81
- created: public/javascripts/jquery.address-1.3.js
82
- created: public/javascripts/jquery.address-1.3.min.js
83
- created: public/javascripts/jquery.json-2.2.min.js
84
- created: public/images/ajax-loading.gif
93
+ # app/views/layouts/application.html.erb
94
+ <div id="main">
95
+ <%= yield %>
96
+ </div>
85
97
 
86
- $ rake ajax:install:specs
87
- already exists: spec/integration/ajax_spec.rb
88
98
 
89
- $ rake ajax:update:javascript
90
- created: public/javascripts/ajax.js
99
+ NOTE: jQuery is NOT provided for you by the install. You will need to download it to your <tt>public/javascripts</tt> directory yourself.
91
100
 
92
- == Getting Started
101
+ 6. Instantiate an instance of the Ajax JavaScript class in your <tt>application.js</tt>. This object will handle clicks on links, communication with the server and provide methods that you can use for custom behaviour.
93
102
 
94
- 1. Include the JavaScript assets in your <tt>app/views/layouts/application.html.erb</tt> file. For example:
103
+ An example of creating the Ajax instance:
95
104
 
96
- <%= javascript_include_tag 'jquery', 'jquery.address-1.3', 'ajax', 'application' %>
105
+ // public/javascripts/application.js
106
+ if (typeof(Ajax) != 'undefined') {
107
+ window.ajax = new Ajax({
108
+ default_container: '#main', // jQuery selector of your container element
109
+ enabled: true, // Enable/disable the plugin
110
+ lazy_load_assets: false // YMMV
111
+ });
112
+ }
97
113
 
98
- 1. Ajax looks for a layout to use for an Ajax request in <tt>app/views/layouts/ajax/</tt>. It looks for a layout with the same name as the default Rails layout for that action. So copy your existing layouts into <tt>layouts/ajax/</tt> and get them ready for Ajax by removing any excess HTML, leaving just the content that will be inserted into the container.
114
+ Make sure you set your <b>default_container</b> correctly. The selector you use must match the container element you added in <tt>app/views/layouts/application.html.erb</tt> in the previous step.
99
115
 
100
- Your main layout should contain a container element to receive page content. Typically this would be a container below your page header. If you don't have a static header, you can make the whole BODY element the container.
116
+ 7. Ajax should now be installed and configured and ready to handle requests. Start your Rails server, open your favorite browser and load the home page. Using the browser's developer tools take a look at the console. You should not see any JavaScript errors.
101
117
 
102
- Here is an {example of converting our <tt>layouts/application.html.haml</tt> to <tt>layouts/ajax/application.html.haml</tt>}[http://gist.github.com/373133/5a80a63ef69a883ed3c5630b68330b1036ad01ec].
118
+ If everything is working correctly when you load the root url <tt>/</tt> the URL should change to <tt>/#</tt> and you should see some output in the console like:
103
119
 
104
- 2. Instantiate an instance of the Ajax class in <tt>public/javascripts/application.js</tt>. For example:
120
+ [ajax] loadPage /
121
+ GET http://localhost:3000/?_=1304973841796
122
+ [ajax] in response handler! status: 200
123
+ [ajax] extracted body [6..1828] chars
124
+ [ajax] using container #main
125
+ [ajax] got ajax-info Object {}
105
126
 
106
- // public/javascripts/application.js
107
- if (typeof(Ajax) != 'undefined') {
108
- window.ajax = new Ajax({
109
- default_container: '#main', // jQuery selector of your container element
110
- enabled: true, // Enable/disable the plugin
111
- lazy_load_assets: false // YMMV
112
- });
113
- }
127
+ In the server logs your should see two requests. One is a normal GET request for <tt>/</tt> which should be processed by <tt>AjaxController#framework</tt> and another which is an AJAX GET request also for <tt>/</tt> which is handled by whatever you have set your application's root path handler to.
114
128
 
115
- 3. Add a <tt>data-deep-link</tt> attribute to links that you want to load using the Ajax framework. A jQuery live event automatically intercepts all clicks on links with this attribute and loads their content using the framework.
129
+ Congratulations on getting everything setup and working! Now you can start customizing your setup further and adding new functionality.
116
130
 
117
- By default all links that use the Rails link helpers will include this attribute, so you won't need to do anything. When a link with this attribute is clicked, content is requested using AJAX and goes through the Ajax framework. Rails receives a request for content at the <tt>data-deep-link</tt> location. The content is rendered using the default layout for the action but from the <tt>app/views/layouts/ajax</tt> directory. The rendered content is received client-side and special Ajax headers are processed. The content is then inserted into the specified container, or the <tt>default_container</tt> defined in your Ajax JS class above.
131
+ 8. At this point it is a good idea to include the Ajax integration specs in your application to ensure that Ajax is properly integrated going forward. If you are running RSpec 1 or 2 this is as simple as running:
118
132
 
119
- 4. To submit forms using the Ajax framework, or to manually request content using various request methods, you can call <tt>window.ajax.loadPage</tt>, passing in options like _url_, _method_ and _data_.
133
+ rake ajax:install:specs
134
+
135
+ This adds <tt>spec/integration/ajax_spec.rb</tt> to your specs. Run your specs and verify that they are all passing.
136
+
137
+ == Next Steps
138
+
139
+ 1. Ajax looks for a layout to use for an Ajax-handled request in <tt>app/views/layouts/ajax/</tt>. It looks for a layout with the same name as the Rails layout that is configured for that action. So copy your existing layouts into <tt>layouts/ajax/</tt> and get them ready by removing all the excess HTML, like the HEAD section and the BODY element. You want to leave just the HTML content that will be inserted into your container element.
140
+
141
+ Here is an {example of converting our <tt>layouts/application.html.haml</tt> to <tt>layouts/ajax/application.html.haml</tt>}[http://gist.github.com/373133/5a80a63ef69a883ed3c5630b68330b1036ad01ec].
142
+
143
+ 2. Add a <tt>data-deep-link</tt> attribute to links that you want to load using the Ajax framework. A jQuery live event automatically intercepts all clicks on links with this attribute and loads their content using the framework.
144
+
145
+ By default all links that use the Rails link helpers will include this attribute, so you won't need to do anything.
146
+
147
+ When a link with this attribute is clicked, content is requested using AJAX and goes through the Ajax framework. Rails receives a request for content at the <tt>data-deep-link</tt> location. The content is rendered using the default layout for the action but from the <tt>app/views/layouts/ajax</tt> directory. The rendered content is received client-side and special Ajax headers are processed. The content is then inserted into the specified container, or the <tt>default_container</tt> defined in your Ajax JS class above.
148
+
149
+ 4. To submit forms using the Ajax framework, or to manually request content using various request methods, you can call <tt>window.ajax.loadPage</tt>, passing in options like +url, +method+ and +data+.
120
150
 
121
151
  For example to handle form submissions with Ajax, you could use code like the following:
122
152
 
@@ -136,6 +166,23 @@ As of May 2010 Ajax is being used live in production on kazaa.com[http://www.kaz
136
166
  # app/views/layouts/ajax/two_column.html.haml
137
167
  ajax_header :container, '#twocolumns'
138
168
 
169
+ Ajax provides helper methods for you to use. In your controllers you can call <tt>ajax_header</tt> and <tt>ajax_layout</tt> to add configuration for the whole controller or on a per-action basis:
170
+
171
+ For example:
172
+ # app/controllers/application_controller.rb
173
+ ApplciationController < ActionController::Base
174
+ ajax_header :tab, "#app-tab"
175
+
176
+ def maintenance
177
+ ajax_layout :maintenance
178
+ render
179
+ end
180
+ end
181
+
182
+ In your views you only have access to <tt>ajax_header</tt>.
183
+
184
+ Lots of other useful methods are provided by the <tt>Ajax<tt> module. Take a look at the documentation for more information.
185
+
139
186
  6. Specify tabs that should be activated on a per-action, per-controller or dynamic basis using the <tt>ajax_header :tab, '<jquery css selector>'</tt> helper method. The element(s) that match the selector will have their _activate_ event triggered, so you will need to setup an event handler.
140
187
 
141
188
  For example:
@@ -248,6 +295,39 @@ The following JavaScript libraries are required and included in the plugin:
248
295
 
249
296
  Please browse the {API documentation at rDoc.info}[http://rdoc.info/projects/kjvarga/ajax]
250
297
 
298
+ === Rake Tasks
299
+
300
+ Here are the rake tasks provided and sample output from running them.
301
+
302
+ To see the tasks provided:
303
+
304
+ $ rake -T ajax
305
+ rake ajax:install # Install required Ajax files.
306
+ rake ajax:install:specs # Copy Ajax integration spec into spec/integration/ajax_spec.rb.
307
+ rake ajax:update:javascript # Overwrite public/javascripts/ajax.js with the latest version.
308
+
309
+ The install task:
310
+
311
+ $ rake ajax:install
312
+ created: app/controllers/ajax_controller.rb
313
+ created: app/views/ajax/framework.html.erb
314
+ created: config/initializers/ajax.rb
315
+ created: public/javascripts/ajax.js
316
+ created: public/javascripts/jquery.address-1.3.js
317
+ created: public/javascripts/jquery.address-1.3.min.js
318
+ created: public/javascripts/jquery.json-2.2.min.js
319
+ created: public/images/ajax-loading.gif
320
+
321
+ Copy an integration RSpec into your <tt>spec/</tt> directory:
322
+
323
+ $ rake ajax:install:specs
324
+ already exists: spec/integration/ajax_spec.rb
325
+
326
+ Update the <tt>ajax.js</tt> javascript file:
327
+
328
+ $ rake ajax:update:javascript
329
+ created: public/javascripts/ajax.js
330
+
251
331
  == Configuration
252
332
 
253
333
  It is important to be able to disable the plugin when you don't want it interfering, like when you are testing. You will also want to ensure that your site's JavaScript still works when the plugin is disabled.
@@ -485,7 +565,7 @@ not have been integrated. In this case you can force re-integration by calling:
485
565
 
486
566
  Ajax::RSpec.setup
487
567
 
488
- * See <tt>Ajax::RSpec::Helpers</tt> and <tt>Ajax::RSpec::Extension</tt> {in the rdocs}[http://rdoc.info/projects/kjvarga/ajax]
568
+ See <tt>Ajax::RSpec::Helpers</tt> and <tt>Ajax::RSpec::Extension</tt> {in the rdocs}[http://rdoc.info/projects/kjvarga/ajax]
489
569
 
490
570
  == Contributions
491
571
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.5
1
+ 1.1.6
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -67,7 +67,7 @@ module Ajax
67
67
  #
68
68
  # This method only applies to Rails < 3
69
69
  def redirect_to_full_url_with_ajax(url, status)
70
- if !_ajax_redirect(url, status)
70
+ if !_ajax_redirect(url)
71
71
  redirect_to_full_url_without_ajax(url, status)
72
72
  end
73
73
  end
@@ -114,8 +114,9 @@ module Ajax
114
114
  module Rails3
115
115
  # Rails 3 hook. Rails < 3 is handled using redirect_to_full_url. See
116
116
  # those docs for info.
117
- def redirect_to(url={}, status={})
118
- if !_ajax_redirect(url, status)
117
+ def redirect_to(options = {}, response_status = {})
118
+ url = _compute_redirect_to_location(options)
119
+ if !_ajax_redirect(url)
119
120
  super
120
121
  end
121
122
  end
@@ -155,7 +156,7 @@ module Ajax
155
156
  # Perform special processing on the response if we need to.
156
157
  # Return true if an Ajax "redirect" was performed, and false
157
158
  # otherwise.
158
- def _ajax_redirect(url, status)
159
+ def _ajax_redirect(url)
159
160
  return false if url.nil? || !Ajax.is_enabled?
160
161
  special_redirect = false
161
162
  original_url = url
@@ -2,14 +2,16 @@ module Ajax
2
2
  module Helpers
3
3
  module TaskHelper
4
4
  INSTALL_FILES = %w[
5
+ app/views/layouts/ajax/application.html.erb
5
6
  app/controllers/ajax_controller.rb
6
7
  app/views/ajax/framework.html.erb
7
8
  config/initializers/ajax.rb
9
+ public/images/ajax-loading.gif
8
10
  public/javascripts/ajax.js
9
11
  public/javascripts/jquery.address-1.3.js
10
12
  public/javascripts/jquery.address-1.3.min.js
11
13
  public/javascripts/jquery.json-2.2.min.js
12
- public/images/ajax-loading.gif]
14
+ ]
13
15
 
14
16
  UPDATE_JAVASCRIPT_FILES = %w[
15
17
  public/javascripts/ajax.js]
@@ -1,23 +1,23 @@
1
1
  module Ajax
2
2
  module RSpec
3
3
  module Extension
4
+ # Enable and unmock
4
5
  def integrate_ajax
5
6
  Ajax.enabled = true
7
+ Ajax.mocked = false
6
8
  end
7
9
 
10
+ # Disable
8
11
  def disable_ajax
9
12
  Ajax.enabled = false
10
13
  end
14
+ alias_method :unmock_ajax, :disable_ajax
11
15
 
16
+ # Enable and mock
12
17
  def mock_ajax
13
- integrate_ajax
18
+ Ajax.enabled = true
14
19
  Ajax.mocked = true
15
20
  end
16
-
17
- def unmock_ajax
18
- disable_ajax
19
- Ajax.mocked = false
20
- end
21
21
  end
22
22
  end
23
- end
23
+ end
@@ -338,7 +338,7 @@ var Ajax = function(options) {
338
338
  self.addressChanged = function() {
339
339
  if (document.location.pathname != '/') { return false; }
340
340
  if (self.disable_next_address_intercept) {
341
- console.log('skipping address intercept & resetting disable_next_address_intercept');
341
+ console.log('[ajax] skipping address intercept & resetting disable_next_address_intercept');
342
342
  self.disable_next_address_intercept = false;
343
343
  return false;
344
344
  }
@@ -357,14 +357,14 @@ var Ajax = function(options) {
357
357
  // Clean up the URL before making the request. If the URL changes
358
358
  // as a result of this, update it, which will trigger this
359
359
  // callback again.
360
- console.log('cleaning up the url');
360
+ //console.log('cleaning up the url');
361
361
  var url = ($.address.value()).replace(/\/\//, '/');
362
362
  if (url != $.address.value()) {
363
- console.log('reloading because encoded uri ' + url + ' differs from current uri ' + $.address.value());
363
+ console.log('[ajax] reloading because encoded uri ' + url + ' differs from current uri ' + $.address.value());
364
364
  $.address.value(url);
365
365
  return false;
366
366
  } else {
367
- console.log('going ahead with load');
367
+ //console.log('going ahead with load');
368
368
  self.loadPage({
369
369
  url: url
370
370
  });
@@ -501,13 +501,13 @@ var Ajax = function(options) {
501
501
  }
502
502
  if (document.location.pathname != '/') {
503
503
  var url = ('/#/' + ajax_url).replace(/\/\//, '/');
504
- console.log('linkClicked 1: going to ' + url);
504
+ //console.log('linkClicked 1: going to ' + url);
505
505
  document.location.href = url;
506
506
  } else {
507
507
  self.last_click_coords = { pageX: event.pageX, pageY: event.pageY };
508
508
  encoded_url = ajax.safeURL(ajax_url);
509
- console.log('linkClicked 2: going to ' + ajax_url);
510
- console.log('untouched url is ' + ajax_url + ', encoded is ' + encoded_url);
509
+ //console.log('linkClicked 2: going to ' + ajax_url);
510
+ //console.log('untouched url is ' + ajax_url + ', encoded is ' + encoded_url);
511
511
  if ($.browser.msie) {
512
512
  $.address.value(encoded_url);
513
513
  }
@@ -537,15 +537,15 @@ var Ajax = function(options) {
537
537
  self.responseHandler = function(responseText, textStatus, XMLHttpRequest) {
538
538
 
539
539
  self.last_request_object = XMLHttpRequest;
540
- console.log("[AJAX] in response handler! status: " + self.last_request_object.status);
540
+ console.log("[ajax] in response handler! status: " + self.last_request_object.status);
541
541
  if(self.last_request_object.status == 0) {
542
- console.log("[AJAX] aborting response handler! ");
542
+ console.log("[ajax] aborting response handler! ");
543
543
  return;
544
544
  }
545
545
  var data = self.processResponseHeaders(XMLHttpRequest);
546
546
 
547
547
  if (data.soft_redirect !== undefined) {
548
- console.log('**** data.soft_redirect is ' + data.soft_redirect);
548
+ console.log('[ajax] issuing soft redirect to ' + data.soft_redirect);
549
549
  $.address.value(data.soft_redirect);
550
550
  return;
551
551
  };
@@ -561,7 +561,7 @@ var Ajax = function(options) {
561
561
  start += responseText.match(/<\s*body[^>]*>/)[0].length;
562
562
  var end = responseText.search(/<\s*\/\s*body\s*\>/);
563
563
 
564
- console.log('Extracting body ['+start+'..'+end+'] chars');
564
+ console.log('[ajax] extracted body ['+start+'..'+end+'] chars');
565
565
  responseText = responseText.substr(start, end - start);
566
566
 
567
567
  var body = $(responseText);
@@ -576,14 +576,14 @@ var Ajax = function(options) {
576
576
  // assets - load assets
577
577
  // callbacks - execute one or an array of callbacks
578
578
  if (data.title !== undefined) {
579
- console.log('Using page title '+data.title);
579
+ console.log('[ajax] set page title '+data.title);
580
580
  // commenting this out until we fix ' char bug, removing % chars from page titles for now
581
581
  // $.address.title(encodeURIComponent(data.title));
582
582
  $.address.title(data.title);
583
583
  }
584
584
 
585
585
  if (data.tab !== undefined) {
586
- console.log('Activating tab '+data.tab);
586
+ console.log('[ajax] activated tab '+data.tab);
587
587
  $(data.tab).trigger('activate');
588
588
  }
589
589
 
@@ -605,8 +605,8 @@ var Ajax = function(options) {
605
605
  /**
606
606
  * Insert response
607
607
  */
608
- console.log('Using container ',container.selector);
609
- console.log('Set data ',data);
608
+ console.log('[ajax] using container ', container.selector);
609
+ console.log('[ajax] got ajax-info ', data);
610
610
  container.data('ajax-info', data);
611
611
  container.html(responseText);
612
612
 
@@ -649,7 +649,7 @@ var Ajax = function(options) {
649
649
  try {
650
650
  var cookie = XMLHttpRequest.getResponseHeader('Set-Cookie');
651
651
  if (cookie !== null) {
652
- console.log('Setting cookie');
652
+ console.log('[ajax] attempting to set cookie');
653
653
  document.cookie = cookie;
654
654
  }
655
655
  } catch(e) {
@@ -666,7 +666,7 @@ var Ajax = function(options) {
666
666
  if (data !== null) {
667
667
  try { data = jQuery.parseJSON(data); }
668
668
  catch(e) {
669
- console.log('Failed to parse Ajax-Info header as JSON!', data);
669
+ console.log('[ajax] failed to parse Ajax-Info header as JSON!', data);
670
670
  }
671
671
  }
672
672
  if (data === null || data === undefined) {
@@ -683,7 +683,7 @@ var Ajax = function(options) {
683
683
  self.hideLoadingImage = function() {
684
684
  // check if a new request has already started
685
685
  if (self.current_request && self.current_request.status == 0) {
686
- console.log("[AJAX] aborting hideLoadingImage.. ");
686
+ console.log("[ajax] aborting hideLoadingImage.. ");
687
687
  return;
688
688
  }
689
689
  if (!self.show_loading_image) { return; }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ajax
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 5
10
- version: 1.1.5
9
+ - 6
10
+ version: 1.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karl Varga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-08 00:00:00 -07:00
18
+ date: 2011-05-11 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -77,6 +77,7 @@ files:
77
77
  - VERSION
78
78
  - app/controllers/ajax_controller.rb
79
79
  - app/views/ajax/framework.html.erb
80
+ - app/views/layouts/ajax/application.html.erb
80
81
  - config/initializers/ajax.rb
81
82
  - init.rb
82
83
  - lib/ajax.rb
@@ -93,7 +94,6 @@ files:
93
94
  - lib/ajax/rspec.rb
94
95
  - lib/ajax/rspec/extension.rb
95
96
  - lib/ajax/rspec/helpers.rb
96
- - lib/ajax/rspec/integration.rb
97
97
  - lib/ajax/tasks.rb
98
98
  - lib/rack-ajax.rb
99
99
  - lib/rack-ajax/decision_tree.rb
File without changes