You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/src/UI/AddSeries/AddSeriesLayout.js

68 lines
2.0 KiB

9 years ago
'use strict';
11 years ago
define(
[
'vent',
'AppLayout',
11 years ago
'marionette',
'AddSeries/RootFolders/RootFolderLayout',
'AddSeries/Existing/AddExistingSeriesCollectionView',
11 years ago
'AddSeries/AddSeriesView',
'Profile/ProfileCollection',
'AddSeries/RootFolders/RootFolderCollection',
'Series/SeriesCollection'
], function (vent,
AppLayout,
Marionette,
RootFolderLayout,
ExistingSeriesCollectionView,
AddSeriesView,
ProfileCollection,
RootFolderCollection) {
11 years ago
return Marionette.Layout.extend({
template: 'AddSeries/AddSeriesLayoutTemplate',
regions: {
workspace: '#add-series-workspace'
},
events: {
'click .x-import': '_importSeries',
'click .x-add-new': '_addSeries'
},
attributes: {
id: 'add-series-screen'
},
initialize: function () {
ProfileCollection.fetch();
RootFolderCollection.fetch()
.done(function () {
RootFolderCollection.synced = true;
});
},
11 years ago
onShow: function () {
this.workspace.show(new AddSeriesView());
},
11 years ago
_folderSelected: function (options) {
vent.trigger(vent.Commands.CloseModalCommand);
11 years ago
this.workspace.show(new ExistingSeriesCollectionView({model: options.model}));
},
_importSeries: function () {
this.rootFolderLayout = new RootFolderLayout();
this.listenTo(this.rootFolderLayout, 'folderSelected', this._folderSelected);
AppLayout.modalRegion.show(this.rootFolderLayout);
},
_addSeries: function () {
this.workspace.show(new AddSeriesView());
}
});
});