1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-06 02:52:41 +01:00
Radarr/UI/AddSeries/AddSeriesLayout.js

67 lines
1.9 KiB
JavaScript
Raw Normal View History

2013-06-22 08:24:24 +02:00
'use strict';
2013-06-21 03:43:58 +02:00
define(
[
'app',
'marionette',
'AddSeries/RootFolders/Layout',
'AddSeries/Existing/CollectionView',
'AddSeries/AddSeriesView',
'Quality/QualityProfileCollection',
2013-06-30 21:57:26 +02:00
'AddSeries/RootFolders/Collection',
2013-07-11 18:51:38 +02:00
'Series/SeriesCollection'
], function (App,
Marionette,
RootFolderLayout,
ExistingSeriesCollectionView,
AddSeriesView,
QualityProfileCollection,
RootFolderCollection,
SeriesCollection) {
2013-06-21 03:43:58 +02:00
return Marionette.Layout.extend({
2013-06-28 02:00:55 +02:00
template: 'AddSeries/AddSeriesLayoutTemplate',
regions: {
2013-05-27 04:53:56 +02:00
workspace: '#add-series-workspace'
},
events: {
'click .x-import': '_importSeries',
'click .x-add-new': '_addSeries'
},
2013-06-30 21:57:26 +02:00
attributes: {
id: 'add-series-screen'
},
initialize: function () {
2013-06-30 21:57:26 +02:00
SeriesCollection.fetch();
2013-07-11 18:51:38 +02:00
QualityProfileCollection.fetch();
RootFolderCollection.fetch();
2013-06-30 21:57:26 +02:00
2013-06-21 03:43:58 +02:00
this.rootFolderLayout = new RootFolderLayout();
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
},
2013-06-21 03:43:58 +02:00
onShow: function () {
this.workspace.show(new AddSeriesView());
},
2013-06-21 03:43:58 +02:00
_folderSelected: function (options) {
2013-07-24 03:15:58 +02:00
App.vent.trigger(App.Commands.CloseModalCommand);
2013-06-21 03:43:58 +02:00
this.workspace.show(new ExistingSeriesCollectionView({model: options.model}));
},
2013-05-27 04:53:56 +02:00
_importSeries: function () {
2013-06-21 03:43:58 +02:00
App.modalRegion.show(this.rootFolderLayout);
},
_addSeries: function () {
this.workspace.show(new AddSeriesView());
}
});
});