Remove translatable text and blocking 'confirm' dialog from jkanban.js

This commit is contained in:
yflory 2018-05-16 16:18:44 +02:00
parent 0ab27427bc
commit 087e346685
2 changed files with 23 additions and 11 deletions

View file

@ -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');

View file

@ -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]);
}, {}, [1]);