Add confirm dialog when deleting a task in kanban + add colors

This commit is contained in:
yflory
2018-05-23 17:13:41 +02:00
parent 914da83b46
commit 7800fa2dcd
4 changed files with 36 additions and 7 deletions

View File

@@ -27,6 +27,8 @@ define([
var verbose = function (x) { console.log(x); };
verbose = function () {}; // comment out to enable verbose logging
var COLORS = ['yellow', 'green', 'orange', 'blue', 'red', 'purple', 'cyan', 'lightgreen', 'lightblue'];
var addRemoveItemButton = function (framework, kanban) {
if (framework.isReadOnly() || framework.isLocked()) { return; }
var $container = $(kanban.element);
@@ -41,9 +43,12 @@ define([
title: Messages.kanban_removeItem
}).click(function (e) {
e.stopPropagation();
board.item.splice(pos, 1);
$(el).remove();
kanban.onChange();
UI.confirm(Messages.kanban_removeItemConfirm, function (yes) {
if (!yes) { return; }
board.item.splice(pos, 1);
$(el).remove();
kanban.onChange();
});
}).text('❌').appendTo($(el));
});
};
@@ -102,6 +107,7 @@ define([
gutter: '15px',
widthBoard: '300px',
buttonContent: '❌',
colors: COLORS,
readOnly: framework.isReadOnly(),
onChange: function () {
verbose("Board object has changed");
@@ -264,6 +270,7 @@ define([
if (e.which === 27) {
e.preventDefault();
e.stopPropagation();
$item.remove();
kanban.inEditMode = false;
return;
}
@@ -286,7 +293,7 @@ define([
kanban.addBoards([{
"id": "board" + counter,
"title": Messages.kanban_newBoard,
"color": "yellow",
"color": COLORS[Math.floor(Math.random()*COLORS.length)], // random color
"item": [{
"title": Messages._getKey('kanban_item', [1]),
}]