|
|
@ -396,10 +396,11 @@ define([
|
|
|
|
console.log("In drop");
|
|
|
|
console.log("In drop");
|
|
|
|
|
|
|
|
|
|
|
|
var id1 = Number($(el).attr('data-eid'));
|
|
|
|
var id1 = Number($(el).attr('data-eid'));
|
|
|
|
|
|
|
|
var boardId = Number($(source).closest('.kanban-board').data('id'));
|
|
|
|
|
|
|
|
|
|
|
|
// Move to trash?
|
|
|
|
// Move to trash?
|
|
|
|
if (target.classList.contains('kanban-trash')) {
|
|
|
|
if (target.classList.contains('kanban-trash')) {
|
|
|
|
self.moveItem(id1);
|
|
|
|
self.moveItem(boardId, id1);
|
|
|
|
self.onChange();
|
|
|
|
self.onChange();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -419,7 +420,7 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Move the item
|
|
|
|
// Move the item
|
|
|
|
self.moveItem(id1, board2, pos2);
|
|
|
|
self.moveItem(boardId, id1, board2, pos2);
|
|
|
|
|
|
|
|
|
|
|
|
// send event that board has changed
|
|
|
|
// send event that board has changed
|
|
|
|
self.onChange();
|
|
|
|
self.onChange();
|
|
|
@ -454,23 +455,36 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return exists;
|
|
|
|
return exists;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.moveItem = function (eid, board, pos) {
|
|
|
|
this.moveItem = function (source, eid, board, pos) {
|
|
|
|
var boards = self.options.boards;
|
|
|
|
var boards = self.options.boards;
|
|
|
|
var same = -1;
|
|
|
|
var same = -1;
|
|
|
|
|
|
|
|
console.error(source, eid, board, pos);
|
|
|
|
|
|
|
|
if (source && boards.data[source]) {
|
|
|
|
|
|
|
|
// Remove from this board only
|
|
|
|
|
|
|
|
var l = boards.data[source].item;
|
|
|
|
|
|
|
|
var idx = l.indexOf(eid);
|
|
|
|
|
|
|
|
if (idx !== -1) { l.splice(idx, 1); }
|
|
|
|
|
|
|
|
if (source === board) { same = idx; }
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Remove the item from all its board
|
|
|
|
var from = findItem(eid);
|
|
|
|
var from = findItem(eid);
|
|
|
|
// Remove the item from its board
|
|
|
|
|
|
|
|
from.forEach(function (obj) {
|
|
|
|
from.forEach(function (obj) {
|
|
|
|
obj.board.item.splice(obj.pos, 1);
|
|
|
|
obj.board.item.splice(obj.pos, 1);
|
|
|
|
if (obj.board === board) { same = obj.pos; }
|
|
|
|
if (obj.board === board) { same = obj.pos; }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
// If it's a deletion and not a duplicate, remove the item data
|
|
|
|
// If it's a deletion and not a duplicate, remove the item data
|
|
|
|
if (!board) {
|
|
|
|
if (!board) {
|
|
|
|
if (!self.checkItem(eid)) {
|
|
|
|
if (!self.checkItem(eid)) {
|
|
|
|
delete boards.items[eid];
|
|
|
|
delete boards.items[eid];
|
|
|
|
delete self.cache[eid];
|
|
|
|
delete self.cache[eid];
|
|
|
|
removeUnusedTags(boards);
|
|
|
|
removeUnusedTags(boards);
|
|
|
|
}
|
|
|
|
|
|
|
|
self.options.refresh();
|
|
|
|
self.options.refresh();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the item already exists in the target board, abort (duplicate)
|
|
|
|
|
|
|
|
if (board.item.indexOf(eid) !== -1) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If it's moved to the same board at a bigger index, decrement the index by one
|
|
|
|
// If it's moved to the same board at a bigger index, decrement the index by one
|
|
|
@ -783,7 +797,7 @@ define([
|
|
|
|
var list = Util.clone(this.options._boards.list);
|
|
|
|
var list = Util.clone(this.options._boards.list);
|
|
|
|
|
|
|
|
|
|
|
|
// Update memory
|
|
|
|
// Update memory
|
|
|
|
this.options._boards = boards;
|
|
|
|
this.options._boards = Util.clone(boards);
|
|
|
|
|
|
|
|
|
|
|
|
// If the tab is not focused but a handler already exists: abort
|
|
|
|
// If the tab is not focused but a handler already exists: abort
|
|
|
|
if (!Visible.currently() && onVisibleHandler) { return; }
|
|
|
|
if (!Visible.currently() && onVisibleHandler) { return; }
|
|
|
|