Skip to content

Instantly share code, notes, and snippets.

@kuon
Created January 26, 2011 21:40
Show Gist options
  • Save kuon/797534 to your computer and use it in GitHub Desktop.
Save kuon/797534 to your computer and use it in GitHub Desktop.
Accounting = SC.Application.create(
NAMESPACE: 'Accounting',
VERSION: '0.1.0',
store: SC.Store.create(),
currentPage:'Accounting.invoices.mainView',
loadInvoices:function() {
SC.Request.getUrl('/invoices.json').json()
.notify(this, '_invoicesLoaded')
.send();
},
_invoicesLoaded:function(response) {
if(SC.ok(response)) {
response.get('body').forEach(function(rec) {
Accounting.store.pushRetrieve(Accounting.Invoice, rec.id, rec);
});
Accounting.invoicesController.set('content', Accounting.store.find(Accounting.Invoice));
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment