Created
September 9, 2013 19:39
-
-
Save sgonyea/6500439 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global Ember*/ | |
/*global Todos*/ | |
// For more information see: http://emberjs.com/guides/routing/ | |
Todos.Router.map(function () { | |
this.resource('todos', { path: '/' }, function () { | |
this.route('active'); | |
this.route('completed'); | |
}); | |
}); | |
Todos.TodosRoute = Ember.Route.extend({ | |
model: function () { | |
return this.store.find('todo'); | |
} | |
}); | |
Todos.TodosIndexRoute = Ember.Route.extend({ | |
model: function () { | |
return this.modelFor('todos'); | |
} | |
}); | |
Todos.TodosActiveRoute = Ember.Route.extend({ | |
model: function () { | |
return Todos.Todo.filter(function (todo) { | |
return !todo.get('isCompleted'); | |
}); | |
}, | |
renderTemplate: function (controller) { | |
this.render('todos/index', {controller:controller}); | |
} | |
}); | |
Todos.TodosCompletedRoute = Ember.Route.extend({ | |
model: function () { | |
return Todos.Todo.filter(function (todo) { | |
return todo.get('isCompleted'); | |
}); | |
}, | |
renderTemplate: function (controller) { | |
this.render('todos/index', {controller:controller}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for more details see: http://emberjs.com/guides/models/defining-models/ | |
Todos.Todo = DS.Model.extend({ | |
title: DS.attr('string'), | |
isCompleted: DS.attr('boolean') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment