Permalink
Browse files

Fetching the photos from the photos file.

  • Loading branch information...
joachimhs committed Feb 8, 2012
1 parent d154a2c commit 9b1bc44cd16c152e5ce6b8c86d42257261f8109a
Showing with 24 additions and 4 deletions.
  1. +18 −1 src/main/webapp/app/app.js
  2. +6 −2 src/main/webapp/app/main.js
  3. +0 −1 src/main/webapp/app/stateManager.js
View
@@ -4,4 +4,21 @@ EME = Ember.Application.create({
}
});
-EME.store = DS.Store.create();
+EME.Adapter = DS.Adapter.create({
+ findAll: function(store, type) {
+ var url = type.url;
+
+ jQuery.getJSON(url, function(data) {
+ // data is a Hash of key/value pairs. If your server returns a
+ // root, simply do something like:
+ // store.load(type, id, data.person)
+ store.loadMany(type, data);
+ });
+ }
+});
+
+EME.store = DS.Store.create({
+ adapter: EME.Adapter
+});
+
+
@@ -1,8 +1,12 @@
EME.Photo = DS.Model.extend({
primaryKey: 'id',
id: DS.attr('string'),
- photoTitle: DS.attr('string'),
- photoUrl: DS.attr('string')
+ imageTitle: DS.attr('string'),
+ imageUrl: DS.attr('string')
+});
+
+EME.Photo.reopenClass({
+ url: 'photos'
});
EME.PhotoListController = Em.ArrayProxy.create({
@@ -1,5 +1,4 @@
setTimeout(function() {
- EME.generateImages();
EME.stateManager = Ember.StateManager.create({
rootElement: '#mainArea',

0 comments on commit 9b1bc44

Please sign in to comment.