1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00
Sonarr/UI/Series/Edit/EditSeriesView.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

'use strict';
define(
[
2013-07-24 04:15:58 +03:00
'app',
'marionette',
'Quality/QualityProfileCollection',
'Mixins/AsModelBoundView',
2013-08-22 03:36:35 +03:00
'Mixins/AsValidatedView',
'Mixins/AutoComplete'
2013-08-22 03:36:35 +03:00
], function (App, Marionette, QualityProfiles, AsModelBoundView, AsValidatedView) {
var view = Marionette.ItemView.extend({
template: 'Series/Edit/EditSeriesTemplate',
ui: {
qualityProfile: '.x-quality-profile',
path : '.x-path'
},
events: {
2013-07-24 04:15:58 +03:00
'click .x-save' : '_saveSeries',
'click .x-remove': '_removeSeries'
},
initialize: function () {
this.model.set('qualityProfiles', QualityProfiles);
},
2013-07-24 04:15:58 +03:00
_saveSeries: function () {
2013-07-24 04:15:58 +03:00
var self = this;
2013-07-17 02:54:45 +03:00
var qualityProfileId = this.ui.qualityProfile.val();
this.model.set({ qualityProfileId: qualityProfileId});
2013-07-24 04:15:58 +03:00
this.model.save().done(function () {
self.trigger('saved');
App.vent.trigger(App.Commands.CloseModalCommand);
});
2013-07-17 02:54:45 +03:00
},
onRender: function () {
this.ui.path.autoComplete('/directories');
},
2013-07-24 04:15:58 +03:00
_removeSeries: function () {
App.vent.trigger(App.Commands.DeleteSeriesCommand, {series:this.model});
}
});
2013-08-22 03:36:35 +03:00
AsModelBoundView.apply(view);
return AsValidatedView.apply(view);
});