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