Created
November 26, 2014 02:05
-
-
Save mplatts/261449f1663b2bbb9790 to your computer and use it in GitHub Desktop.
templates2 - 2
This file contains hidden or 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
# server/fixtures.coffee | |
if Teams.find().count() == 0 | |
_([ | |
{name: 'Barcelona'} | |
{name: 'Manchester City'} | |
]).each (data) -> Teams.insert(data) | |
if Games.find().count() == 0 | |
game = { | |
completed: false | |
created_at: new Date | |
teams: [ | |
{name: 'Barcelona', id: "1", score: 0} | |
{name: 'Manchester City', id: "2", score: 0} | |
] | |
} | |
Games.insert(game) |
This file contains hidden or 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
<!-- client/views/game.html --> | |
<template name="game"> | |
<li> | |
{{teams.[0].name}} | |
vs | |
{{teams.[1].name}} | |
</li> | |
</template> |
This file contains hidden or 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
<!-- client/views/games.html --> | |
<template name="games"> | |
<h3>Games</h3> | |
<ul> | |
{{#each games}} | |
{{> game}} | |
{{/each}} | |
</ul> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment