2013-07-14 08:05:51 +02:00
|
|
|
|
'use strict';
|
2013-06-25 01:41:59 +02:00
|
|
|
|
define(
|
|
|
|
|
[
|
|
|
|
|
'App',
|
|
|
|
|
'marionette',
|
|
|
|
|
'Series/Delete/DeleteSeriesView',
|
|
|
|
|
'Quality/QualityProfileCollection',
|
2013-07-14 08:05:51 +02:00
|
|
|
|
'Mixins/AsModelBoundView',
|
|
|
|
|
'Mixins/AutoComplete'
|
2013-06-25 01:41:59 +02:00
|
|
|
|
], function (App, Marionette, DeleteSeriesView, QualityProfiles, AsModelBoundView) {
|
|
|
|
|
|
|
|
|
|
var view = Marionette.ItemView.extend({
|
|
|
|
|
template: 'Series/Edit/EditSeriesTemplate',
|
|
|
|
|
|
|
|
|
|
ui: {
|
2013-07-14 08:05:51 +02:00
|
|
|
|
qualityProfile: '.x-quality-profile',
|
|
|
|
|
path : '.x-path'
|
2013-06-25 01:41:59 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events: {
|
|
|
|
|
'click .x-save' : 'saveSeries',
|
|
|
|
|
'click .x-remove': 'removeSeries'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
|
this.model.set('qualityProfiles', QualityProfiles);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveSeries: function () {
|
2013-07-04 02:57:55 +02:00
|
|
|
|
//Todo: Get qualityProfile
|
2013-06-25 01:41:59 +02:00
|
|
|
|
var qualityProfile = this.ui.qualityProfile.val();
|
|
|
|
|
var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
|
|
|
|
|
|
2013-07-04 02:57:55 +02:00
|
|
|
|
this.model.set({ qualityProfileId: qualityProfile, qualityProfileName: qualityProfileText });
|
2013-06-25 01:41:59 +02:00
|
|
|
|
|
|
|
|
|
this.model.save();
|
|
|
|
|
this.trigger('saved');
|
|
|
|
|
App.modalRegion.closeModal();
|
|
|
|
|
},
|
|
|
|
|
|
2013-07-14 08:05:51 +02:00
|
|
|
|
|
|
|
|
|
onRender: function () {
|
|
|
|
|
this.ui.path.autoComplete('/directories');
|
|
|
|
|
},
|
|
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
|
removeSeries: function () {
|
|
|
|
|
var view = new DeleteSeriesView({ model: this.model });
|
|
|
|
|
App.modalRegion.show(view);
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-07-14 08:05:51 +02:00
|
|
|
|
|
|
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
|
return AsModelBoundView.apply(view);
|
2013-02-14 19:01:30 +01:00
|
|
|
|
});
|