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