Delete boards

This commit is contained in:
yflory 2020-03-02 18:43:44 +01:00
parent 0fc5a456df
commit 8cb6e3c1b4

View file

@ -86,7 +86,7 @@
if (window.innerWidth > self.options.responsive) { if (window.innerWidth > self.options.responsive) {
//Init Drag Board //Init Drag Board
self.drakeBoard = self.dragula([self.container], { self.drakeBoard = self.dragula([self.container, self.trashContainer], {
moves: function (el, source, handle, sibling) { moves: function (el, source, handle, sibling) {
if (self.options.readOnly) { return false; } if (self.options.readOnly) { return false; }
if (!self.options.dragBoards) { return false; } if (!self.options.dragBoards) { return false; }
@ -114,6 +114,14 @@
if (typeof (el.dragendfn) === 'function') if (typeof (el.dragendfn) === 'function')
el.dragendfn(el); 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) { .on('drop', function (el, target, source, sibling) {
el.classList.remove('is-moving'); el.classList.remove('is-moving');
self.options.dropBoard(el, target, source, sibling); self.options.dropBoard(el, target, source, sibling);
@ -220,8 +228,6 @@
return; return;
} }
// Find the new board // Find the new board
var targetId = Number($(target).closest('.kanban-board').data('id')); var targetId = Number($(target).closest('.kanban-board').data('id'));
if (!targetId) { return; } if (!targetId) { return; }
@ -547,7 +553,7 @@
addBoard.id = 'kanban-addboard'; addBoard.id = 'kanban-addboard';
addBoard.setAttribute('class', 'fa fa-plus'); addBoard.setAttribute('class', 'fa fa-plus');
boardContainer.appendChild(addBoard); boardContainer.appendChild(addBoard);
var trash = document.createElement('div'); var trash = self.trashContainer = document.createElement('div');
trash.setAttribute('id', 'kanban-trash'); trash.setAttribute('id', 'kanban-trash');
trash.setAttribute('class', 'kanban-trash'); trash.setAttribute('class', 'kanban-trash');
var trashIcon = document.createElement('i'); var trashIcon = document.createElement('i');