FIX: Made reorder more convenient by clamping the entered number

This commit is contained in:
venarius 2019-03-17 16:32:02 +01:00 committed by Robin Ward
parent ad363f45f0
commit 4af0a2f00b

View File

@ -85,7 +85,8 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, {
actions: {
change(cat, e) {
let position = parseInt($(e.target).val());
this.moveDir(cat, position - this.get("categoriesOrdered").indexOf(cat));
let amount = Math.min(Math.max(position, 0), this.get("categoriesOrdered").length - 1);
this.moveDir(cat, amount - this.get("categoriesOrdered").indexOf(cat));
},
moveUp(cat) {