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

pull/1/head
yflory 7 years ago
parent 914da83b46
commit 7800fa2dcd

@ -256,6 +256,7 @@ define(function () {
out.kanban_deleteBoard = "Êtes-vous sûr de vouloir supprimer ce tableau ?"; out.kanban_deleteBoard = "Êtes-vous sûr de vouloir supprimer ce tableau ?";
out.kanban_addBoard = "Ajouter un tableau"; out.kanban_addBoard = "Ajouter un tableau";
out.kanban_removeItem = "Supprimer cet élément"; out.kanban_removeItem = "Supprimer cet élément";
out.kanban_removeItemConfirm = "Êtes-vous sûr de vouloir supprimer cet élément ?";
// Polls // Polls

@ -258,6 +258,7 @@ define(function () {
out.kanban_deleteBoard = "Are you sure you want to delete this board?"; out.kanban_deleteBoard = "Are you sure you want to delete this board?";
out.kanban_addBoard = "Add a board"; out.kanban_addBoard = "Add a board";
out.kanban_removeItem = "Remove this item"; out.kanban_removeItem = "Remove this item";
out.kanban_removeItemConfirm = "Are you sure you want to delete this item?";
// Polls // Polls

@ -93,7 +93,14 @@
.kanban-remove-item { .kanban-remove-item {
padding: 0 0.5em; padding: 0 0.5em;
visibility: hidden;
} }
.kanban-item:hover {
.kanban-remove-item {
visibility: visible;
}
}
.kanban-additem { .kanban-additem {
float: right; float: right;
background: #EEE; background: #EEE;
@ -108,9 +115,6 @@
} }
} }
.kanban-additem {
}
.kanban-header-yellow { .kanban-header-yellow {
background: #FC3; background: #FC3;
} }
@ -131,6 +135,22 @@
background: #8C4; background: #8C4;
} }
.kanban-header-purple {
background: #c851ff;
}
.kanban-header-cyan {
background: #00ffff;
}
.kanban-header-lightgreen {
background: #c3ff5b;
}
.kanban-header-lightblue {
background: #adeeff;
}
@media (max-width: @browser_media-medium-screen) { @media (max-width: @browser_media-medium-screen) {
#cp-app-kanban-container { #cp-app-kanban-container {
flex: 1; flex: 1;

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

Loading…
Cancel
Save