mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
6394add9d6
issue #1533 - replaces templateModel which was a weird hybrid with progressModel and progressCollection
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
/*global window, document, setTimeout, Ghost, $, _, Backbone, JST, shortcut, NProgress */
|
|
|
|
(function () {
|
|
"use strict";
|
|
NProgress.configure({ showSpinner: false });
|
|
|
|
Ghost.ProgressModel = Backbone.Model.extend({
|
|
|
|
// Adds in a call to start a loading bar
|
|
// This is sets up a success function which completes the loading bar
|
|
fetch : function (options) {
|
|
options = options || {};
|
|
|
|
NProgress.start();
|
|
|
|
options.success = function () {
|
|
NProgress.done();
|
|
};
|
|
|
|
return Backbone.Model.prototype.fetch.call(this, options);
|
|
}
|
|
});
|
|
|
|
Ghost.ProgressCollection = Backbone.Collection.extend({
|
|
|
|
// Adds in a call to start a loading bar
|
|
// This is sets up a success function which completes the loading bar
|
|
fetch : function (options) {
|
|
options = options || {};
|
|
|
|
NProgress.start();
|
|
|
|
options.success = function () {
|
|
NProgress.done();
|
|
};
|
|
|
|
return Backbone.Collection.prototype.fetch.call(this, options);
|
|
}
|
|
});
|
|
}()); |