Add color picker to items
This commit is contained in:
@@ -137,7 +137,7 @@ define([
|
|||||||
// Remove the input
|
// Remove the input
|
||||||
$(el).text(name);
|
$(el).text(name);
|
||||||
// Save the value for the correct board
|
// Save the value for the correct board
|
||||||
var board = $(el.parentNode.parentNode).attr("data-id");
|
var board = $(el.parentNode.parentNode.parentNode).attr("data-id");
|
||||||
var pos = kanban.findElementPosition(el);
|
var pos = kanban.findElementPosition(el);
|
||||||
kanban.getBoardJSON(board).item[pos].title = name;
|
kanban.getBoardJSON(board).item[pos].title = name;
|
||||||
kanban.onChange();
|
kanban.onChange();
|
||||||
|
|||||||
@@ -374,14 +374,38 @@
|
|||||||
var nodeItem = document.createElement('div');
|
var nodeItem = document.createElement('div');
|
||||||
nodeItem.classList.add('kanban-item');
|
nodeItem.classList.add('kanban-item');
|
||||||
nodeItem.dataset.eid = itemKanban.id;
|
nodeItem.dataset.eid = itemKanban.id;
|
||||||
nodeItem.innerHTML = itemKanban.title;
|
var nodeItemText = document.createElement('div');
|
||||||
|
nodeItemText.classList.add('kanban-item-text');
|
||||||
|
nodeItemText.dataset.eid = itemKanban.id;
|
||||||
|
nodeItemText.innerHTML = itemKanban.title;
|
||||||
|
nodeItem.appendChild(nodeItemText);
|
||||||
//add function
|
//add function
|
||||||
nodeItem.clickfn = itemKanban.click;
|
nodeItemText.clickfn = itemKanban.click;
|
||||||
nodeItem.dragfn = itemKanban.drag;
|
nodeItemText.dragfn = itemKanban.drag;
|
||||||
nodeItem.dragendfn = itemKanban.dragend;
|
nodeItemText.dragendfn = itemKanban.dragend;
|
||||||
nodeItem.dropfn = itemKanban.drop;
|
nodeItemText.dropfn = itemKanban.drop;
|
||||||
//add click handler of item
|
//add click handler of item
|
||||||
__onclickHandler(nodeItem);
|
__onclickHandler(nodeItemText);
|
||||||
|
|
||||||
|
var onchange = function (colorL) {
|
||||||
|
var currentColor = itemKanban.color;
|
||||||
|
if (currentColor !== colorL.toString()) {
|
||||||
|
itemKanban.color = colorL.toString();
|
||||||
|
self.onChange();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var jscolorL;
|
||||||
|
nodeItem._jscLinkedInstance = undefined;
|
||||||
|
jscolorL = new jscolor(nodeItem,{onFineChange: onchange, valueElement:undefined});
|
||||||
|
var currentColor = itemKanban.color;
|
||||||
|
// If not defined dont have it undefined
|
||||||
|
if (currentColor == undefined) {
|
||||||
|
currentColor = ''
|
||||||
|
}
|
||||||
|
console.log(currentColor);
|
||||||
|
jscolorL.fromString(currentColor);
|
||||||
|
|
||||||
contentBoard.appendChild(nodeItem);
|
contentBoard.appendChild(nodeItem);
|
||||||
}
|
}
|
||||||
//footer board
|
//footer board
|
||||||
|
|||||||
Reference in New Issue
Block a user