Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Cleanup to-do example

  • Loading branch information...
commit 9cd2f5c2bd1f63a45ad88f7cbc67f826de4950a8 1 parent ae1fbcb
Jarno Keskikangas pyykkis authored

Showing 1 changed file with 8 additions and 4 deletions. Show diff stats Hide diff stats

  1. +8 4 examples/todo-app/index.html
12 examples/todo-app/index.html
@@ -14,9 +14,12 @@
14 14 <input type="text" name="task" />
15 15 <input type="submit" value="Add" />
16 16 </form>
17   - <div id="tasks">
18   - <div><input type="checkbox"/><span class="task"></span></div>
19   - </div>
  17 + <table id="tasks">
  18 + <tr>
  19 + <td class="task"></td>
  20 + <td><a class="delete" href="#">delete</a></td>
  21 + </tr>
  22 + </table>
20 23
21 24 <script type="text/coffeescript">
22 25 data = [{task: "Foo"}, {task: "Bar"}]
@@ -28,13 +31,14 @@
28 31 tasks.on 'update', ->
29 32 tasks.render data
30 33
  34 +
31 35 $('#add-task').submit (event) ->
32 36 event.preventDefault()
33 37 data.push task: input.val()
34 38 input.val ""
35 39 tasks.trigger 'update'
36 40
37   - tasks.on 'click', 'input[type="checkbox"]', (event) ->
  41 + tasks.on 'click', '.delete', (event) ->
38 42 taskName = event.target.transparency.model.task
39 43 data = _.reject(data, (e) -> e.task == taskName)
40 44 tasks.trigger 'update'

0 comments on commit 9cd2f5c

Please sign in to comment.
Something went wrong with that request. Please try again.