Root folders use listenTo now

pull/6/head
Mark McDowall 11 years ago
parent 224100b46e
commit 78a5dbe097

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

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

Loading…
Cancel
Save