diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js index 7eaeb9ab2..3ca4241e7 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js @@ -11,6 +11,16 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ rootFolders: "#root-folders" }, + ui: { + addNewTab: ".nav-tabs a[href='#add-new']", + importTab: ".nav-tabs a[href='#import-existing']", + rootDirTab: ".nav-tabs a[href='#root-folders']", + rootTabRequiredMessage: "", + }, + + + rootFolderCollection: new NzbDrone.AddSeries.RootDirCollection(), + onRender: function () { this.$('#myTab a').click(function (e) { e.preventDefault(); @@ -19,7 +29,23 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView()); //this.importExisting.show(new NzbDrone.ImportExistingView()); - this.rootFolders.show(new NzbDrone.AddSeries.RootDirView()); + this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection })); + + NzbDrone.vent.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this); + NzbDrone.vent.listenTo(this.rootFolderCollection, 'remove', this.evaluateActions, this); + NzbDrone.vent.listenTo(this.rootFolderCollection, 'reset', this.evaluateActions, this); }, + evaluateActions: function () { + if (this.rootFolderCollection.length == 0) { + this.ui.addNewTab.hide(); + this.ui.importTab.hide(); + this.ui.rootDirTab.tab('show'); + } else { + this.ui.addNewTab.show(); + this.ui.importTab.show(); + } + }, + + }); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesLayoutTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesLayoutTemplate.html index be8066b56..9412dcb06 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesLayoutTemplate.html +++ b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesLayoutTemplate.html @@ -1,9 +1,12 @@ -