add checkboxes to todos

This commit is contained in:
ansuz 2017-07-26 09:37:02 +02:00
parent 4f63921fc9
commit b5603c89f0
1 changed files with 15 additions and 2 deletions

View File

@ -51,11 +51,24 @@ define([
'class': 'cp-task'
}).appendTo($list);
var entry = APP.lm.proxy.data[el];
var $check = $('<input>', {
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;
$('<span>', { 'class': 'cp-task-text' })
.text(APP.lm.proxy.data[el].task)
.text(entry.task)
.appendTo($taskDiv);
$('<span>', { 'class': 'cp-task-date' })
.text(new Date(APP.lm.proxy.data[el].ctime).toLocaleString())
.text(new Date(entry.ctime).toLocaleString())
.appendTo($taskDiv);
$('<button>', {
'class': 'fa fa-times cp-task-remove btn btn-danger'