Add color picker to items

pull/1/head
MTRNord 6 years ago
parent 8df1dc19f2
commit 1bf1253963
No known key found for this signature in database
GPG Key ID: E5B89311FAB91B9F

@ -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();

@ -31,7 +31,7 @@
* @author: Riccardo Tartaglia * @author: Riccardo Tartaglia
*/ */
//Require dragula //Require dragula
var dragula = require('dragula'); var dragula = require('dragula');
(function () { (function () {
@ -85,18 +85,18 @@
//Init Drag Board //Init Drag Board
self.drakeBoard = self.dragula([self.container], { self.drakeBoard = self.dragula([self.container], {
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;
return (handle.classList.contains('kanban-board-header') || handle.classList.contains('kanban-title-board')); return (handle.classList.contains('kanban-board-header') || handle.classList.contains('kanban-title-board'));
}, },
accepts: function (el, target, source, sibling) { accepts: function (el, target, source, sibling) {
if (self.options.readOnly) { return false; } if (self.options.readOnly) { return false; }
return target.classList.contains('kanban-container'); return target.classList.contains('kanban-container');
}, },
revertOnSpill: true, revertOnSpill: true,
direction: 'horizontal', direction: 'horizontal',
}) })
.on('drag', function (el, source) { .on('drag', function (el, source) {
el.classList.add('is-moving'); el.classList.add('is-moving');
self.options.dragBoard(el, source); self.options.dragBoard(el, source);
@ -145,16 +145,16 @@
//Init Drag Item //Init Drag Item
self.drake = self.dragula(self.boardContainer, { self.drake = self.dragula(self.boardContainer, {
moves: function (el, source, handle, sibling) { moves: function (el, source, handle, sibling) {
if (self.options.readOnly) { return false; } if (self.options.readOnly) { return false; }
return handle.classList.contains('kanban-item'); return handle.classList.contains('kanban-item');
}, },
accepts: function (el, target, source, sibling) { accepts: function (el, target, source, sibling) {
if (self.options.readOnly) { return false; } if (self.options.readOnly) { return false; }
return true; return true;
}, },
revertOnSpill: true revertOnSpill: true
}) })
.on('cancel', function(el, container, source) { .on('cancel', function(el, container, source) {
self.enableAllBoards(); self.enableAllBoards();
}) })
@ -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
@ -575,7 +599,7 @@
}()); }());
}, { }, {
"dragula": 9 "dragula": 9
}], }],
2: [function (require, module, exports) { 2: [function (require, module, exports) {
@ -583,7 +607,7 @@
return Array.prototype.slice.call(a, n); return Array.prototype.slice.call(a, n);
} }
}, {}], }, {}],
3: [function (require, module, exports) { 3: [function (require, module, exports) {
'use strict'; 'use strict';
@ -598,7 +622,7 @@
}); });
}; };
}, { }, {
"ticky": 10 "ticky": 10
}], }],
4: [function (require, module, exports) { 4: [function (require, module, exports) {
@ -669,7 +693,7 @@
return thing; return thing;
}; };
}, { }, {
"./debounce": 3, "./debounce": 3,
"atoa": 2 "atoa": 2
}], }],
@ -786,7 +810,7 @@
} }
}).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
}, { }, {
"./eventmap": 6, "./eventmap": 6,
"custom-event": 7 "custom-event": 7
}], }],
@ -807,7 +831,7 @@
module.exports = eventmap; module.exports = eventmap;
}).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
}, {}], }, {}],
7: [function (require, module, exports) { 7: [function (require, module, exports) {
(function (global) { (function (global) {
@ -837,33 +861,33 @@
// IE >= 9 // IE >= 9
'function' === typeof document.createEvent ? function CustomEvent(type, params) { 'function' === typeof document.createEvent ? function CustomEvent(type, params) {
var e = document.createEvent('CustomEvent'); var e = document.createEvent('CustomEvent');
if (params) { if (params) {
e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
} else { } else {
e.initCustomEvent(type, false, false, void 0); e.initCustomEvent(type, false, false, void 0);
} }
return e; return e;
} : } :
// IE <= 8 // IE <= 8
function CustomEvent(type, params) { function CustomEvent(type, params) {
var e = document.createEventObject(); var e = document.createEventObject();
e.type = type; e.type = type;
if (params) { if (params) {
e.bubbles = Boolean(params.bubbles); e.bubbles = Boolean(params.bubbles);
e.cancelable = Boolean(params.cancelable); e.cancelable = Boolean(params.cancelable);
e.detail = params.detail; e.detail = params.detail;
} else { } else {
e.bubbles = false; e.bubbles = false;
e.cancelable = false; e.cancelable = false;
e.detail = void 0; e.detail = void 0;
}
return e;
} }
return e;
}
}).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
}, {}], }, {}],
8: [function (require, module, exports) { 8: [function (require, module, exports) {
'use strict'; 'use strict';
@ -899,7 +923,7 @@
rm: rmClass rm: rmClass
}; };
}, {}], }, {}],
9: [function (require, module, exports) { 9: [function (require, module, exports) {
(function (global) { (function (global) {
'use strict'; 'use strict';
@ -1586,7 +1610,7 @@
module.exports = dragula; module.exports = dragula;
}).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
}, { }, {
"./classes": 8, "./classes": 8,
"contra/emitter": 4, "contra/emitter": 4,
"crossvent": 5 "crossvent": 5
@ -1605,5 +1629,5 @@
} }
module.exports = tick; module.exports = tick;
}, {}] }, {}]
}, {}, [1]); }, {}, [1]);

Loading…
Cancel
Save