1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Series/Edit/EditSeriesView.js

55 lines
1.4 KiB
JavaScript
Raw Normal View History

'use strict';
define(
[
'App',
'marionette',
'Series/Delete/DeleteSeriesView',
'Quality/QualityProfileCollection',
'Mixins/AsModelBoundView',
'Mixins/AutoComplete'
], function (App, Marionette, DeleteSeriesView, QualityProfiles, AsModelBoundView) {
var view = Marionette.ItemView.extend({
template: 'Series/Edit/EditSeriesTemplate',
ui: {
qualityProfile: '.x-quality-profile',
path : '.x-path'
},
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});
this.model.save();
this.trigger('saved');
App.modalRegion.closeModal();
2013-07-17 02:54:45 +03:00
},
onRender: function () {
this.ui.path.autoComplete('/directories');
},
removeSeries: function () {
var view = new DeleteSeriesView({ model: this.model });
App.modalRegion.show(view);
}
});
return AsModelBoundView.apply(view);
});