Skip to content

Instantly share code, notes, and snippets.

@jdcauley
Last active August 29, 2015 14:12
Show Gist options
  • Save jdcauley/86bd6ab214b7772d700c to your computer and use it in GitHub Desktop.
Save jdcauley/86bd6ab214b7772d700c to your computer and use it in GitHub Desktop.
updated
var App = Ember.Application.create({
rootElement: '#ember-app'
});
App.Store = DS.Store.extend();
App.ApplicationAdapter = DS.RESTAdapter.extend();
DS.RESTAdapter.reopen({
namespace: 'api'
});
App.Router.map(function(){
this.resource('listing', { path: '/'});
// this.resource('nextTwelve', {path: '/'})
});
App.ListingController = Ember.ArrayController.extend({
sortProperties: ['id'],
sortAscending: false,
firstLoad: function(){
return this.store.all('listing');
}.property(),
actions: {
nextTwelve: function(){
var offset = $('.ember-listing').length;
this.store.find('listing', {count: 12, offset: 12});
}
}
});
App.ListingRoute = Ember.Route.extend({
model: function() {
return this.store.find('listing', {count: 12});
},
setupController: function(controller, model) {
this._super(controller, model);
},
});
App.Listing = DS.Model.extend({
sid: DS.attr('string'),
url: DS.attr('string'),
image: DS.attr('string'),
name: DS.attr('string'),
address: DS.attr('string'),
city: DS.attr('string'),
state: DS.attr('string'),
zip: DS.attr('string'),
market: DS.attr('string')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment