Commit 3b725068 authored by Aaron Boushley's avatar Aaron Boushley

Got the binding for the clear completed visibility figured out using a global binding.

parent 2326f6bc
......@@ -50,8 +50,8 @@
{{/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')
});
......@@ -66,10 +70,7 @@ Todos.StatsView = Ember.View.extend({
completedString: function() {
var completed = this.get('completed');
return completed + " completed" + (completed === 1 ? " item" : " items");
}.property('completed'),
updateCompletedButton: function () {
$('#todo-stats button').toggleClass('none-completed', this.get('completed') < 1);
}.observes('completed')
}.property('completed')
});
Todos.CreateTodoView = Ember.TextField.extend({
......
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