sonarr-repo-only/UI/Series/Edit/EditSeriesView.js

49 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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',
qualityProfile : '.x-quality-profile'
},
events: {
'click .x-save' : 'saveSeries',
'click .x-remove': 'removeSeries'
},
initialize: function () {
this.model.set('qualityProfiles', QualityProfiles);
},
saveSeries: function () {
//Todo: Get qualityProfile
var qualityProfile = this.ui.qualityProfile.val();
var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
this.model.set({ qualityProfileId: qualityProfile, qualityProfileName: qualityProfileText });
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);
});