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',
|
|
|
|
|
'AddSeries/RootFolders/Collection'
|
|
|
|
|
], function (App, Marionette, RootFolderLayout, ExistingSeriesCollectionView, AddSeriesView, qualityProfileCollection, rootFolderCollection) {
|
|
|
|
|
|
|
|
|
|
return Marionette.Layout.extend({
|
2013-06-28 02:00:55 +02:00
|
|
|
|
template: 'AddSeries/AddSeriesLayoutTemplate',
|
2013-02-14 03:28:56 +01:00
|
|
|
|
|
|
|
|
|
regions: {
|
2013-05-27 04:53:56 +02:00
|
|
|
|
workspace: '#add-series-workspace'
|
2013-02-14 03:28:56 +01:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events: {
|
2013-05-27 04:53:56 +02:00
|
|
|
|
'click .x-import': '_importSeries'
|
2013-02-14 03:28:56 +01:00
|
|
|
|
},
|
|
|
|
|
|
2013-05-28 04:05:34 +02:00
|
|
|
|
initialize: function () {
|
2013-06-21 03:43:58 +02:00
|
|
|
|
this.rootFolderLayout = new RootFolderLayout();
|
2013-05-28 04:05:34 +02:00
|
|
|
|
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
|
|
|
|
|
|
2013-06-21 03:43:58 +02:00
|
|
|
|
qualityProfileCollection.fetch();
|
|
|
|
|
rootFolderCollection.fetch();
|
2013-05-28 04:05:34 +02:00
|
|
|
|
},
|
2013-02-14 03:28:56 +01:00
|
|
|
|
|
2013-06-21 03:43:58 +02:00
|
|
|
|
onShow: function () {
|
|
|
|
|
this.workspace.show(new AddSeriesView());
|
2013-05-28 04:05:34 +02:00
|
|
|
|
},
|
|
|
|
|
|
2013-06-21 03:43:58 +02:00
|
|
|
|
_folderSelected: function (options) {
|
|
|
|
|
App.modalRegion.closeModal();
|
|
|
|
|
this.workspace.show(new ExistingSeriesCollectionView({model: options.model}));
|
2013-02-14 03:28:56 +01:00
|
|
|
|
},
|
|
|
|
|
|
2013-05-27 04:53:56 +02:00
|
|
|
|
_importSeries: function () {
|
2013-06-21 03:43:58 +02:00
|
|
|
|
App.modalRegion.show(this.rootFolderLayout);
|
2013-02-15 03:40:29 +01:00
|
|
|
|
}
|
2013-02-14 03:28:56 +01:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|