|
|
|
@ -134,6 +134,24 @@ define([
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var addEditItemButton = function () {};
|
|
|
|
|
|
|
|
|
|
var now = function () { return +new Date(); };
|
|
|
|
|
var _lastUpdate = 0;
|
|
|
|
|
var _updateBoards = function (framework, kanban, boards) {
|
|
|
|
|
_lastUpdate = now();
|
|
|
|
|
kanban.setBoards(Util.clone(boards));
|
|
|
|
|
kanban.inEditMode = false;
|
|
|
|
|
addEditItemButton(framework, kanban);
|
|
|
|
|
};
|
|
|
|
|
var _updateBoardsThrottle = Util.throttle(_updateBoards, 1000);
|
|
|
|
|
var updateBoards = function (framework, kanban, boards) {
|
|
|
|
|
if ((now() - _lastUpdate) > 5000) {
|
|
|
|
|
_updateBoards(framework, kanban, boards);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_updateBoardsThrottle(framework, kanban, boards);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var onRemoteChange = Util.mkEvent();
|
|
|
|
|
var editModal;
|
|
|
|
|
var PROPERTIES = ['title', 'body', 'tags', 'color'];
|
|
|
|
@ -146,10 +164,9 @@ define([
|
|
|
|
|
var isBoard, id;
|
|
|
|
|
var offline = false;
|
|
|
|
|
|
|
|
|
|
var update = Util.throttle(function () {
|
|
|
|
|
kanban.setBoards(kanban.options.boards);
|
|
|
|
|
addEditItemButton(framework, kanban);
|
|
|
|
|
}, 400);
|
|
|
|
|
var update = function () {
|
|
|
|
|
updateBoards(framework, kanban, kanban.options.boards);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var commit = function () {
|
|
|
|
|
framework.localChange();
|
|
|
|
@ -830,7 +847,8 @@ define([
|
|
|
|
|
openLink: openLink,
|
|
|
|
|
getTags: getExistingTags,
|
|
|
|
|
cursors: remoteCursors,
|
|
|
|
|
boards: boards
|
|
|
|
|
boards: boards,
|
|
|
|
|
_boards: Util.clone(boards),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
framework._.cpNfInner.metadataMgr.onChange(function () {
|
|
|
|
@ -841,7 +859,7 @@ define([
|
|
|
|
|
// If the rendering has changed, update the value and redraw
|
|
|
|
|
kanban.options.tagsAnd = tagsAnd;
|
|
|
|
|
_tagsAnd = tagsAnd;
|
|
|
|
|
kanban.setBoards(kanban.options.boards);
|
|
|
|
|
updateBoards(framework, kanban, kanban.options.boards);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (migrated) { framework.localChange(); }
|
|
|
|
@ -1166,9 +1184,8 @@ define([
|
|
|
|
|
if (Sortify(currentContent) !== Sortify(remoteContent)) {
|
|
|
|
|
var cursor = getCursor();
|
|
|
|
|
verbose("Content is different.. Applying content");
|
|
|
|
|
kanban.setBoards(remoteContent);
|
|
|
|
|
kanban.inEditMode = false;
|
|
|
|
|
addEditItemButton(framework, kanban);
|
|
|
|
|
kanban.options.boards = remoteContent;
|
|
|
|
|
updateBoards(framework, kanban, remoteContent);
|
|
|
|
|
restoreCursor(cursor);
|
|
|
|
|
onRemoteChange.fire();
|
|
|
|
|
}
|
|
|
|
|