Vulcan/client/main.js

49 lines
1.5 KiB
JavaScript
Raw Normal View History

// Session variables
2012-12-11 10:47:11 +09:00
Session.set('initialLoad', true);
Session.set('categorySlug', null);
2013-10-12 12:24:41 +09:00
Session.set('today', new Date());
2013-10-12 13:01:16 +09:00
Session.set('view', 'top');
2012-12-11 10:47:11 +09:00
2013-10-09 22:16:47 +09:00
// Subscriptions
// note: here we only subscribe to subscriptions that we need to be available all the time.
// For subscriptions depending on specific pages, see the router.
// TODO: add session variable that tracks when all global subscriptions have loaded
2013-10-09 22:16:47 +09:00
// Settings
Meteor.subscribe('settings', function(){
2013-10-09 22:16:47 +09:00
// runs once after settings have loaded
2012-12-11 10:47:11 +09:00
analyticsInit();
2012-11-21 14:31:58 +09:00
Session.set('settingsLoaded',true);
});
// Categories
Meteor.subscribe('categories');
2013-10-09 22:16:47 +09:00
// Current User
// We need to subscribe to the currentUser subscription because by itself,
// Meteor doesn't send all the user properties that we need
2012-11-17 13:24:19 +09:00
Meteor.subscribe('currentUser');
// Notifications - only load if user is logged in
if(Meteor.user() != null)
Meteor.subscribe('notifications');
2013-10-15 12:09:19 +09:00
// Posts Lists
2013-10-24 20:30:05 +09:00
// postsSubs = {}
2013-10-15 12:09:19 +09:00
2013-10-24 20:30:05 +09:00
// postsSubs.top = postListSubscription(selectPosts, sortPosts('score'), 10);
2013-10-24 20:30:05 +09:00
// postsSubs.new = postListSubscription(selectPosts, sortPosts('submitted'), 10);
2013-10-24 20:30:05 +09:00
// // postsSubs.best = postListSubscription(selectPosts, sortPosts('baseScore'), 10);
2013-10-24 20:30:05 +09:00
// postsSubs.pending = postListSubscription(function(){
// return selectPosts({status: STATUS_PENDING})
// }, sortPosts('createdAt'), 10);
2013-10-24 20:30:05 +09:00
// postsSubs.category = postListSubscription(function(){
// return selectPosts({status: STATUS_APPROVED, slug: Session.get('categorySlug')})
// }, sortPosts('score'), 10);