Last active
August 29, 2015 14:12
-
-
Save jdcauley/86bd6ab214b7772d700c to your computer and use it in GitHub Desktop.
updated
This file contains hidden or 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
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