Fix kanban creation

pull/1/head
yflory 7 years ago
parent 95218f0fa1
commit 884f2b465d

@ -30,6 +30,7 @@ define([
var COLORS = ['yellow', 'green', 'orange', 'blue', 'red', 'purple', 'cyan', 'lightgreen', 'lightblue']; var COLORS = ['yellow', 'green', 'orange', 'blue', 'red', 'purple', 'cyan', 'lightgreen', 'lightblue'];
var addRemoveItemButton = function (framework, kanban) { var addRemoveItemButton = function (framework, kanban) {
if (!kanban) { return; }
if (framework.isReadOnly() || framework.isLocked()) { return; } if (framework.isReadOnly() || framework.isLocked()) { return; }
var $container = $(kanban.element); var $container = $(kanban.element);
$container.find('.kanban-remove-item').remove(); $container.find('.kanban-remove-item').remove();
@ -325,6 +326,7 @@ define([
} }
framework.onEditableChange(function (unlocked) { framework.onEditableChange(function (unlocked) {
if (framework.isReadOnly()) { return; } if (framework.isReadOnly()) { return; }
if (!kanban) { return; }
if (unlocked) { if (unlocked) {
addRemoveItemButton(framework, kanban); addRemoveItemButton(framework, kanban);
kanban.options.readOnly = false; kanban.options.readOnly = false;
@ -357,7 +359,11 @@ define([
}); });
framework.setContentGetter(function () { framework.setContentGetter(function () {
if (!kanban) { return; } if (!kanban) {
return {
content: []
};
}
var content = kanban.getBoardsJSON(); var content = kanban.getBoardsJSON();
verbose("Content current value is " + content); verbose("Content current value is " + content);
return { return {
@ -369,6 +375,10 @@ define([
$("#cp-app-kanban-content").focus(); $("#cp-app-kanban-content").focus();
}); });
framework.onDefaultContentNeeded(function () {
kanban = initKanban(framework);
});
framework.start(); framework.start();
}; };

Loading…
Cancel
Save