1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-01 08:22:35 +01:00
Sonarr/UI/Series/Edit/EditSeriesView.js

46 lines
1.5 KiB
JavaScript
Raw Normal View History

'use strict';
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function (app, seriesModel, deleteSeriesView, qualityProfiles) {
2013-03-03 23:42:26 +01:00
NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({
template : 'Series/Edit/EditSeriesTemplate',
ui: {
progressbar : '.progress .bar',
qualityProfile : '.x-quality-profile',
backlogSettings: '.x-backlog-setting'
},
events: {
'click .x-save' : 'saveSeries',
'click .x-remove': 'removeSeries'
},
initialize : function(){
this.model.set('qualityProfiles',qualityProfiles);
},
saveSeries: function () {
//Todo: Get qualityProfile + backlog setting from UI
var qualityProfile = this.ui.qualityProfile.val();
var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
var backlogSetting = this.ui.backlogSettings.val();
this.model.set({ qualityProfileId: qualityProfile, backlogSetting: backlogSetting, qualityProfileName: qualityProfileText });
this.model.save();
this.trigger('saved');
2013-05-29 08:24:45 +02:00
NzbDrone.modalRegion.closeModal();
},
removeSeries: function () {
2013-03-03 23:42:26 +01:00
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
NzbDrone.modalRegion.show(view);
}
});
});