Skip to content

Commit 5f9b61b

Browse files
author
Evan You
committed
make todomvc example work with new exp splitter
1 parent c12f7ab commit 5f9b61b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

examples/todomvc/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ <h1>todos</h1>
2828
<li
2929
class="todo"
3030
sd-repeat="todo:todos"
31-
sd-if="todoFilter(todo)"
32-
sd-class="completed:todo.completed, editing:todo == editedTodo"
31+
sd-if="todoFilter(todo.completed)"
32+
sd-class="completed:todo.completed & editing:todo == editedTodo"
3333
>
3434
<div class="view">
3535
<input
@@ -44,7 +44,7 @@ <h1>todos</h1>
4444
<input
4545
class="edit"
4646
type="text"
47-
sd-on="blur:doneEdit, keyup:doneEdit | key enter, keyup:cancelEdit | key esc"
47+
sd-on="blur:doneEdit & keyup:doneEdit | key enter & keyup:cancelEdit | key esc"
4848
sd-model="todo.title"
4949
sd-todo-focus="todo == editedTodo"
5050
>

examples/todomvc/js/app.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var filters = {
2-
all: function (todo) { return todo.completed || true },
3-
active: function (todo) { return !todo.completed },
4-
completed: function (todo) { return todo.completed }
2+
all: function () { return true },
3+
active: function (completed) { return !completed },
4+
completed: function (completed) { return completed }
55
}
66

77
Seed.directive('todo-focus', function (value) {
@@ -16,8 +16,10 @@ var app = new Seed({
1616
el: '#todoapp',
1717

1818
init: function () {
19-
this.remaining = this.todos.filter(filters.active).length
2019
this.updateFilter()
20+
this.remaining = this.todos.filter(function (todo) {
21+
return !todo.completed
22+
}).length
2123
},
2224

2325
scope: {
@@ -70,7 +72,9 @@ var app = new Seed({
7072
},
7173

7274
removeCompleted: function () {
73-
this.todos.mutateFilter(filters.active)
75+
this.todos.mutateFilter(function (todo) {
76+
return !todo.completed
77+
})
7478
todoStorage.save()
7579
},
7680

0 commit comments

Comments
 (0)