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