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