Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fetching the photos from the photos file.

  • Loading branch information...
commit 9b1bc44cd16c152e5ce6b8c86d42257261f8109a 1 parent d154a2c
@joachimhs authored
View
19 src/main/webapp/app/app.js
@@ -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
+});
+
+
View
8 src/main/webapp/app/main.js
@@ -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({
View
1  src/main/webapp/app/stateManager.js
@@ -1,5 +1,4 @@
setTimeout(function() {
- EME.generateImages();
EME.stateManager = Ember.StateManager.create({
rootElement: '#mainArea',
Please sign in to comment.
Something went wrong with that request. Please try again.