diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 8c8a72c42..29ef86b59 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -193,7 +193,24 @@ define([ }; }, addItemButton: true, - boards: boards + boards: boards, + dragcancelEl: function (el, boardId) { + // XXX + var pos = kanban.findElementPosition(el); + UI.confirm("Are you sure...??", function (yes) { + if (!yes) { return; } + var board; + kanban.options.boards.some(function (b) { + if (b.id === boardId) { + return (board = b); + } + }); + if (!board) { return; } + board.item.splice(pos, 1); + $(el).remove(); + kanban.onChange(); + }); + } }); var addBoardDefault = document.getElementById('kanban-addboard'); diff --git a/www/kanban/jkanban.js b/www/kanban/jkanban.js index a2c5f3467..e32aa2dc7 100644 --- a/www/kanban/jkanban.js +++ b/www/kanban/jkanban.js @@ -59,6 +59,7 @@ dragEl: function (el, source) {}, dragendEl: function (el) {}, dropEl: function (el, target, source, sibling) {}, + dragcancelEl: function (el, boardId) {}, dragBoard: function (el, source) {}, dragendBoard: function (el) {}, dropBoard: function (el, target, source, sibling) {}, @@ -157,15 +158,9 @@ }) .on('cancel', function (el, container, source) { console.log("In cancel"); - if (confirm("Do you want to remove this item?")) { - var board1 = self.options.boards.find(function (element) { - return element.id == $(source.parentNode).attr("data-id"); - }); - var pos1 = self.dragItemPos; - board1.item.splice(pos1, 1); - $(el).remove(); - self.onChange(); - } + // FIXME custom code + var boardId = source.parentNode.dataset.id; + self.options.dragcancelEl(el, boardId); }) .on('drop', function (el, target, source, sibling) { console.log("In drop"); @@ -1549,4 +1544,4 @@ module.exports = tick; }, {}] -}, {}, [1]); \ No newline at end of file +}, {}, [1]);