1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 12:32:31 +01:00

Quality profile cutoff will be set on add

#ND-158
This commit is contained in:
Mark McDowall 2013-01-28 19:40:49 -08:00
parent d398440322
commit ffc0ff8ebf

View File

@ -18,7 +18,6 @@
var el = $(this.el); var el = $(this.el);
var checked = $(target).attr('checked') != undefined; var checked = $(target).attr('checked') != undefined;
var id = this.model.get("Id");
var qualities = _.clone(this.model.get("Qualities")); var qualities = _.clone(this.model.get("Qualities"));
_.each(qualities, function (qualityType) { _.each(qualities, function (qualityType) {
@ -28,14 +27,14 @@
qualityType.Allowed = checked; qualityType.Allowed = checked;
//Find cutoff dropdown //Find cutoff dropdown
var cutoff = $(el).find('.cutoff'); var cutoffLocal = $(el).find('.cutoff');
if (checked) { if (checked) {
$('<option>' + qualityType.Name + '</option>').val(qualityId).appendTo(cutoff); $('<option>' + qualityType.Name + '</option>').val(qualityId).appendTo(cutoffLocal);
} }
else { else {
$(cutoff).find('option[value="' + qualityId + '"]').remove(); $(cutoffLocal).find('option[value="' + qualityId + '"]').remove();
} }
//Todo: auto-sort by weight (which is not the value) //Todo: auto-sort by weight (which is not the value)
@ -45,6 +44,13 @@
} }
}); });
var cutoff = $(el).find('.cutoff');
if (cutoff[0].length === 0)
this.model.set({ "Cutoff": 0 });
if (cutoff[0].length === 1)
this.model.set({ "Cutoff": cutoff.val() });
this.model.set({ "Qualities": qualities }); this.model.set({ "Qualities": qualities });
this.model.save(); this.model.save();
}, },