Skip to content

Instantly share code, notes, and snippets.

@pzuraq
Created January 28, 2013 17:53
Show Gist options
  • Save pzuraq/4657606 to your computer and use it in GitHub Desktop.
Save pzuraq/4657606 to your computer and use it in GitHub Desktop.
/*global App*/
window.App = Ember.Application.create();
// Router
App.Router.map(function() {
this.resource('inventory', function(){
this.route('review');
this.resource('vehicle', { path: '/vehicle/:stock_no' }, function(){
this.route('details');
});
});
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo('inventory');
}
});
App.InventoryRoute = Ember.Route.extend({
model: function() {
return App.Vehicle.all();
}
});
App.InventoryReviewRoute = Ember.Route.extend({
model: function() {
return App.Vehicle.find();
}
});
App.VehicleRoute = Ember.Route.extend({
setupController: function() {
controller.set('active', true);
}
})
//Controllers
App.InventoryController = Ember.ArrayController.extend({
active: function() {
return this.content.filterProperty('active', true);
}.property('content.@each.active').cacheable()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment