Skip to content

Instantly share code, notes, and snippets.

@remcoder
Last active August 29, 2015 14:14
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 remcoder/1132544b72c4d83a7ec3 to your computer and use it in GitHub Desktop.
Save remcoder/1132544b72c4d83a7ec3 to your computer and use it in GitHub Desktop.
DemocratieLAB Welcome Screen Updates reactively
Classes = new Mongo.Collection(‘classes’);
Classes.insert({
location: "Aa en Hunze",
schoolType: "Basisonderwijs",
route: "42",
active: true
});
<button data-action=continue
class="fade {{#if activeClass}}visible{{/if}}">ga verder
</button>
Template.player_welcome.helpers({
activeClass : function() {
// this is where the magic happens: whenever the result of this 'livequery' changes,
// the surrounding helper function is re-run automatically
return Classes.findOne({ active:true });
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment