Root folders use listenTo now

This commit is contained in:
Mark McDowall 2013-10-07 22:47:04 -07:00
parent 224100b46e
commit 78a5dbe097
2 changed files with 9 additions and 8 deletions

View File

@ -35,7 +35,7 @@ define(
initialize: function () {
QualityProfileCollection.fetch();
RootFolderCollection.promise = RootFolderCollection.fetch();
RootFolderCollection.fetch();
},
onShow: function () {

View File

@ -31,15 +31,15 @@ define(
this.rootfolderListView = new RootFolderCollectionView({ collection: RootFolderCollection });
this.listenTo(this.rootfolderListView, 'itemview:folderSelected', this._onFolderSelected);
this.listenTo(RootFolderCollection, 'sync', this._showCurrentDirs);
},
onRender: function () {
var self = this;
this.currentDirs.show(new LoadingView());
RootFolderCollection.promise.done(function () {
self.currentDirs.show(self.rootfolderListView);
});
if (RootFolderCollection.any()) {
this._showCurrentDirs();
}
this.ui.pathInput.autoComplete('/directories');
},
@ -49,7 +49,6 @@ define(
},
_addFolder: function () {
var self = this;
var newDir = new RootFolderModel({
@ -62,10 +61,12 @@ define(
RootFolderCollection.add(newDir);
self.trigger('folderSelected', {model: newDir});
});
},
_showCurrentDirs: function () {
this.currentDirs.show(this.rootfolderListView);
}
});
return AsValidatedView.apply(layout);
});