|
|
@ -1,7 +1,8 @@
|
|
|
|
define([
|
|
|
|
define([
|
|
|
|
'jquery',
|
|
|
|
'jquery',
|
|
|
|
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/bower_components/dragula.js/dist/dragula.min.js',
|
|
|
|
'/bower_components/dragula.js/dist/dragula.min.js',
|
|
|
|
], function ($, Dragula) {
|
|
|
|
], function ($, Messages, Dragula) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* jKanban
|
|
|
|
* jKanban
|
|
|
|
* Vanilla Javascript plugin for manage kanban boards
|
|
|
|
* Vanilla Javascript plugin for manage kanban boards
|
|
|
@ -559,25 +560,37 @@ define([
|
|
|
|
return nodeItem;
|
|
|
|
return nodeItem;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.addElement = function (boardID, element) {
|
|
|
|
this.addElement = function (boardID, element, before) {
|
|
|
|
|
|
|
|
|
|
|
|
// add Element to JSON
|
|
|
|
// add Element to JSON
|
|
|
|
var boardJSON = __findBoardJSON(boardID);
|
|
|
|
var boardJSON = __findBoardJSON(boardID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (before) {
|
|
|
|
|
|
|
|
boardJSON.item.unshift(element.id);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
boardJSON.item.push(element.id);
|
|
|
|
boardJSON.item.push(element.id);
|
|
|
|
|
|
|
|
}
|
|
|
|
self.options.boards.items = self.options.boards.items || {};
|
|
|
|
self.options.boards.items = self.options.boards.items || {};
|
|
|
|
self.options.boards.items[element.id] = element;
|
|
|
|
self.options.boards.items[element.id] = element;
|
|
|
|
|
|
|
|
|
|
|
|
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
|
|
|
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
|
|
|
|
|
|
|
if (before) {
|
|
|
|
|
|
|
|
board.insertBefore(getElementNode(element), board.firstChild);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
board.appendChild(getElementNode(element));
|
|
|
|
board.appendChild(getElementNode(element));
|
|
|
|
|
|
|
|
}
|
|
|
|
// send event that board has changed
|
|
|
|
// send event that board has changed
|
|
|
|
self.onChange();
|
|
|
|
self.onChange();
|
|
|
|
return self;
|
|
|
|
return self;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.addForm = function (boardID, formItem) {
|
|
|
|
this.addForm = function (boardID, formItem, isTop) {
|
|
|
|
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
|
|
|
var board = self.element.querySelector('[data-id="' + boardID + '"] .kanban-drag');
|
|
|
|
|
|
|
|
if (isTop) {
|
|
|
|
|
|
|
|
board.insertBefore(formItem, board.firstChild);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
board.appendChild(formItem);
|
|
|
|
board.appendChild(formItem);
|
|
|
|
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
return self;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -662,9 +675,17 @@ define([
|
|
|
|
var footerBoard = document.createElement('footer');
|
|
|
|
var footerBoard = document.createElement('footer');
|
|
|
|
footerBoard.classList.add('kanban-board-footer');
|
|
|
|
footerBoard.classList.add('kanban-board-footer');
|
|
|
|
//add button
|
|
|
|
//add button
|
|
|
|
|
|
|
|
Messages.kanban_addTopButton = '<i class="fa fa-plus"></i> (top)'; // XXX
|
|
|
|
|
|
|
|
Messages.kanban_addBottomButton = '<i class="fa fa-plus"></i> (bottom)'; // XXX
|
|
|
|
|
|
|
|
var addTopBoardItem = document.createElement('span');
|
|
|
|
|
|
|
|
addTopBoardItem.classList.add('kanban-title-button');
|
|
|
|
|
|
|
|
addTopBoardItem.setAttribute('data-top', "1");
|
|
|
|
|
|
|
|
addTopBoardItem.innerHTML = Messages.kanban_addTopButton;
|
|
|
|
|
|
|
|
footerBoard.appendChild(addTopBoardItem);
|
|
|
|
|
|
|
|
__onAddItemClickHandler(addTopBoardItem);
|
|
|
|
var addBoardItem = document.createElement('span');
|
|
|
|
var addBoardItem = document.createElement('span');
|
|
|
|
addBoardItem.classList.add('kanban-title-button');
|
|
|
|
addBoardItem.classList.add('kanban-title-button');
|
|
|
|
addBoardItem.innerText = '+';
|
|
|
|
addBoardItem.innerHTML = Messages.kanban_addBottomButton;
|
|
|
|
footerBoard.appendChild(addBoardItem);
|
|
|
|
footerBoard.appendChild(addBoardItem);
|
|
|
|
__onAddItemClickHandler(addBoardItem);
|
|
|
|
__onAddItemClickHandler(addBoardItem);
|
|
|
|
|
|
|
|
|
|
|
|