Ember-data numbers
Why are my filters not showing any numbers?
HTML
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-latest.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/data/ember-data-latest.js"></script>
<script type="text/x-handlebars" data-template-name="application">
<header>
<h1>Filter data</h1>
</header>
{{outlet}}
<footer></footer>
</script>
<script type="text/x-handlebars" data-template-name="home">
<ul>
{{#each filter in controller}}
<li>{{filter.title}}, ({{filter.slug}}): {{filter.thumbnailUrl}} ({{filter.thumbnailWidth}} x {{filter.thumbnailHeight}})</li>
{{/each}}
</ul>
</script>
CSS
header h1 {
width: 100%; height: 40px; line-height: 40px; text-align: center;
}
header nav {
width: 100%; text-align: center;
}
a {
color: #008Bff; cursor: pointer; text-decoration: underline;
}
p {
padding: 20px;
}
JavaScript
Sylvius = Ember.Application.create();
Sylvius.Filter = DS.Model.extend({
title: DS.attr('string'),
slug: DS.attr('string'),
// Belongs to Atlas
// atlas: DS.belongsTo('Sylvius.Atlas'),
// Has images
// images: DS.hasMany('Sylvius.Image'),
// May have AtlasExtras
// extras: DS.hasMany('Sylvius.AtlasExtra'),
// Structures for this filter
// structures: DS.hasMany('Sylvius.Structure'),
// This is the path to the thumbnails sprite.
// Each image will have an index on this sprite
thumbnailUrl: DS.attr('string'),
// How big is each thumbnail?
thumbnailHeight: DS.attr('number'),
thumbnailWidth: DS.attr('number'),
// How big are the images? This will designate how far we need to move the sprites around.
imageHeight: DS.attr('number'),
// which image is selected?
// selectedImage: DS.belongsTo('Sylvius.Image'),
// Correct the slug if the title changes
fixSlug: function() {
this.set('slug', this.get('title').dasherize());
}.property('title'),
path: function() {
return [this.getPath('atlas.path'), this.get('slug')].join('/');
}.property('title')
});
Sylvius.Filter.FIXTURES = [{
"id": 1,
"title": "Dummy Title",
"slug": "dummy-title",
"thumbnail_url": "path/to/thumbnail.gif",
"thumbnail_width": 100,
"thumbnail_height": 75,
"atlas_id": 1,
"images": [1, 2, 3, 4, 5, 6, 7],
"structures": [0]
};
Sylvius.store = DS.Store.create({
revision: 4,
adapter: DS.fixtureAdapter
});
Sylvius.ApplicationController = Em.Controller.extend();
Sylvius.ApplicationView = Em.View.extend({
templateName: 'application'
});
// For the "atlas launcher" box on the home page and the panel
Sylvius.HomeController = Em.ArrayController.extend({
content: Sylvius.store.findAll(Sylvius.Filter)
});
Sylvius.HomeView = Em.View.extend({
templateName: 'home'
});
Sylvius.Router = Em.Router.extend({
enableLogging: true,
location: 'hash',
root: Em.Route.extend({
// STATES
index:...