Forked from ncammarata/gist:1831e3bcea38d45dc8ab
Last active
August 29, 2015 14:19
-
-
Save natew/888b7e2e5bbbce0cd05e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
store Tasks { | |
@tasks = [] | |
@undone <- @tasks.filter(task => !task.done) | |
makeTask(task) { return { title: title, done: false } } | |
addTask() { @tasks.push(makeTask(task)) } | |
clear() { @tasks = @undone } | |
} | |
view Main { | |
@newText = "" | |
add() { Tasks.addTask(); @newText = "" } | |
<h1>Todo List</h1> | |
<div.task repeat={Tasks.tasks}> | |
<input type="checkbox" sync={.done} /> | |
</div> | |
<div.toolbar> | |
<div.undone> {Tasks.undone.length} tasks left</div> | |
<button click={Tasks.clear()}>clear completed</button> | |
</div> | |
<input enter={add()} placeholder="New Task" /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment