Commit aae4616f authored by Christoph Burgdorf's avatar Christoph Burgdorf

bound "clear x completed todos" text

parent 0829793d
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</ul> </ul>
</section> </section>
<footer ng:show="hasTodos()"> <footer ng:show="hasTodos()">
<a id="clear-completed">Clear completed</a> <a id="clear-completed" ng:show="hasFinishedTodos()">{{ clearItemsText() }}</a>
<div id="todo-count"><b>{{ remainingTodos() }}</b> {{ itemsLeftText() }}</div> <div id="todo-count"><b>{{ remainingTodos() }}</b> {{ itemsLeftText() }}</div>
</footer> </footer>
</div> </div>
......
...@@ -51,9 +51,14 @@ App.Controllers.TodoController = function () { ...@@ -51,9 +51,14 @@ App.Controllers.TodoController = function () {
self.finishedTodos = countTodos("done"); self.finishedTodos = countTodos("done");
self.itemsLeftText = function(){ self.itemsLeftText = function(){
return pluralize(self.remainingTodos(), 'item' ) + ' left' return pluralize(self.remainingTodos(), 'item') + ' left'
}; };
self.clearItemsText = function(){
var finishedTodos = finishedTodos();
return 'Clear ' + finishedTodos + ' completed ' + pluralize(finishedTodos, 'item');
}
self.clearCompletedItems = function() { self.clearCompletedItems = function() {
var oldTodos = self.todos; var oldTodos = self.todos;
self.todos = []; self.todos = [];
......
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