From b5603c89f02b29abdd93ed9f05b1541513c73c6e Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 26 Jul 2017 09:37:02 +0200 Subject: [PATCH] add checkboxes to todos --- www/todo/main.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/www/todo/main.js b/www/todo/main.js index 5a0025dfa..dde911b3d 100644 --- a/www/todo/main.js +++ b/www/todo/main.js @@ -51,11 +51,24 @@ define([ 'class': 'cp-task' }).appendTo($list); + var entry = APP.lm.proxy.data[el]; + + var $check = $('', { + type: 'checkbox', + }) + .on('change', function (e) { + var checked = $check[0].checked; + entry.state = checked? 1: 0; + entry.mtime = +new Date(); + }) + .appendTo($taskDiv); + $check[0].checked = entry.state? true: false; + $('', { 'class': 'cp-task-text' }) - .text(APP.lm.proxy.data[el].task) + .text(entry.task) .appendTo($taskDiv); $('', { 'class': 'cp-task-date' }) - .text(new Date(APP.lm.proxy.data[el].ctime).toLocaleString()) + .text(new Date(entry.ctime).toLocaleString()) .appendTo($taskDiv); $('