diff --git a/www/todo/main.js b/www/todo/main.js
index 0b54a96e8..20cece307 100644
--- a/www/todo/main.js
+++ b/www/todo/main.js
@@ -20,6 +20,7 @@ define([
var $iframe = $('#pad-iframe').contents();
var $body = $iframe.find('body');
var ifrw = $('#pad-iframe')[0].contentWindow;
+ var $list = $iframe.find('#tasksList');
var onReady = function () {
@@ -28,7 +29,13 @@ define([
var deleteTask = function(id) {
todo.remove(id);
- APP.display();
+ var $els = $list.find('.cp-task').filter(function (i, el) {
+ return $(el).data('id') === id;
+ });
+ $els.fadeOut(null, function () {
+ $els.remove();
+ });
+ //APP.display();
};
// TODO make this actually work, and scroll to bottom...
@@ -55,38 +62,48 @@ define([
});
};
- var display = APP.display = function () {
- var $list = $iframe.find('#tasksList');
+ var addTaskUI = function (el, animate) {
+ var $taskDiv = $('
', {
+ 'class': 'cp-task'
+ }).appendTo($list);
+ $taskDiv.data('id', el);
+ var $box = makeCheckbox(el, function (state) {
+ display();
+ })
+ .appendTo($taskDiv);
+
+ var entry = APP.lm.proxy.data[el];
+
+ if (entry.state) {
+ $taskDiv.addClass('cp-task-complete');
+ }
+
+ $('
', { 'class': 'cp-task-text' })
+ .text(entry.task)
+ .appendTo($taskDiv);
+ $('', { 'class': 'cp-task-date' })
+ .text(new Date(entry.ctime).toLocaleString())
+ .appendTo($taskDiv);
+ $('