1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js

56 lines
2.0 KiB
JavaScript
Raw Normal View History

2013-01-23 02:58:08 +03:00
/// <reference path="../app.js" />
/// <reference path="AddNewSeries/AddNewSeriesView.js" />
2013-01-24 23:48:44 +03:00
/// <reference path="RootDir/RootDirView.js" />
/// <reference path="../Quality/qualityProfileCollection.js" />
2013-01-26 23:05:08 +03:00
/// <reference path="../Shared/SpinnerView.js" />
2013-01-23 02:58:08 +03:00
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
template: "AddSeries/addSeriesLayoutTemplate",
regions: {
addNew: "#add-new",
importExisting: "#import-existing",
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(),
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
2013-01-23 02:58:08 +03:00
onRender: function () {
this.$('#myTab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
this.qualityProfileCollection.fetch();
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
2013-01-23 02:58:08 +03:00
//this.importExisting.show(new NzbDrone.ImportExistingView());
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();
}
2013-01-23 02:58:08 +03:00
},
2013-01-23 02:58:08 +03:00
});