add-series, import-series tabs are invisible if user doesn't have a root folder.

pull/23/head
Keivan Beigi 12 years ago committed by kay.one
parent 868d4d0b53
commit 0ca0510b3a

@ -11,6 +11,16 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
rootFolders: "#root-folders" 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 () { onRender: function () {
this.$('#myTab a').click(function (e) { this.$('#myTab a').click(function (e) {
e.preventDefault(); e.preventDefault();
@ -19,7 +29,23 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView()); this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView());
//this.importExisting.show(new NzbDrone.ImportExistingView()); //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();
}
}, },
}); });

@ -1,9 +1,12 @@
<ul class="nav nav-tabs" id="myTab"> <!--<div class="alert alert-info">
<strong>Heads up!</strong> you need to add at least one TV folder.
</div>-->
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#add-new">Add New Series</a></li> <li class="active"><a href="#add-new">Add New Series</a></li>
<li><a href="#import-existing">Import Existing Series</a></li> <li><a href="#import-existing">Import Existing Series</a></li>
<li><a href="#root-folders">Root Folders</a></li> <li><a href="#root-folders">Root Folders</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content nz-center">
<div class="tab-pane active" id="add-new">Add new series.</div> <div class="tab-pane active" id="add-new">Add new series.</div>
<div class="tab-pane" id="import-existing">Import existing.</div> <div class="tab-pane" id="import-existing">Import existing.</div>
<div class="tab-pane" id="root-folders">Manage root folders</div> <div class="tab-pane" id="root-folders">Manage root folders</div>

Loading…
Cancel
Save