Skip to content

Instantly share code, notes, and snippets.

@cmosguy
Created June 9, 2014 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmosguy/7f7ae7f10b9e5756b23b to your computer and use it in GitHub Desktop.
Save cmosguy/7f7ae7f10b9e5756b23b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script type="text/x-handlebars" data-template-name="game">
($game->game_status == 'live')
<div class="row">
<div class="col-md-1">
<span class="muted">Clock: {{game.gameclock}}</span>
</div>
</div>
<div class="row">
<div class="col-md-1">
<img class="thumbnail" src="http://placehold.it/60x60" alt="">
</div>
<div class="col-md-3">
<span class="muted">{{{ $game->away()->first()->team }}}</span>
&bull;
{{{ $game->away_score }}}
</div>
<div class="col-md-1">
<img class="thumbnail" src="http://placehold.it/60x60" alt="">
</div>
<div class="col-md-3">
<span class="muted">{{{ $game->home()->first()->team }}}</span>
&bull;
{{{ $game->home_score }}}
</div>
</div>
</script>
</body>
</html>
var App = Ember.Application.create();
App.Router.map(function () {
this.resource("game", {
"path": "/"
});
});
App.ApplicationAdapter = DS.FixtureAdapter.extend();
App.Game = DS.Model.extend({
//"id": DS.attr("integer"),
away_score: DS.attr("integer"),
home_score: DS.attr("integer"),
gameclock: DS.attr("string"),
game: DS.attr("string"),
game_status: DS.attr("string")
});
App.Game.FIXTURES = [
{
id: 1,
away_score: 10,
home_score: 20,
gameclock: "6:66",
game: "test game.",
game_status : "live"
}
// {
// "id" : 2,
// "user" : "Wayne",
// "text" : "Don't dig it, man."
// },
// {
// "id" : 3,
// "user" : "Chris",
// "text" : "Meh."
// }
];
var store;
App.GameRoute = Ember.Route.extend({
model : function () {
return this.store.find("game", 1);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment