Browse files

Adding stateManger, template and images.

  • Loading branch information...
1 parent e44d16f commit 9bdda1058f0831138067d00b59e0ed2f764b65d0 @joachimhs committed Feb 5, 2012
View
4 src/main/webapp/app/app.js
@@ -2,4 +2,6 @@ EME = Ember.Application.create({
ready: function() {
this._super();
}
-});
+});
+
+EME.store = DS.Store.create();
View
12 src/main/webapp/app/fixtureData.js
@@ -0,0 +1,12 @@
+EME.generateImages = function() {
+ EME.store.createRecord(EME.Photo, { id: "1", imageTitle: 'Bird', imageUrl: 'img/bird.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "2", imageTitle: 'Dragonfly', imageUrl: 'img/dragonfly.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "3", imageTitle: 'Fly', imageUrl: 'img/fly.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "4", imageTitle: 'Frog', imageUrl: 'img/frog.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "5", imageTitle: 'Lizard', imageUrl: 'img/lizard.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "6", imageTitle: 'Mountain 1', imageUrl: 'img/mountain.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "7", imageTitle: 'Mountain 2', imageUrl: 'img/mountain2.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "8", imageTitle: 'Parnorama', imageUrl: 'img/panorama.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "9", imageTitle: 'Sheep', imageUrl: 'img/sheep.jpg'});
+ EME.store.createRecord(EME.Photo, { id: "10", imageTitle: 'Waterfall', imageUrl: 'img/waterfall.jpg'});
+}
View
15 src/main/webapp/app/main.js
@@ -0,0 +1,15 @@
+EME.Photo = DS.Model.extend({
+ primaryKey: 'id',
+ id: DS.attr('string'),
+ photoTitle: DS.attr('string'),
+ photoUrl: DS.attr('string')
+});
+
+EME.PhotoListController = Em.ArrayProxy.create({
+ content: [],
+ selected: null
+});
+
+EME.SelectedPhotoController = Em.Object.create({
+ contentBinding: 'EME.PhotoListController.selected'
+});
View
24 src/main/webapp/app/stateManager.js
@@ -0,0 +1,24 @@
+setTimeout(function() {
+ EME.generateImages();
+
+ EME.stateManager = Ember.StateManager.create({
+ rootElement: '#mainArea',
+ initialState: 'showPhotoView',
+
+ showPhotoView: Ember.ViewState.create({
+ enter: function(stateManager) {
+ this._super(stateManager);
+ EME.PhotoListController.set('content', EME.store.findAll(EME.Photo));
+ },
+
+ view: Em.ContainerView.create({
+ childViews: ['photoListView'],
+
+ photoListView: Em.View.extend({
+
+ })
+ })
+ })
+ });
+
+}, 50);
View
BIN src/main/webapp/img/bird.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/dragonfly.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/fly.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/frog.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/lizard.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/mountain.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/mountain2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/panorama.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/sheep.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/main/webapp/img/waterfall.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
7 src/main/webapp/index.html
@@ -19,6 +19,13 @@
<script src="app/fixtureData.js" type="text/javascript" charset="utf-8"></script>
<script src="app/stateManager.js" type="text/javascript" charset="utf-8"></script>
+ <script type="text/x-handlebars" data-template-name="photo-view-list">
+ {{#each content}}
+ <div class="thumbnailItem">
+ <img {{bindAttr src="imageUrl"}} style="width: 100%; height: 100%;"/>
+ </div>
+ {{/each}}
+ </script>
</head>
<body bgcolor="#555154">
<div id="mainArea">

0 comments on commit 9bdda10

Please sign in to comment.