sonarr-repo-only/UI/AddSeries/AddSeriesLayout.js

47 lines
1.4 KiB
JavaScript
Raw Normal View History

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