From 8cb6e3c1b4a88794533587d74bfe4ad3e79bb005 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 2 Mar 2020 18:43:44 +0100 Subject: [PATCH] Delete boards --- www/kanban/jkanban.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/www/kanban/jkanban.js b/www/kanban/jkanban.js index d09f1cd3a..f974473ce 100644 --- a/www/kanban/jkanban.js +++ b/www/kanban/jkanban.js @@ -86,7 +86,7 @@ if (window.innerWidth > self.options.responsive) { //Init Drag Board - self.drakeBoard = self.dragula([self.container], { + self.drakeBoard = self.dragula([self.container, self.trashContainer], { moves: function (el, source, handle, sibling) { if (self.options.readOnly) { return false; } if (!self.options.dragBoards) { return false; } @@ -114,6 +114,14 @@ if (typeof (el.dragendfn) === 'function') el.dragendfn(el); }) + .on('over', function (el, target, source) { + if (!target.classList.contains('kanban-trash')) { return false; } + target.classList.add('kanban-trash-active'); + }) + .on('out', function (el, target) { + if (!target.classList.contains('kanban-trash')) { return false; } + target.classList.remove('kanban-trash-active'); + }) .on('drop', function (el, target, source, sibling) { el.classList.remove('is-moving'); self.options.dropBoard(el, target, source, sibling); @@ -220,8 +228,6 @@ return; } - - // Find the new board var targetId = Number($(target).closest('.kanban-board').data('id')); if (!targetId) { return; } @@ -547,7 +553,7 @@ addBoard.id = 'kanban-addboard'; addBoard.setAttribute('class', 'fa fa-plus'); boardContainer.appendChild(addBoard); - var trash = document.createElement('div'); + var trash = self.trashContainer = document.createElement('div'); trash.setAttribute('id', 'kanban-trash'); trash.setAttribute('class', 'kanban-trash'); var trashIcon = document.createElement('i');