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 +4 -4
- data/lib/stormfront/rails/version.rb +1 -1
- data/vendor/assets/javascripts/src/stormfront.js +50 -44
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85c523edfe79559af5efd09fb6f403506cbc31be
|
4
|
+
data.tar.gz: 082fbc7dc4f864a0cfc796e1cd57b55be197f0e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7644157bc88b652c9c1eabbf43c8d896cc62703df9bab20df258c708e3956d00368c3ab7374bcecee7fa14212cc2a53651069097e70d3e22eea705faa21aa0c
|
7
|
+
data.tar.gz: 708fc598deb38b37013e88842d56416f65ab5dba5d6995bf85ccf21666606927e0bccdf8178e3d3642a0310d505028039cf2874e2450f3ee2e57c31448822a7a
|
@@ -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
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
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
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
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
|
-
|
436
|
+
this.updateEntry(store, event, Stormfront.Ajax.PENDING);
|
437
|
+
this.send(settings);
|
438
|
+
return store;
|
425
439
|
}
|
426
|
-
|
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);
|