Created
July 30, 2014 00:41
-
-
Save agconti/0dae8f577120dafdb20e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Put your CSS here */ | |
html, body { | |
margin: 20px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Color Vault" /> | |
<meta charset="utf-8"> | |
<title>Color Vault</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script> | |
<script src="http://builds.emberjs.com/tags/v1.6.1/ember.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.0.0-beta.8/ember-data.min.js"></script> | |
</head> | |
<body> | |
<script type="text/x-handlebars" data-template-name="application"> | |
<h2>Color Vault</h2> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
<p>Wanna see some cool {{#link-to "colors"}}colors?{{/link-to}}</p> | |
</script> | |
<script type="text/x-handlebars" data-template-name="colors"> | |
<h1>The Colors LUKE!</h1> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="colors/index"> | |
<ul> | |
{{#each item in model}} | |
<li>{{#link-to "color" item}}{{item.color}}{{/link-to}}</li> | |
{{/each}} | |
</ul> | |
</script> | |
<script type="text/x-handlebars" data-template-name="color"> | |
<h1>Lots more info about {{model.color}}</h1> | |
<p>Its {{model.color}} what else do you need to know?</p> | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App = Ember.Application.create({ | |
LOG_TRANSITIONS: true | |
}); | |
App.ApplicationAdapter = DS.FixtureAdapter.extend(); | |
App.Color = DS.Model.extend({ | |
color: DS.attr( 'string' ) | |
}); | |
App.Color.FIXTURES = [ | |
{id: 1, color:"red"}, | |
{id: 2, color:"yellow"}, | |
{id: 3, color:"blue"}, | |
]; | |
App.Router.map(function() { | |
this.resource("colors", function(){ | |
this.resource("color", {path: "/:colors_id"}, function() {}); | |
}); | |
}); | |
App.ColorsRoute = Ember.Route.extend({ | |
model: function() { | |
return this.store.findAll('color'); | |
} | |
}); | |
App.ColorRoute = Ember.Route.extend({ | |
model: function(params) { | |
console.log(params); | |
return this.store.findBy("color", params.colors_id); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment