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