Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save handebc/d88e8e6402b6a437746f3adb5cab85f0 to your computer and use it in GitHub Desktop.
Save handebc/d88e8e6402b6a437746f3adb5cab85f0 to your computer and use it in GitHub Desktop.
img-app
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
/*
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
export default Model.extend({
id: attr(),
image: attr()
});
*/
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('index', {path:'/'});
this.route('pic', {path:'/pic/:id'});
});
export default Router;
import Ember from 'ember';
var pics = [{
id: 1,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'aaaaaaaaaaaaa'
}, {
id: 2,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'bbbbbbbbbbbbb'
}, {
id: 3,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'ccccccccccc'
},{
id: 4,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'ddddddddddd'
},{
id: 5,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'eeeeeeeeeeeeeee'
},{
id: 6,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'fffffffffffffffffff'
},{
id: 7,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'gggggggggggggggg'
},{
id: 8,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'hhhhhhhhhhhhhhhh'
},{
id: 9,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'iiiiiiiiiiiiiiii'
},{
id: 10,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'jjjjjjjjjjjjjjjjjj'
},{
id: 11,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'kkkkkkkkkkkkk'
},{
id: 12,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'lllllllllllll'
},{
id: 13,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'mmmmmmmmmmmmm'
},{
id: 14,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'nnnnnnnnnnnnnnnn'
},{
id: 15,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'ooooooooooooooooo'
},{
id: 16,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'pppppppppppppppp'
},{
id: 17,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'rrrrrrrrrrrrrrrrrrr'
},{
id: 18,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'sssssssssssss'
},{
id: 19,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'ttttttttttttttttt'
},{
id: 20,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'uuuuuuuuuuuu'
},{
id: 21,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'vvvvvvvvvvvvvvv'
},{
id: 22,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'yyyyyyyyyyyyyyyyy'
},{
id: 23,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'zzzzzzzzzzzz'
},{
id: 24,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'xxxxxxxxxxxx'
},{
id: 25,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'wwwwwwwwwwwww'
},{
id: 26,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'qqqqqqqqqqqq'
},{
id: 27,
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg',
detail : 'wwwwwww'
},{
id: 28,
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg',
detail : 'zzzzzzzzzzzz'
},{
id: 29,
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg',
detail : 'cccccccccccc'
}];
export default Ember.Route.extend({
model() {
return pics;
}
});
import Ember from 'ember';
export default Ember.Route.extend({
activate: function() {
this._super();
window.scrollTo(0,0);
},
model(params) {
console.info(params, "Params");
}
});
{{outlet}}
{{#each model as |pic|}}
<div>{{#link-to "pic" pic}}
{{ log "pic is" pic }}
<img src={{pic.image}} width="300">
{{/link-to}}</div>
{{/each}}
<p class= "back">{{#link-to 'index'}}Geri Git{{/link-to}}</p>
<p class=detail><img src="{{ model.image }}" width="1000" ></p>
<p class="info">
You are lookng at pic {{ model.id }}.
<br/><br/>
{{model.detail}}
</p>
<p class= "back">{{#link-to 'index'}}Geri Git{{/link-to}}</p>
{{outlet}}
{
"version": "0.8.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment