|
|
@ -57,9 +57,12 @@ define([
|
|
|
|
Messages.kanban_color = "Color"; // XXX
|
|
|
|
Messages.kanban_color = "Color"; // XXX
|
|
|
|
Messages.kanban_submit = "Submit"; // XXX
|
|
|
|
Messages.kanban_submit = "Submit"; // XXX
|
|
|
|
Messages.kanban_delete = "Delete"; // XXX
|
|
|
|
Messages.kanban_delete = "Delete"; // XXX
|
|
|
|
|
|
|
|
Messages.kanban_tags = "Filter tags"; // XXX
|
|
|
|
|
|
|
|
|
|
|
|
// XXX
|
|
|
|
// XXX
|
|
|
|
// Add "large" view
|
|
|
|
// Tag filter:
|
|
|
|
|
|
|
|
// remember tags in padAttribute
|
|
|
|
|
|
|
|
// click on a tag ==> add it to the list
|
|
|
|
|
|
|
|
|
|
|
|
var setValueAndCursor = function (input, val, _cursor) {
|
|
|
|
var setValueAndCursor = function (input, val, _cursor) {
|
|
|
|
if (!input) { return; }
|
|
|
|
if (!input) { return; }
|
|
|
@ -79,6 +82,20 @@ define([
|
|
|
|
input.selectionEnd = selects[1];
|
|
|
|
input.selectionEnd = selects[1];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getExistingTags = function (boards) {
|
|
|
|
|
|
|
|
var tags = [];
|
|
|
|
|
|
|
|
boards = boards || {};
|
|
|
|
|
|
|
|
Object.keys(boards.items || {}).forEach(function (id) {
|
|
|
|
|
|
|
|
var data = boards.items[id];
|
|
|
|
|
|
|
|
if (!Array.isArray(data.tags)) { return; }
|
|
|
|
|
|
|
|
data.tags.forEach(function (tag) {
|
|
|
|
|
|
|
|
if (tags.indexOf(tag) === -1) { tags.push(tag); }
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
tags.sort();
|
|
|
|
|
|
|
|
return tags;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var addEditItemButton = function () {};
|
|
|
|
var addEditItemButton = function () {};
|
|
|
|
var onRemoteChange = Util.mkEvent();
|
|
|
|
var onRemoteChange = Util.mkEvent();
|
|
|
|
var editModal;
|
|
|
|
var editModal;
|
|
|
@ -161,19 +178,6 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Tags
|
|
|
|
// Tags
|
|
|
|
var getExisting = function () {
|
|
|
|
|
|
|
|
var tags = [];
|
|
|
|
|
|
|
|
var boards = kanban.options.boards || {};
|
|
|
|
|
|
|
|
Object.keys(boards.items || {}).forEach(function (id) {
|
|
|
|
|
|
|
|
var data = boards.items[id];
|
|
|
|
|
|
|
|
if (!Array.isArray(data.tags)) { return; }
|
|
|
|
|
|
|
|
data.tags.forEach(function (tag) {
|
|
|
|
|
|
|
|
if (tags.indexOf(tag) === -1) { tags.push(tag); }
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
tags.sort();
|
|
|
|
|
|
|
|
return tags;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var $tags = $(tagsDiv);
|
|
|
|
var $tags = $(tagsDiv);
|
|
|
|
var _field, initialTags;
|
|
|
|
var _field, initialTags;
|
|
|
|
var tags = {
|
|
|
|
var tags = {
|
|
|
@ -191,11 +195,10 @@ define([
|
|
|
|
$tags.empty();
|
|
|
|
$tags.empty();
|
|
|
|
var input = UI.dialog.textInput();
|
|
|
|
var input = UI.dialog.textInput();
|
|
|
|
$tags.append(input);
|
|
|
|
$tags.append(input);
|
|
|
|
var existing = getExisting();
|
|
|
|
var existing = getExistingTags(kanban.options.boards);
|
|
|
|
_field = UI.tokenField(input, existing).preventDuplicates(function (val) {
|
|
|
|
_field = UI.tokenField(input, existing).preventDuplicates(function (val) {
|
|
|
|
UI.warn(Messages._getKey('tags_duplicate', [val]));
|
|
|
|
UI.warn(Messages._getKey('tags_duplicate', [val]));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$tags.append(_field);
|
|
|
|
|
|
|
|
_field.setTokens(tags || []);
|
|
|
|
_field.setTokens(tags || []);
|
|
|
|
|
|
|
|
|
|
|
|
var commitTags = function () {
|
|
|
|
var commitTags = function () {
|
|
|
@ -682,8 +685,29 @@ define([
|
|
|
|
$container.removeClass('cp-kanban-quick');
|
|
|
|
$container.removeClass('cp-kanban-quick');
|
|
|
|
framework._.sfCommon.setPadAttribute('quickMode', false);
|
|
|
|
framework._.sfCommon.setPadAttribute('quickMode', false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var existing = getExistingTags(kanban.options.boards);
|
|
|
|
|
|
|
|
var input = UI.dialog.textInput();
|
|
|
|
|
|
|
|
var tags = h('div.cp-kanban-filterTags', [
|
|
|
|
|
|
|
|
Messages.kanban_tags,
|
|
|
|
|
|
|
|
input
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
var field = UI.tokenField(input, existing).preventDuplicates(function (val) {
|
|
|
|
|
|
|
|
UI.warn(Messages._getKey('tags_duplicate', [val]));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
field.setTokens([]);
|
|
|
|
|
|
|
|
var commitTags = function () {
|
|
|
|
|
|
|
|
var t = field.getTokens();
|
|
|
|
|
|
|
|
kanban.options.tags = t;
|
|
|
|
|
|
|
|
kanban.setBoards(kanban.options.boards);
|
|
|
|
|
|
|
|
addEditItemButton(framework, kanban);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
field.tokenfield.on('tokenfield:createdtoken', commitTags);
|
|
|
|
|
|
|
|
field.tokenfield.on('tokenfield:editedoken', commitTags);
|
|
|
|
|
|
|
|
field.tokenfield.on('tokenfield:removedtoken', commitTags);
|
|
|
|
|
|
|
|
|
|
|
|
var container = h('div#cp-kanban-controls', [
|
|
|
|
var container = h('div#cp-kanban-controls', [
|
|
|
|
h('div', "Tags"), // XXX
|
|
|
|
tags, // XXX
|
|
|
|
h('div.cp-kanban-changeView', [
|
|
|
|
h('div.cp-kanban-changeView', [
|
|
|
|
small,
|
|
|
|
small,
|
|
|
|
big
|
|
|
|
big
|
|
|
@ -860,9 +884,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
framework.setContentGetter(function () {
|
|
|
|
framework.setContentGetter(function () {
|
|
|
|
if (!kanban) {
|
|
|
|
if (!kanban) {
|
|
|
|
return {
|
|
|
|
throw new Error("NOT INITIALIZED");
|
|
|
|
content: {}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var content = kanban.getBoardsJSON();
|
|
|
|
var content = kanban.getBoardsJSON();
|
|
|
|
verbose("Content current value is " + content);
|
|
|
|
verbose("Content current value is " + content);
|
|
|
|