2013-02-14 21:01:30 +03:00
|
|
|
'use strict';
|
2013-06-09 23:51:32 +03:00
|
|
|
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function (app, seriesModel, deleteSeriesView, qualityProfiles) {
|
2013-02-14 21:01:30 +03:00
|
|
|
|
2013-03-04 01:42:26 +03:00
|
|
|
NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({
|
2013-03-30 02:28:58 +03:00
|
|
|
template : 'Series/Edit/EditSeriesTemplate',
|
2013-02-14 21:01:30 +03:00
|
|
|
|
|
|
|
ui: {
|
2013-03-30 02:28:58 +03:00
|
|
|
progressbar : '.progress .bar',
|
|
|
|
qualityProfile : '.x-quality-profile',
|
2013-04-21 01:51:39 +03:00
|
|
|
backlogSettings: '.x-backlog-setting'
|
2013-02-14 21:01:30 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
events: {
|
2013-03-30 02:28:58 +03:00
|
|
|
'click .x-save' : 'saveSeries',
|
2013-02-14 21:01:30 +03:00
|
|
|
'click .x-remove': 'removeSeries'
|
|
|
|
},
|
|
|
|
|
|
|
|
|
2013-06-09 23:51:32 +03:00
|
|
|
initialize : function(){
|
|
|
|
|
|
|
|
this.model.set('qualityProfiles',qualityProfiles);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
2013-02-14 21:01:30 +03: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');
|
2013-05-29 09:24:45 +03:00
|
|
|
NzbDrone.modalRegion.closeModal();
|
2013-02-14 21:01:30 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
removeSeries: function () {
|
2013-03-04 01:42:26 +03:00
|
|
|
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
2013-02-14 21:01:30 +03:00
|
|
|
NzbDrone.modalRegion.show(view);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-06-09 23:51:32 +03:00
|
|
|
});
|