Skip to content

Instantly share code, notes, and snippets.

@altrim
Created June 19, 2016 22:14
Show Gist options
  • Save altrim/e1257c2778df8eb46168da67b02ab13c to your computer and use it in GitHub Desktop.
Save altrim/e1257c2778df8eb46168da67b02ab13c to your computer and use it in GitHub Desktop.
Fixtures
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
export default [{
id: "1",
artwork: "images/the-morning-after.jpg",
name: "The Morning After",
artist: "GOLDHOUSE",
isExplicit: false,
songs: [ "11", "12", "13", "14" ]
}, {
id: "2",
artwork: "images/dusk-to-dawn.jpg",
name: "Dusk to Dawn",
artist: "Emancipator",
isExplicit: false,
songs: [ "21", "22", "23", "24" ]
}, {
id: "3",
artwork: "images/the-heist.jpg",
name: "The Heist",
artist: "Macklemore & Ryan Lewis",
isExplicit: true,
songs: [ "31", "32", "33", "34" ]
}, {
id: "4",
artwork: "images/some-nights.jpg",
name: "Some Nights",
artist: "fun.",
isExplicit: true,
songs: [ "41", "42", "43", "44" ]
}];
import Ember from 'ember';
import albums from '../models/album-fixtures';
export default Ember.Route.extend({
model() {
return albums;
}
});
<h1>Welcome to {{appName}}</h1>
<br>
{{#each model as |album|}}
<div class="album">
<a class="ember-view" href="/album/1">
<img src="{{album.artwork}}">
</a>
<p class="album-name">{{album.name}}</p>
<p class="album-artist">{{album.artist}}</p>
<p class="song-count">{{album.songs}}</p>
</div>
{{/each}}
<br>
{{outlet}}
<br>
<br>
{
"version": "0.9.3",
"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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment