From 78a5dbe097229bb44c1d7a62e8c73282870cadb1 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 7 Oct 2013 22:47:04 -0700 Subject: [PATCH] Root folders use listenTo now --- src/UI/AddSeries/AddSeriesLayout.js | 2 +- src/UI/AddSeries/RootFolders/Layout.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/UI/AddSeries/AddSeriesLayout.js b/src/UI/AddSeries/AddSeriesLayout.js index 14f11c356..9d5eaa04c 100644 --- a/src/UI/AddSeries/AddSeriesLayout.js +++ b/src/UI/AddSeries/AddSeriesLayout.js @@ -35,7 +35,7 @@ define( initialize: function () { QualityProfileCollection.fetch(); - RootFolderCollection.promise = RootFolderCollection.fetch(); + RootFolderCollection.fetch(); }, onShow: function () { diff --git a/src/UI/AddSeries/RootFolders/Layout.js b/src/UI/AddSeries/RootFolders/Layout.js index 3a75c0f9f..795f62edc 100644 --- a/src/UI/AddSeries/RootFolders/Layout.js +++ b/src/UI/AddSeries/RootFolders/Layout.js @@ -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); - });