1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-21 11:02:01 +02:00
Sonarr/UI/AddSeries/AddSeriesLayout.js

60 lines
1.8 KiB
JavaScript
Raw Normal View History

2013-06-21 23:24:24 -07:00
'use strict';
2013-06-20 18:43:58 -07:00
define(
[
'app',
'marionette',
'AddSeries/RootFolders/Layout',
'AddSeries/Existing/CollectionView',
'AddSeries/AddSeriesView',
'Quality/QualityProfileCollection',
2013-06-30 12:57:26 -07:00
'AddSeries/RootFolders/Collection',
'Series/SeriesCollection',
], function (App, Marionette, RootFolderLayout, ExistingSeriesCollectionView, AddSeriesView, qualityProfileCollection, rootFolderCollection, SeriesCollection) {
2013-06-20 18:43:58 -07:00
return Marionette.Layout.extend({
2013-06-27 17:00:55 -07:00
template: 'AddSeries/AddSeriesLayoutTemplate',
regions: {
2013-05-26 19:53:56 -07:00
workspace: '#add-series-workspace'
},
events: {
'click .x-import': '_importSeries',
'click .x-add-new': '_addSeries'
},
2013-06-30 12:57:26 -07:00
attributes: {
id: 'add-series-screen'
},
initialize: function () {
2013-06-30 12:57:26 -07:00
SeriesCollection.fetch();
2013-06-20 18:43:58 -07:00
this.rootFolderLayout = new RootFolderLayout();
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
2013-06-20 18:43:58 -07:00
qualityProfileCollection.fetch();
rootFolderCollection.fetch();
},
2013-06-20 18:43:58 -07:00
onShow: function () {
this.workspace.show(new AddSeriesView());
},
2013-06-20 18:43:58 -07:00
_folderSelected: function (options) {
App.modalRegion.closeModal();
this.workspace.show(new ExistingSeriesCollectionView({model: options.model}));
},
2013-05-26 19:53:56 -07:00
_importSeries: function () {
2013-06-20 18:43:58 -07:00
App.modalRegion.show(this.rootFolderLayout);
},
_addSeries: function () {
this.workspace.show(new AddSeriesView());
}
});
});