Skip to content

Instantly share code, notes, and snippets.

@tmeasday
Created May 17, 2012 06:02
Show Gist options
  • Save tmeasday/2716855 to your computer and use it in GitHub Desktop.
Save tmeasday/2716855 to your computer and use it in GitHub Desktop.
Template code that triggers meteor #142
<head>
<title>Sport Grid</title>
</head>
<body>
{{> screens }}
</body>
<template name="screens">
<div class="container {{ visible_page }}">
<h1>Showing page: {{ visible_page }}</h1>
{{> home }}
{{> teams }}
</div>
</template>
<template name="home">
<div class="home">
<form class="create_team">
<input name="team[name]" placeholder="Your team name"></input>
</form>
</div>
</template>
<template name="teams">
<div class="teams">
{{> team_builder }}
</div>
</template>
<template name="team_builder">
<form class="team_builder">
<input name="team[name]" placeholder="Team name"></input>
</form>
</template>
if (Meteor.is_client) {
Session.set('visible_page', 'first');
Template.screens.visible_page = function() { return Session.get('visible_page') || 'home'; }
Meteor.startup(function() {
setTimeout(function() {
Session.set('visible_page', 'second')
}, 500);
setTimeout(function() {
Session.set('visible_page', 'third')
}, 1000);
})
}
@tmeasday
Copy link
Author

Thanks for the tip! I'll remember that.. My original code didn't use timeouts however, I was just trying to simulate the behaviour of the Facebook API I was using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment