Commit 85c49e18 authored by Addy Osmani's avatar Addy Osmani

Merge pull request #46 from boushley/emberjs

Ember.js Clear Completed Tasks Update
parents 495a9aac 9a4f81c7
......@@ -249,7 +249,7 @@ body {
margin: 0 10px 0 7px;
float: left;
}
#todo-list .done .todo-content {
#todo-list .is-done label {
text-decoration: line-through;
color: #777777;
}
......@@ -396,6 +396,10 @@ body {
border:0px;
}
#todoapp #todo-stats button.none-completed {
display: none;
}
/* line 136 */
#todoapp #todo-stats button:hover, #todoapp #todo-stats button:focus {
background: rgba(0, 0, 0, 0.15);
......
......@@ -45,14 +45,13 @@
{{#view id="todos"}}
{{#collection id="todo-list" contentBinding="Todos.todosController" tagName="ul" itemClassBinding="content.isDone"}}
{{view Ember.Checkbox titleBinding="content.title"
valueBinding="content.isDone"}}
{{view Ember.Checkbox titleBinding="content.title" valueBinding="content.isDone"}}
{{/collection}}
{{/view}}
<!-- Insert this after the CreateTodoView and before the collection. -->
{{#view Todos.StatsView id="todo-stats"}}
{{#view Ember.Button target="Todos.todosController" action="clearCompletedTodos" content=this}}
{{#view Todos.StatsView id="todo-stats" content=this}}
{{#view Ember.Button target="Todos.todosController" action="clearCompletedTodos" classNameBindings="Todos.todosController.completeClass" content=this}}
Clear {{content.completedString}}
{{/view}}
{{remainingString}} left
......
......@@ -52,6 +52,10 @@ Todos.todosController = Ember.ArrayProxy.create({
} else {
return !!this.get('length') && this.everyProperty('isDone', true);
}
}.property('@each.isDone'),
completeClass: function () {
return this.get('completed') < 1 ? 'none-completed' : 'some-completed';
}.property('@each.isDone')
});
......@@ -155,7 +159,5 @@ Todos.TodoStore = (function () {
items = [todo];
}
Todos.todosController.arrayContentWillChange(0, 0, items.length);
Todos.todosController.set('[]', items);
Todos.todosController.arrayContentDidChange(0, 0, items.length);
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment