Skip to content

Commit

Permalink
Adding stateManger, template and images.
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimhs committed Feb 5, 2012
1 parent e44d16f commit 9bdda10
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/webapp/app/app.js
Expand Up @@ -2,4 +2,6 @@ EME = Ember.Application.create({
ready: function() {
this._super();
}
});
});

EME.store = DS.Store.create();
12 changes: 12 additions & 0 deletions 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'});
}
15 changes: 15 additions & 0 deletions 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'
});
24 changes: 24 additions & 0 deletions 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);
Binary file added 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.
Binary file added 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.
Binary file added 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.
Binary file added 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.
Binary file added 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.
Binary file added 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.
Binary file added 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.
Binary file added 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.
Binary file added 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.
Binary file added 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.
7 changes: 7 additions & 0 deletions src/main/webapp/index.html
Expand Up @@ -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">
Expand Down

0 comments on commit 9bdda10

Please sign in to comment.