add checkboxes to todos
This commit is contained in:
parent
4f63921fc9
commit
b5603c89f0
@ -51,11 +51,24 @@ define([
|
|||||||
'class': 'cp-task'
|
'class': 'cp-task'
|
||||||
}).appendTo($list);
|
}).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' })
|
$('<span>', { 'class': 'cp-task-text' })
|
||||||
.text(APP.lm.proxy.data[el].task)
|
.text(entry.task)
|
||||||
.appendTo($taskDiv);
|
.appendTo($taskDiv);
|
||||||
$('<span>', { 'class': 'cp-task-date' })
|
$('<span>', { 'class': 'cp-task-date' })
|
||||||
.text(new Date(APP.lm.proxy.data[el].ctime).toLocaleString())
|
.text(new Date(entry.ctime).toLocaleString())
|
||||||
.appendTo($taskDiv);
|
.appendTo($taskDiv);
|
||||||
$('<button>', {
|
$('<button>', {
|
||||||
'class': 'fa fa-times cp-task-remove btn btn-danger'
|
'class': 'fa fa-times cp-task-remove btn btn-danger'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user