Skip to content

Instantly share code, notes, and snippets.

@madawei2699
Created December 15, 2019 13:41
Show Gist options
  • Save madawei2699/a932cf8d872c710a0f73bccca7be370a to your computer and use it in GitHub Desktop.
Save madawei2699/a932cf8d872c710a0f73bccca7be370a to your computer and use it in GitHub Desktop.
TODO++ // source https://jsbin.com/dugiric
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.1.2/mustache.min.js"></script>
<title>TODO++</title>
</head>
<body>
<script id="todo-list" type="x-tmpl-mustache">
<ul class='todos'>
{{#todo}}
<li class='todo' style='list-style-type: none;'> {{ name }} </li>
{{> recurse }}
{{/todo}}
</ul>
</script>
<script type="text/javascript">
var todoList = $('#todo-list');
var data = {
"todo": [
{
"name": "test1:",
"todo": [
{
"name": "☐ test list1 @started(19-12-11 21:16)",
"todo": []
},
{
"name": "✘ cancel @cancelled(19-12-11 21:28)",
"todo": []
},
{
"name": "test2:",
"todo": [
{
"name": "☐ test list21 @started(19-12-11 21:16)",
"todo": []
},
{
"name": "✘ test list23 cancel @cancelled(19-12-11 21:28)",
"todo": []
}
]
}
]
},
{
"name": "test3:",
"todo": [
{
"name": "☐ test list31 @started(19-12-11 21:16)",
"todo": []
}
]
}
]
};
$('body').html(Mustache.render(todoList.html(), data, {
recurse: todoList.html()
}));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment