Remove ES6 code in kanban

pull/1/head
yflory 7 years ago
parent 07502775f5
commit 6b98fef679

@ -116,12 +116,23 @@
// TODO: update board object board order // TODO: update board object board order
console.log("Drop " + $(el).attr("data-id") + " just before " + (sibling ? $(sibling).attr("data-id") : " end ")); console.log("Drop " + $(el).attr("data-id") + " just before " + (sibling ? $(sibling).attr("data-id") : " end "));
var index1 = self.options.boards.findIndex(function (element) { var index1, index2;
return element.id == $(el).attr("data-id"); self.options.boards.some(function (element, index) {
if (element.id === $(el).attr("data-id")) {
index1 = index;
return true;
}
}); });
var index2 = sibling ? self.options.boards.findIndex(function (element) { if (sibling) {
return element.id == $(sibling).attr("data-id"); self.options.boards.some(function (element, index) {
}) : self.options.boards.length; if (element.id === $(sibling).attr("data-id")) {
index2 = index;
return true;
}
})
} else {
index2 = self.options.boards.length;
}
console.log("Switch " + index1 + " and " + index2); console.log("Switch " + index1 + " and " + index2);
if (index1 < index2) if (index1 < index2)
index2 = index2 - 1; index2 = index2 - 1;
@ -177,11 +188,17 @@
console.log("In drop"); console.log("In drop");
// TODO: update board object board order // TODO: update board object board order
var board1 = self.options.boards.find(function (element) { var board1;
return element.id == $(source.parentNode).attr("data-id"); self.options.boards.some(function (element) {
if (element.id === $(source.parentNode).attr("data-id")) {
return board1 = element;
}
}); });
var board2 = self.options.boards.find(function (element) { var board2;
return element.id == $(target.parentNode).attr("data-id"); self.options.boards.some(function (element) {
if (element.id === $(target.parentNode).attr("data-id")) {
return board2 = element;
}
}); });
var pos1 = self.dragItemPos; var pos1 = self.dragItemPos;
var pos2 = (sibling) ? self.findElementPosition(sibling) : (board2.item.length + 1); var pos2 = (sibling) ? self.findElementPosition(sibling) : (board2.item.length + 1);

Loading…
Cancel
Save