mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Merge pull request #1886 from jgable/progressBarOnDelete
Fix hanging loading bar on deleting a post
This commit is contained in:
commit
5eadaa441a
1 changed files with 13 additions and 2 deletions
|
@ -11,12 +11,23 @@
|
|||
Ghost.Views.Blog = Ghost.View.extend({
|
||||
initialize: function (options) {
|
||||
/*jslint unparam:true*/
|
||||
var self = this,
|
||||
finishProgress = function () {
|
||||
NProgress.done();
|
||||
};
|
||||
|
||||
// Basic collection request/sync flow progress bar handlers
|
||||
this.listenTo(this.collection, 'request', function () {
|
||||
NProgress.start();
|
||||
});
|
||||
this.listenTo(this.collection, 'sync', function () {
|
||||
NProgress.done();
|
||||
this.listenTo(this.collection, 'sync', finishProgress);
|
||||
|
||||
// A special case because models that are destroyed are removed from the
|
||||
// collection before the sync event fires and bubbles up
|
||||
this.listenTo(this.collection, 'destroy', function (model) {
|
||||
self.listenToOnce(model, 'sync', finishProgress);
|
||||
});
|
||||
|
||||
this.addSubview(new PreviewContainer({ el: '.js-content-preview', collection: this.collection })).render();
|
||||
this.addSubview(new ContentList({ el: '.js-content-list', collection: this.collection })).render();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue