Commit 51c5f640 authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #444 from passy/canjs-remaining

canjs_require: Fixed remaining item count
parents 4f72c6e6 ce54b52b
......@@ -16,8 +16,8 @@ require(['can/util/library', 'can/route', 'app/todos', 'app/models/todo', 'can/v
route.ready(false);
// View helper for pluralizing strings
can.Mustache.registerHelper('plural', function (str, count) {
return str + (count !== 1 ? 's' : '');
can.Mustache.registerHelper('todoPlural', function (str, attr) {
return str + (attr.call(this.todos) !== 1 ? 's' : '');
});
// Find all Todos
......
......@@ -22,7 +22,7 @@
<footer id="footer" class="{{^todos}}hidden{{/todos}}">
<span id="todo-count">
<strong>{{todos.remaining}}</strong> {{plural "item" todos.remaining}} left
<strong>{{todos.remaining}}</strong> {{todoPlural "item" todos.remaining}} left
</span>
<ul id="filters">
<li><a class="selected" href="#!">All</a></li>
......
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