2013-02-14 18:01:30 +00:00
|
|
|
|
'use strict';
|
|
|
|
|
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function () {
|
|
|
|
|
|
2013-03-03 22:42:26 +00:00
|
|
|
|
NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({
|
2013-03-29 23:28:58 +00:00
|
|
|
|
template : 'Series/Edit/EditSeriesTemplate',
|
|
|
|
|
tagName : 'div',
|
2013-02-14 18:01:30 +00:00
|
|
|
|
className: "modal",
|
|
|
|
|
|
|
|
|
|
ui: {
|
2013-03-29 23:28:58 +00:00
|
|
|
|
progressbar : '.progress .bar',
|
|
|
|
|
qualityProfile : '.x-quality-profile',
|
2013-03-08 04:31:25 +00:00
|
|
|
|
backlogSettings: '.x-backlog-setting',
|
2013-03-29 23:28:58 +00:00
|
|
|
|
switch : '.switch'
|
2013-02-14 18:01:30 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events: {
|
2013-03-29 23:28:58 +00:00
|
|
|
|
'click .x-save' : 'saveSeries',
|
2013-02-14 18:01:30 +00:00
|
|
|
|
'click .x-remove': 'removeSeries'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRender: function () {
|
2013-03-08 04:31:25 +00:00
|
|
|
|
this.ui.switch.bootstrapSwitch();
|
2013-02-14 18:01:30 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
this.$el.parent().modal('hide');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
removeSeries: function () {
|
2013-03-03 22:42:26 +00:00
|
|
|
|
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
2013-02-14 18:01:30 +00:00
|
|
|
|
NzbDrone.modalRegion.show(view);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|