1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-18 23:48:35 +02:00
Sonarr/src/UI/AddSeries/AddSeriesLayout.js
Mark McDowall dff6726114 Enter on add root folder will add folder
Renamed Root Folder js files
2014-02-08 11:54:14 -08:00

68 lines
2.0 KiB
JavaScript

'use strict';
define(
[
'vent',
'AppLayout',
'marionette',
'AddSeries/RootFolders/RootFolderLayout',
'AddSeries/Existing/AddExistingSeriesCollectionView',
'AddSeries/AddSeriesView',
'Quality/QualityProfileCollection',
'AddSeries/RootFolders/RootFolderCollection',
'Series/SeriesCollection'
], function (vent,
AppLayout,
Marionette,
RootFolderLayout,
ExistingSeriesCollectionView,
AddSeriesView,
QualityProfileCollection,
RootFolderCollection) {
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 () {
QualityProfileCollection.fetch();
RootFolderCollection.fetch()
.done(function () {
RootFolderCollection.synced = true;
});
},
onShow: function () {
this.workspace.show(new AddSeriesView());
},
_folderSelected: function (options) {
vent.trigger(vent.Commands.CloseModalCommand);
this.workspace.show(new ExistingSeriesCollectionView({model: options.model}));
},
_importSeries: function () {
this.rootFolderLayout = new RootFolderLayout();
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
AppLayout.modalRegion.show(this.rootFolderLayout);
},
_addSeries: function () {
this.workspace.show(new AddSeriesView());
}
});
});