Skip to content

Instantly share code, notes, and snippets.

@svasva
Last active December 14, 2015 02:28
Show Gist options
  • Save svasva/5013448 to your computer and use it in GitHub Desktop.
Save svasva/5013448 to your computer and use it in GitHub Desktop.
<template name='loadingWrapper'>
{{#if loading}}
<i class="icon-refresh icon-spin"></i>
Loading...
{{else}}
<div class="span9">
{{renderPage}}
</div>
{{> sidebar }}
{{/if}}
</template>
Meteor.autorun ->
loaded = -> Session.set 'loading', false
Session.set 'loading', true
switch Meteor.Router.page()
when 'bikes'
Meteor.subscribe 'bikes-count'
Meteor.subscribe 'bikes', {}, Session.get('page'), loaded
when 'showBike'
Meteor.subscribe 'bike', Session.get('bikeId'), loaded
when 'messageDialog'
Meteor.subscribe 'messages', Session.get('userId'), loaded
when 'userProfile'
Meteor.subscribe 'user', Session.get('userId'), loaded
when 'partsCatalog'
Meteor.subscribe 'parts_catalog', loaded
else loaded()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment