Skip to content

Instantly share code, notes, and snippets.

@SachaG
Created January 30, 2013 05:52
Show Gist options
  • Save SachaG/4671013 to your computer and use it in GitHub Desktop.
Save SachaG/4671013 to your computer and use it in GitHub Desktop.
// specific router functions
digest = function(year, month, day, view){
var destination = (typeof view === 'undefined') ? 'posts_digest' : 'posts_digest_'+view
var currentDate = new Date();
if (typeof day !== 'undefined') {
currentDate = new Date(year, month-1, day)
}
Session.set('currentDate', currentDate);
// we need to make sure that the session changes above have been executed
// before we can look at the digest handle. XXX: this might be a bad idea
Meteor.flush();
if (!currentDigestHandle() || currentDigestHandle().loading()) {
return 'loading';
} else {
if(!currentDigestHandle().fetch().length){
// ??????
}
return destination;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment