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>
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 >
Original file line number Diff line number Diff line change 11var 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
77Seed . 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
You can’t perform that action at this time.
0 commit comments