stormfront-rails 0.10.4 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49183b44cda1e773bc1a333c02d32821256b5575
4
- data.tar.gz: ff9b74f5e784034429267c63e9b83fbd22ffbff7
3
+ metadata.gz: 85c523edfe79559af5efd09fb6f403506cbc31be
4
+ data.tar.gz: 082fbc7dc4f864a0cfc796e1cd57b55be197f0e8
5
5
  SHA512:
6
- metadata.gz: 3678282aef3a4cb779012a683189e272ab852f9c91d7ae495fd7be6931f965767f2b7e0035681a907aecf011fd6efb6ba4126f239dddc6732eda46370390d80a
7
- data.tar.gz: e0d8cc1d01b99386c860fd499ea9345af59b9b5fd66118729ea083c5a4c0616dd713731a620d90001ee7fa7673cd1e03ff94590d6bceadff866dc24b6a537aee
6
+ metadata.gz: d7644157bc88b652c9c1eabbf43c8d896cc62703df9bab20df258c708e3956d00368c3ab7374bcecee7fa14212cc2a53651069097e70d3e22eea705faa21aa0c
7
+ data.tar.gz: 708fc598deb38b37013e88842d56416f65ab5dba5d6995bf85ccf21666606927e0bccdf8178e3d3642a0310d505028039cf2874e2450f3ee2e57c31448822a7a
@@ -1,5 +1,5 @@
1
1
  module Stormfront
2
2
  module Rails
3
- VERSION = '0.10.4'
3
+ VERSION = '0.10.5'
4
4
  end
5
5
  end
@@ -368,25 +368,25 @@ Stormfront.Ajax = {
368
368
  };
369
369
 
370
370
  Stormfront.Ajax.RequestReducer = Stormfront.Reducer.extend({
371
- getKey: function(event){
371
+ getKey: function (event) {
372
372
  return Stormfront.Ajax.Support.generateKey(event);
373
373
  },
374
- getEntries: function(store){
374
+ getEntries: function (store) {
375
375
  return store.ajax || (store.ajax = { });
376
376
  },
377
- getEntry: function(store, event){
377
+ getEntry: function (store, event) {
378
378
  var key = this.getKey(event);
379
379
  var entries = this.getEntries(store);
380
380
  return entries[key] || (entries[key] = { });
381
381
  },
382
- updateEntry: function(store, event, state){
382
+ updateEntry: function (store, event, state) {
383
383
  var ajax = this.getEntry(store, event);
384
384
  ajax.state = state;
385
385
  ajax.request = event.xhr;
386
386
  ajax.exception = event.exception;
387
387
  return store;
388
388
  },
389
- dropEntry: function(store, event){
389
+ dropEntry: function (store, event) {
390
390
  var key = this.getKey(event);
391
391
  var entries = this.getEntries(store);
392
392
  delete entries[key];
@@ -395,56 +395,62 @@ Stormfront.Ajax.RequestReducer = Stormfront.Reducer.extend({
395
395
 
396
396
  Stormfront.Ajax.Request = Stormfront.Ajax.RequestReducer.extend({
397
397
  type: 'NOT:IMPLEMENTED',
398
- execute: function(store, event){
399
- event.callbacks = { };
400
- event.callbacks.context = this;
401
- event.callbacks[Stormfront.Ajax.START] = this.onStart;
402
- event.callbacks[Stormfront.Ajax.SUCCESS] = this.onSuccess;
403
- event.callbacks[Stormfront.Ajax.ERROR] = this.onError;
398
+ canExecute: function (store, event) {
399
+ return true;
400
+ },
401
+ execute: function (store, event) {
402
+ if (this.canExecute(store, event)) {
403
+ event.callbacks = { };
404
+ event.callbacks.context = this;
405
+ event.callbacks[Stormfront.Ajax.START] = this.onStart;
406
+ event.callbacks[Stormfront.Ajax.SUCCESS] = this.onSuccess;
407
+ event.callbacks[Stormfront.Ajax.ERROR] = this.onError;
404
408
 
405
- var self = this;
406
- function onStart(xhr, settings){
407
- _.extend(event, { xhr: xhr });
408
- self.dispatch(new Stormfront.Ajax.StartRequest(event));
409
- }
410
- function onSuccess(data, status, xhr){
411
- _.extend(event, {
412
- data: data,
413
- status: status,
414
- xhr: xhr
415
- });
416
- self.dispatch(new Stormfront.Ajax.SuccessRequest(event));
417
- }
418
- function onError(xhr, status, exception){
419
- _.extend(event, {
420
- status: status,
421
- xhr: xhr,
422
- exception: exception
409
+ var self = this;
410
+ function onStart (xhr, settings) {
411
+ _.extend(event, { xhr: xhr });
412
+ self.dispatch(new Stormfront.Ajax.StartRequest(event));
413
+ }
414
+ function onSuccess (data, status, xhr) {
415
+ _.extend(event, {
416
+ data: data,
417
+ status: status,
418
+ xhr: xhr
419
+ });
420
+ self.dispatch(new Stormfront.Ajax.SuccessRequest(event));
421
+ }
422
+ function onError (xhr, status, exception) {
423
+ _.extend(event, {
424
+ status: status,
425
+ xhr: xhr,
426
+ exception: exception
427
+ });
428
+ self.dispatch(new Stormfront.Ajax.ErrorRequest(event));
429
+ }
430
+ var request = this.getParameters(store, event);
431
+ var settings = _.extend(request, {
432
+ beforeSend: onStart,
433
+ error: onError,
434
+ success: onSuccess
423
435
  });
424
- self.dispatch(new Stormfront.Ajax.ErrorRequest(event));
436
+ this.updateEntry(store, event, Stormfront.Ajax.PENDING);
437
+ this.send(settings);
438
+ return store;
425
439
  }
426
- var request = this.getParameters(store, event);
427
- var settings = _.extend(request, {
428
- beforeSend: onStart,
429
- error: onError,
430
- success: onSuccess
431
- });
432
- this.updateEntry(store, event, Stormfront.Ajax.PENDING);
433
- this.send(settings);
434
- return store;
440
+ return Stormfront.NO_CHANGE;
435
441
  },
436
- send: function(settings){
442
+ send: function (settings) {
437
443
  // TODO: Remaining Concerns AJAX:
438
444
  // TODO: Aborting similar request
439
445
  // TODO: Avoiding equal request
440
446
  $.ajax(settings);
441
447
  },
442
- getParameters: function(store, event){
448
+ getParameters: function (store, event) {
443
449
  return { url: '', method: 'get', data: {} }
444
450
  },
445
- onStart: function(store, event) { },
446
- onSuccess: function(store, event) { },
447
- onError: function(store, event) { }
451
+ onStart: function (store, event) { },
452
+ onSuccess: function (store, event) { },
453
+ onError: function (store, event) { }
448
454
  });
449
455
 
450
456
  Stormfront.Ajax.StartRequest = Stormfront.Ajax.Support.createGenericRequest(Stormfront.Ajax.START);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormfront-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Gee