0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/clientold/models/base.js
Hannah Wolfe bee58922b2 Rename client -> clientold
issue #2271

- should allow development of new admin UI whilst still having access to the old ui
2014-02-27 00:52:04 +00:00

32 lines
No EOL
921 B
JavaScript

/*global window, document, setTimeout, Ghost, $, _, Backbone, JST, shortcut, NProgress */
(function () {
"use strict";
NProgress.configure({ showSpinner: false });
// Adds in a call to start a loading bar
// This is sets up a success function which completes the loading bar
function wrapSync(method, model, options) {
if (options !== undefined && _.isObject(options)) {
NProgress.start();
var self = this,
oldSuccess = options.success;
options.success = function () {
NProgress.done();
return oldSuccess.apply(self, arguments);
};
}
return Backbone.sync.call(this, method, model, options);
}
Ghost.ProgressModel = Backbone.Model.extend({
sync: wrapSync
});
Ghost.ProgressCollection = Backbone.Collection.extend({
sync: wrapSync
});
}());