mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Fixed sorting of cutoff when allowed list changes
This commit is contained in:
parent
37ff745521
commit
3bfdd1d9eb
20
src/UI/Handlebars/Helpers/EachReverse.js
Normal file
20
src/UI/Handlebars/Helpers/EachReverse.js
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
Handlebars.registerHelper('eachReverse', function (context) {
|
||||
var options = arguments[arguments.length - 1];
|
||||
var ret = '';
|
||||
|
||||
if (context && context.length > 0) {
|
||||
for (var i = context.length - 1; i >= 0; i--) {
|
||||
ret += options.fn(context[i]);
|
||||
}
|
||||
} else {
|
||||
ret = options.inverse(this);
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
});
|
@ -10,6 +10,7 @@ define(
|
||||
'Handlebars/Helpers/Series',
|
||||
'Handlebars/Helpers/Quality',
|
||||
'Handlebars/Helpers/System',
|
||||
'Handlebars/Helpers/EachReverse',
|
||||
'Handlebars/Handlebars.Debug'
|
||||
], function (Templates) {
|
||||
return function () {
|
||||
|
@ -31,7 +31,10 @@ define(
|
||||
this.availableCollection.comparator = function (model) { return -model.get('weight'); };
|
||||
this.availableCollection.sort();
|
||||
|
||||
this.allowedCollection = new Backbone.Collection(this.model.get('allowed').reverse());
|
||||
this.allowedCollection = new Backbone.Collection(this.model.get('allowed'));
|
||||
this.allowedCollection.comparator = function (model) { return -model.get('weight'); };
|
||||
this.allowedCollection.sort();
|
||||
this.allowedCollection.comparator = undefined;
|
||||
},
|
||||
|
||||
onRender: function() {
|
||||
|
@ -18,9 +18,9 @@
|
||||
<label class="control-label">Cutoff</label>
|
||||
<div class="controls">
|
||||
<select class="x-cutoff" name="cutoff.id" validation-name="cutoff">
|
||||
{{#each allowed}}
|
||||
{{#eachReverse allowed}}
|
||||
<option value="{{id}}">{{name}}</option>
|
||||
{{/each}}
|
||||
{{/eachReverse}}
|
||||
</select>
|
||||
<span class="help-inline">
|
||||
<i class="icon-question-sign" title="Once this quality is reached NzbDrone will no longer download episodes"/>
|
||||
|
Loading…
Reference in New Issue
Block a user