File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ <h1>todos</h1>
28
28
< li
29
29
class ="todo "
30
30
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 "
33
33
>
34
34
< div class ="view ">
35
35
< input
@@ -44,7 +44,7 @@ <h1>todos</h1>
44
44
< input
45
45
class ="edit "
46
46
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 "
48
48
sd-model ="todo.title "
49
49
sd-todo-focus ="todo == editedTodo "
50
50
>
Original file line number Diff line number Diff line change 1
1
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 }
5
5
}
6
6
7
7
Seed . directive ( 'todo-focus' , function ( value ) {
@@ -16,8 +16,10 @@ var app = new Seed({
16
16
el : '#todoapp' ,
17
17
18
18
init : function ( ) {
19
- this . remaining = this . todos . filter ( filters . active ) . length
20
19
this . updateFilter ( )
20
+ this . remaining = this . todos . filter ( function ( todo ) {
21
+ return ! todo . completed
22
+ } ) . length
21
23
} ,
22
24
23
25
scope : {
@@ -70,7 +72,9 @@ var app = new Seed({
70
72
} ,
71
73
72
74
removeCompleted : function ( ) {
73
- this . todos . mutateFilter ( filters . active )
75
+ this . todos . mutateFilter ( function ( todo ) {
76
+ return ! todo . completed
77
+ } )
74
78
todoStorage . save ( )
75
79
} ,
76
80
You can’t perform that action at this time.
0 commit comments