Skip to content

Commit

Permalink
Indicate when all todos are complete
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislopresto committed Mar 12, 2015
1 parent 3b58db0 commit da7b50e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/controllers/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export default Ember.ArrayController.extend({
}
},

allAreDone: function(key, value) {
return !!this.get('length') && this.isEvery('isCompleted');
}.property('@each.isCompleted'),

hasCompleted: function() {
return this.get('completed') > 0;
}.property('completed'),
Expand Down
3 changes: 1 addition & 2 deletions app/templates/todos.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

<section id="main">
{{outlet}}

<input type="checkbox" id="toggle-all">
{{input type="checkbox" id="toggle-all" checked=allAreDone}}
</section>

<footer id="footer">
Expand Down

0 comments on commit da7b50e

Please sign in to comment.