Commit 8a023841 authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #750 from jondalberg/gh-pages

batman.js - fix the index view to render contents correctly
parents 2a8f8423 1ac0775b
...@@ -11,7 +11,7 @@ class Alfred.TodosController extends Batman.Controller ...@@ -11,7 +11,7 @@ class Alfred.TodosController extends Batman.Controller
routingKey: 'todos' routingKey: 'todos'
index: -> index: ->
@set('currentTodoSet', 'all') @set('currentTodoSet', 'default')
completed: -> completed: ->
@set 'currentTodoSet', 'completed' @set 'currentTodoSet', 'completed'
...@@ -79,6 +79,9 @@ class Alfred.Todo extends Batman.Model ...@@ -79,6 +79,9 @@ class Alfred.Todo extends Batman.Model
@encode 'title', 'completed' @encode 'title', 'completed'
@validate 'title', presence: true @validate 'title', presence: true
@classAccessor 'default', ->
@get('all').filter (todo) -> true
@classAccessor 'active', -> @classAccessor 'active', ->
@get('all').filter (todo) -> !todo.get('completed') @get('all').filter (todo) -> !todo.get('completed')
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
TodosController.prototype.routingKey = 'todos'; TodosController.prototype.routingKey = 'todos';
TodosController.prototype.index = function() { TodosController.prototype.index = function() {
return this.set('currentTodoSet', 'all'); return this.set('currentTodoSet', 'default');
}; };
TodosController.prototype.completed = function() { TodosController.prototype.completed = function() {
...@@ -184,6 +184,12 @@ ...@@ -184,6 +184,12 @@
presence: true presence: true
}); });
Todo.classAccessor('default', function() {
return this.get('all').filter(function(todo) {
return true;
});
});
Todo.classAccessor('active', function() { Todo.classAccessor('active', function() {
return this.get('all').filter(function(todo) { return this.get('all').filter(function(todo) {
return !todo.get('completed'); return !todo.get('completed');
......
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