From f67fb32bf1ab45e228bd1eb93da10399c4b63039 Mon Sep 17 00:00:00 2001 From: Nicolas Lemoine Date: Mon, 24 Jul 2017 16:23:53 +0300 Subject: [PATCH] Add, delete, display a task in Todo --- www/todo/inner.html | 2 +- www/todo/main.js | 61 +++++++++++++++++++++++++++++++++++++++------ www/todo/todo.js | 2 +- 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/www/todo/inner.html b/www/todo/inner.html index e780b5c9a..4d8aacbce 100644 --- a/www/todo/inner.html +++ b/www/todo/inner.html @@ -13,7 +13,7 @@ -
+
diff --git a/www/todo/main.js b/www/todo/main.js index a695cd88a..17d70e361 100644 --- a/www/todo/main.js +++ b/www/todo/main.js @@ -4,15 +4,14 @@ define([ '/bower_components/chainpad-listmap/chainpad-listmap.js', '/common/toolbar2.js', '/common/cryptpad-common.js', - '/common/visible.js', - '/common/notify.js', + '/todo/todo.js', //'/common/media-tag.js', //'/bower_components/file-saver/FileSaver.min.js', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/customize/src/less/cryptpad.less', -], function ($, Crypto, Listmap, Toolbar, Cryptpad /*, Visible, Notify*/) { +], function ($, Crypto, Listmap, Toolbar, Cryptpad, Todo) { var Messages = Cryptpad.Messages; var APP = window.APP = {}; @@ -24,16 +23,62 @@ define([ var onReady = function () { + var todo = Todo.init(APP.lm.proxy, Cryptpad); + + var deleteTask = function(id) { + todo.remove(id); + + APP.display(); + }; + + var display = APP.display = function () { + var $list = $iframe.find('#tasksList'); + + $list.empty(); + + APP.lm.proxy.order.forEach(function(el) { + var $taskDiv = $('
', { + 'class': 'cp-task' + }).appendTo($list); + + $('', {}) + .text(APP.lm.proxy.data[el].task) + .appendTo($taskDiv); + $('', {}) + .text(new Date(APP.lm.proxy.data[el].ctime).toLocaleString()) + .appendTo($taskDiv); + $('