Vulcan/client/helpers/router.js

786 lines
21 KiB
JavaScript
Raw Normal View History

2013-10-09 20:59:42 +09:00
/*
2013-10-10 11:41:11 +09:00
//--------------------------------------------------------------------------------------------------//
//---------------------------------------- Table Of Contents ---------------------------------------//
//--------------------------------------------------------------------------------------------------//
---------------------------------------------------------------
# Config #
---------------------------------------------------------------
//
2013-10-09 20:59:42 +09:00
---------------------------------------------------------------
2013-10-10 11:41:11 +09:00
# Filters #
2013-10-09 20:59:42 +09:00
---------------------------------------------------------------
2013-10-10 11:41:11 +09:00
isLoggedIn
isLoggedOut
isAdmin
canView
canPost
canEditPost
canEditComment
hasCompletedProfile
---------------------------------------------------------------
# Subscription Functions #
---------------------------------------------------------------
2013-10-10 11:41:11 +09:00
---------------------------------------------------------------
# Routes #
---------------------------------------------------------------
2013-10-09 20:59:42 +09:00
1) Paginated Lists
----------------------
Top
New
Best
Pending
Categories
2) Digest
--------------------
Digest
3) Posts
--------------------
Post Page
Post Page (scroll to comment)
Post Edit
Post Submit
4) Comments
--------------------
Comment Page
Comment Edit
Comment Submit
5) Users
--------------------
User Profie
User Edit
Forgot Password
Account
All Users
Unsubscribe (from notifications)
Sign Up
Sign In
6) Misc Routes
--------------------
Settings
2013-10-09 22:21:28 +09:00
Categories
2013-10-09 20:59:42 +09:00
Toolbox
2013-10-09 21:34:55 +09:00
2013-10-09 20:59:42 +09:00
*/
2013-10-10 11:41:11 +09:00
//--------------------------------------------------------------------------------------------------//
//--------------------------------------------- Config ---------------------------------------------//
//--------------------------------------------------------------------------------------------------//
2013-10-06 08:37:17 +09:00
Router.configure({
2013-10-12 11:44:29 +09:00
// autoRender: false,
layoutTemplate: 'layout',
2013-10-06 09:33:00 +09:00
loadingTemplate: 'loading',
notFoundTemplate: 'not_found'
2013-10-06 08:37:17 +09:00
});
2013-10-10 11:41:11 +09:00
//--------------------------------------------------------------------------------------------------//
//--------------------------------------------- Filters --------------------------------------------//
//--------------------------------------------------------------------------------------------------//
subs = {
}
2013-10-10 11:41:11 +09:00
var filters = {
2013-10-12 11:44:29 +09:00
// isLoggedIn: function(page) {
// if (Meteor.loggingIn()) {
// return 'loading';
// } else if (Meteor.user()) {
// return page;
// } else {
// return 'user_signin';
// }
// },
// isLoggedOut: function(page){
// return Meteor.user() ? "already_logged_in" : page;
// },
// isAdmin: function(page) {
// return isAdmin(Meteor.user()) ? page : "no_rights";
// },
// canView: function(page) {
// var error = canView(Meteor.user(), true);
// if (error === true)
// return page;
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// // a problem.. make sure we are logged in
// if (Meteor.loggingIn())
// return 'loading';
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// // otherwise the error tells us what to show.
// return error;
// },
// canPost: function(page) {
// var error = canPost(Meteor.user(), true);
// if (error === true)
// return page;
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// // a problem.. make sure we are logged in
// if (Meteor.loggingIn())
// return 'loading';
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// // otherwise the error tells us what to show.
// return error;
// },
canEditPost: function() {
var post = Posts.findOne(this.params._id);
if(!currentUserCanEdit(post)){
this.render('no_rights');
this.stop();
2013-10-10 11:41:11 +09:00
}
},
2013-10-12 11:44:29 +09:00
canEditComment: function() {
var comment = Comments.findOne(this.params._id);
if(!currentUserCanEdit(comment)){
this.render('no_rights');
this.stop();
2013-10-10 11:41:11 +09:00
}
2013-10-12 11:44:29 +09:00
}
// canEditX: function(page) {
// // make findOne() non reactive to avoid re-triggering the router every time the
// // current comment or post object changes
// // but make sure the comment/post is loaded before moving on
// if (page === 'comment_edit') {
// var item = Comments.findOne(Session.get('selectedCommentId'), {reactive: false});
// if(!Session.get('singleCommentReady'))
// return 'loading'
// } else {
// var item = Posts.findOne(Session.get('selectedPostId'), {reactive: false});
// if(!Session.get('singlePostReady'))
// return 'loading'
// }
// var error = canEdit(Meteor.user(), item, true);
// if (error === true)
// return page;
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// // a problem.. make sure the item has loaded and we have logged in
// if (! item || Meteor.loggingIn())
// return 'loading';
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// // otherwise the error tells us what to show.
// return error;
// },
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// hasCompletedProfile: function() {
// var user = Meteor.user();
2013-10-10 11:41:11 +09:00
2013-10-12 11:44:29 +09:00
// if (user && ! Meteor.loggingIn() && ! userProfileComplete(user)){
// Session.set('selectedUserId', user._id);
// return 'user_email';
// } else {
// return page;
// }
// }
2013-10-10 11:41:11 +09:00
}
//--------------------------------------------------------------------------------------------------//
//------------------------------------- Subscription Functions -------------------------------------//
//--------------------------------------------------------------------------------------------------//
2013-10-12 12:24:41 +09:00
// Posts Lists
STATUS_PENDING=1;
STATUS_APPROVED=2;
STATUS_REJECTED=3;
var selectTop = function() {
return selectPosts({name: 'top', status: STATUS_APPROVED, slug: Session.get('categorySlug')});
}
var selectNew = function() {
return selectPosts({name: 'new', status: STATUS_APPROVED, slug: Session.get('categorySlug')});
}
var selectBest = function() {
return selectPosts({name: 'best', status: STATUS_APPROVED, slug: Session.get('categorySlug')});
}
2013-10-10 11:41:11 +09:00
var selectPending = function() {
return selectPosts({name: 'pending', status: STATUS_PENDING, slug: Session.get('categorySlug')});
}
2013-10-10 11:41:11 +09:00
// put it all together with pagination
var postListSubscription = function(find, options, per_page) {
var handle = Meteor.subscribeWithPagination('paginatedPosts', find, options, per_page);
handle.fetch = function() {
var ourFind = _.isFunction(find) ? find() : find;
return limitDocuments(Posts.find(ourFind, options), handle.loaded());
}
return handle;
}
2013-10-10 11:41:11 +09:00
//--------------------------------------------------------------------------------------------------//
//--------------------------------------------- Routes ---------------------------------------------//
//--------------------------------------------------------------------------------------------------//
2013-10-09 21:34:55 +09:00
2013-10-06 08:37:17 +09:00
Router.map(function() {
this.route('home', {
2013-10-09 12:39:05 +09:00
path: '/',
template: 'posts_top'
2013-10-06 08:37:17 +09:00
});
this.route('posts_new', {path: '/new'});
this.route('posts_best', {path: '/best'});
2013-10-06 09:17:37 +09:00
this.route('posts_pending', {path: '/pending'});
2013-10-06 09:33:00 +09:00
2013-10-09 20:59:42 +09:00
// Top
this.route('home', {
path: '/',
template:'posts_top',
waitOn: subs.topPostsHandle = postListSubscription(selectTop, sortPosts('score'), 10)
});
this.route('posts_top', {
path: '/top',
waitOn: subs.topPostsHandle = postListSubscription(selectTop, sortPosts('score'), 10)
});
2013-10-09 22:21:28 +09:00
2013-10-09 20:59:42 +09:00
// New
this.route('posts_new', {
path: '/new',
waitOn: subs.newPostsHandle = postListSubscription(selectNew, sortPosts('submitted'), 10)
});
2013-10-09 22:21:28 +09:00
2013-10-09 20:59:42 +09:00
// Best
this.route('posts_best', {
path: '/best',
waitOn: subs.bestPostsHandle = postListSubscription(selectBest, sortPosts('baseScore'), 10)
});
2013-10-09 22:21:28 +09:00
2013-10-09 20:59:42 +09:00
// Pending
this.route('posts_pending', {
path: '/pending',
waitOn: subs.pendingPostsHandle = postListSubscription(selectPending, sortPosts('createdAt'), 10)
});
2013-10-09 22:21:28 +09:00
2013-10-09 20:59:42 +09:00
// Categories
2013-10-09 22:21:28 +09:00
// TODO
2013-10-09 11:32:36 +09:00
// Digest
2013-10-09 11:21:23 +09:00
this.route('posts_digest', {
2013-10-06 09:33:00 +09:00
path: '/digest/:year/:month/:day',
2013-10-12 12:24:41 +09:00
waitOn: function() {
2013-10-09 11:32:36 +09:00
currentDate = new Date(this.params.year, this.params.month-1, this.params.day);
Session.set('currentDate', currentDate);
return Meteor.subscribe('postDigest', currentDate);
2013-10-06 09:33:00 +09:00
},
data: function() {
2013-10-09 11:21:23 +09:00
return {
2013-10-09 11:32:36 +09:00
posts: findDigestPosts(moment(currentDate))
2013-10-09 11:21:23 +09:00
}
2013-10-06 09:33:00 +09:00
}
});
2013-10-06 08:37:17 +09:00
this.route('posts_digest_shortcut', {
path: '/digest',
template: 'posts_digest',
waitOn: function() {
2013-10-12 12:24:41 +09:00
// note: this runs twice for some reason? is 'today' changing?
currentDate = Session.get('today');
Session.set('currentDate', currentDate);
return Meteor.subscribe('postDigest', currentDate);
},
data: function() {
return {
posts: findDigestPosts(moment(currentDate))
}
}
});
2013-10-12 11:44:29 +09:00
// -------------------------------------------- Post -------------------------------------------- //
2013-10-09 11:32:36 +09:00
// Post Page
this.route('post_page', {
path: '/posts/:_id',
waitOn: function() {
return [
Meteor.subscribe('singlePost', this.params._id),
Meteor.subscribe('comments', { post : this.params._id })
];
},
data: function() {
2013-10-09 11:21:23 +09:00
return {
post: Posts.findOne(this.params._id)
2013-10-09 20:11:58 +09:00
}
}
});
// Post Page (scroll to a comment)
2013-10-09 20:11:58 +09:00
this.route('post_page_with_comment', {
path: '/posts/:_id/comment/:_commentId',
template: 'post_page',
waitOn: function() {
return [
Meteor.subscribe('singlePost', this.params._id),
Meteor.subscribe('comments', { post : this.params._id })
];
2013-10-09 20:11:58 +09:00
},
data: function() {
return {
post: Posts.findOne(this.params._id)
2013-10-09 11:21:23 +09:00
}
}
// TODO: scroll window to specific comment
});
2013-10-09 12:39:05 +09:00
2013-10-09 11:32:36 +09:00
// Post Edit
2013-10-06 09:17:37 +09:00
this.route('post_edit', {
path: '/posts/:_id/edit',
waitOn: function() {
return Meteor.subscribe('singlePost', this.params._id);
},
data: function() {
2013-10-09 11:21:23 +09:00
return {
post: Posts.findOne(this.params._id)
}
2013-10-10 11:41:11 +09:00
},
2013-10-12 11:44:29 +09:00
after: filters.canEditPost
2013-10-06 09:17:37 +09:00
});
2013-10-09 11:32:36 +09:00
2013-10-09 12:39:05 +09:00
// Post Submit
this.route('post_submit', {path: '/submit'});
2013-10-12 11:44:29 +09:00
// -------------------------------------------- Comment -------------------------------------------- //
2013-10-09 11:32:36 +09:00
// Comment Page
2013-10-09 11:46:44 +09:00
this.route('comment_page', {
2013-10-09 12:39:05 +09:00
path: '/comments/:_id',
data: function() {
return {
comment: Comments.findOne(this.params._id)
}
}
});
// Comment Reply
this.route('comment_reply', {
path: '/comments/:_id/reply',
2013-10-09 20:11:58 +09:00
waitOn: function() {
return Meteor.subscribe('comments', this.params._id);
},
2013-10-09 11:46:44 +09:00
data: function() {
return {
comment: Comments.findOne(this.params._id)
}
}
});
2013-10-09 11:32:36 +09:00
// Comment Edit
2013-10-09 12:39:05 +09:00
this.route('comment_edit', {
path: '/comments/:_id/edit',
data: function() {
return {
comment: Comments.findOne(this.params._id)
}
2013-10-10 11:41:11 +09:00
},
2013-10-12 11:44:29 +09:00
after: filters.canEditComment
2013-10-09 12:39:05 +09:00
});
2013-10-09 20:50:26 +09:00
// User Profile
this.route('user_profile', {
path: '/users/:_id',
2013-10-09 22:16:47 +09:00
waitOn: function() {
return Meteor.subscribe('singleUser', this.params._id);
},
2013-10-09 20:50:26 +09:00
data: function() {
return {
user: Meteor.users.findOne(this.params._id)
}
}
});
// User Edit
this.route('user_edit', {
path: '/users/:_id/edit',
2013-10-09 22:16:47 +09:00
waitOn: function() {
return Meteor.subscribe('singleUser', this.params._id);
},
2013-10-09 20:50:26 +09:00
data: function() {
return {
user: Meteor.users.findOne(this.params._id)
}
}
});
// Forgot Password
this.route('forgot_password');
// Account
this.route('account', {
path: '/account',
template: 'user_edit',
data: function() {
return {
user: Meteor.user()
}
}
});
// All Users
2013-10-09 22:16:47 +09:00
this.route('users', {
waitOn: function() {
return Meteor.subscribe('allUsers');
},
data: function() {
return {
users: Meteor.users.find({}, {sort: {createdAt: -1}})
}
}
});
2013-10-09 20:50:26 +09:00
2013-10-09 20:26:58 +09:00
// Unsubscribe (from notifications)
this.route('unsubscribe', {
path: '/unsubscribe/:hash',
data: function() {
return {
hash: this.params.hash
}
}
});
2013-10-09 20:50:26 +09:00
2013-10-09 20:53:55 +09:00
// User Sign-Up
this.route('signup');
2013-10-09 20:59:42 +09:00
2013-10-09 20:53:55 +09:00
// User Sign-In
this.route('signin');
2013-10-09 22:21:28 +09:00
// Categories
this.route('categories');
2013-10-09 20:53:55 +09:00
// Settings
this.route('settings');
// Toolbox
this.route('toolbox');
2013-10-06 08:37:17 +09:00
});
2013-03-15 16:09:58 +09:00
2013-10-06 08:37:17 +09:00
// (function() {
// Meteor.Router.beforeRouting = function() {
// console.log('// Before Routing //')
// // reset all session variables that might be set by the previous route
// Session.set('categorySlug', null);
// // currentScroll stores the position of the user in the page
// Session.set('currentScroll', null);
2013-03-15 16:09:58 +09:00
2013-10-06 08:37:17 +09:00
// var tagline = getSetting("tagline") ? ": "+getSetting("tagline") : '';
// document.title = getSetting("title")+tagline;
2013-03-15 16:09:58 +09:00
2013-10-06 08:37:17 +09:00
// $('body').css('min-height','0');
2013-03-15 16:09:58 +09:00
2013-10-06 08:37:17 +09:00
// // set all errors who have already been seen to not show anymore
// clearSeenErrors();
2013-03-15 16:09:58 +09:00
2013-10-06 08:37:17 +09:00
// // log this request with mixpanel, etc
// analyticsRequest();
// }
2013-10-06 08:37:17 +09:00
// // specific router functions
// digest = function(year, month, day, view){
// var destination = (typeof view === 'undefined') ? 'posts_digest' : 'posts_digest_'+view
// if (typeof day === 'undefined') {
// // we can get into an infinite reactive loop with the subscription filter
// // if we keep setting the date even when it's barely changed
// // if (new Date() - new Date(Session.get('currentDate')) > 60 * 1000) {
// Session.set('currentDate', new Date());
// // }
// // Session.set('currentDate', new Date());
// } else {
// Session.set('currentDate', new Date(year, month-1, day));
// }
2013-10-06 08:37:17 +09:00
// // 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 (!digestHandle() || digestHandle().loading()) {
// // return 'loading';
// // } else {
// return destination;
// // }
// };
2013-10-06 08:37:17 +09:00
// post = function(id, commentId) {
// Session.set('selectedPostId', id);
// if(typeof commentId !== 'undefined')
// Session.set('scrollToCommentId', commentId);
2013-10-06 08:37:17 +09:00
// // on post page, we show the comment tree
// Session.set('showChildComments',true);
// return 'post_page';
// };
2013-10-06 08:37:17 +09:00
// post_edit = function(id) {
// Session.set('selectedPostId', id);
// return 'post_edit';
// };
2013-10-06 08:37:17 +09:00
// comment = function(id) {
// Session.set('selectedCommentId', id);
// return 'comment_page';
// };
2013-10-06 08:37:17 +09:00
// comment_reply = function(id) {
// Session.set('selectedCommentId', id);
// return 'comment_reply';
// };
2012-11-19 12:03:06 +09:00
2013-10-06 08:37:17 +09:00
// comment_edit = function(id) {
// Session.set('selectedCommentId', id);
// return 'comment_edit';
// };
2013-10-06 08:37:17 +09:00
// // XXX: do these two really not want to set it to undefined (or null)?
// user_profile = function(id) {
// if(typeof id !== undefined){
// Session.set('selectedUserId', id);
// }
// return 'user_profile';
// };
2013-10-06 08:37:17 +09:00
// user_edit = function(id) {
// if(typeof id !== undefined){
// Session.set('selectedUserId', id);
// }
// return 'user_edit';
// };
2013-10-06 08:37:17 +09:00
// unsubscribe = function(hash){
// Session.set('userEmailHash', hash);
// return 'unsubscribe';
// }
2013-01-19 21:37:46 +09:00
2013-10-06 08:37:17 +09:00
// category = function(categorySlug, view){
// var view = (typeof view === 'undefined') ? 'top' : view;
// console.log('setting category slug to: '+categorySlug)
// Session.set('categorySlug', categorySlug);
// Meteor.Router.categoryFilter = true;
// return 'posts_'+view;
// }
2013-02-18 12:13:27 +09:00
2013-10-06 08:37:17 +09:00
// // XXX: not sure if the '/' trailing routes are needed any more
// Meteor.Router.add({
// '/': 'posts_top',
// '/top':'posts_top',
// '/top/:page':'posts_top',
// '/new':'posts_new',
// '/new/:page':'posts_new',
// '/best':'posts_best',
// '/pending':'posts_pending',
// '/digest/:year/:month/:day': digest,
// '/digest': digest,
// '/c/:category_slug/:view': category,
// '/c/:category_slug': category,
// '/signin':'user_signin',
// '/signup':'user_signup',
// '/submit':'post_submit',
// '/invite':'no_invite',
// '/posts/deleted':'post_deleted',
// '/posts/:id/edit': post_edit,
// '/posts/:id/comment/:comment_id': post,
// '/posts/:id': post,
// '/comments/deleted':'comment_deleted',
// '/comments/:id': comment,
// '/comments/:id/reply': comment_reply,
// '/comments/:id/edit': comment_edit,
// '/settings':'settings',
// '/toolbox':'toolbox',
// '/categories':'categories',
// '/users':'users',
// '/account':'user_edit',
// '/forgot_password':'user_password',
// '/users/:id': user_profile,
// '/users/:id/edit': user_edit,
// '/:year/:month/:day': digest,
// '/unsubscribe/:hash': unsubscribe
// });
2013-10-06 08:37:17 +09:00
// Meteor.Router.filters({
2013-03-15 15:38:01 +09:00
2013-10-06 08:37:17 +09:00
// setRequestTimestamp: function(page){
// // openedComments is an Array that tracks which comments
// // have been expanded by the user, to make sure they stay expanded
// Session.set("openedComments", null);
// Session.set('requestTimestamp',new Date());
// // console.log('---------------setting request timestamp: '+Session.get('requestTimestamp'))
// return page;
// },
2013-04-26 17:28:09 +09:00
2013-10-06 08:37:17 +09:00
// requireLogin: function(page) {
// if (Meteor.loggingIn()) {
// return 'loading';
// } else if (Meteor.user()) {
// return page;
// } else {
// return 'user_signin';
// }
// },
2013-10-06 08:37:17 +09:00
// canView: function(page) {
// var error = canView(Meteor.user(), true);
// if (error === true)
// return page;
2013-10-06 08:37:17 +09:00
// // a problem.. make sure we are logged in
// if (Meteor.loggingIn())
// return 'loading';
2013-10-06 08:37:17 +09:00
// // otherwise the error tells us what to show.
// return error;
// },
2013-10-06 08:37:17 +09:00
// canPost: function(page) {
// var error = canPost(Meteor.user(), true);
// if (error === true)
// return page;
2013-10-06 08:37:17 +09:00
// // a problem.. make sure we are logged in
// if (Meteor.loggingIn())
// return 'loading';
2013-10-06 08:37:17 +09:00
// // otherwise the error tells us what to show.
// return error;
// },
2013-10-06 08:37:17 +09:00
// canEdit: function(page) {
// // make findOne() non reactive to avoid re-triggering the router every time the
// // current comment or post object changes
// // but make sure the comment/post is loaded before moving on
// if (page === 'comment_edit') {
// var item = Comments.findOne(Session.get('selectedCommentId'), {reactive: false});
// if(!Session.get('singleCommentReady'))
// return 'loading'
// } else {
// var item = Posts.findOne(Session.get('selectedPostId'), {reactive: false});
// if(!Session.get('singlePostReady'))
// return 'loading'
// }
2013-10-06 08:37:17 +09:00
// var error = canEdit(Meteor.user(), item, true);
// if (error === true){
// return page;
2013-10-06 08:37:17 +09:00
// }
2013-10-06 08:37:17 +09:00
// // a problem.. make sure the item has loaded and we have logged in
// if (! item || Meteor.loggingIn()){
// return 'loading';
// }
2013-10-06 08:37:17 +09:00
// // otherwise the error tells us what to show.
// return error;
// },
2013-10-06 08:37:17 +09:00
// isLoggedOut: function(page){
// return Meteor.user() ? "already_logged_in" : page;
// },
2013-10-06 08:37:17 +09:00
// isAdmin: function(page) {
// return isAdmin(Meteor.user()) ? page : "no_rights";
// },
2013-10-06 08:37:17 +09:00
// // if the user is logged in but their profile isn't filled out enough
// requireProfile: function(page) {
// var user = Meteor.user();
2012-11-21 13:34:08 +09:00
2013-10-06 08:37:17 +09:00
// if (user && ! Meteor.loggingIn() && ! userProfileComplete(user)){
// Session.set('selectedUserId', user._id);
// return 'user_email';
// } else {
// return page;
// }
// },
2013-10-06 08:37:17 +09:00
// // if we are on a page that requires a post, as set in selectedPostId
// requirePost: function(page) {
// // make findOne() non reactive to avoid re-triggering the router every time the
// // current comment or post object changes
// if (Posts.findOne(Session.get('selectedPostId'), {reactive: false})) {
// return page;
// } else if (! Session.get('singlePostReady')) {
// return 'loading';
// } else {
// return 'not_found';
// }
// }
// });
// //
// Meteor.Router.filter('requireProfile');
// Meteor.Router.filter('requireLogin', {only: ['comment_reply','post_submit']});
// Meteor.Router.filter('canView', {only: ['posts_top', 'posts_new', 'posts_digest', 'posts_best']});
// Meteor.Router.filter('isLoggedOut', {only: ['user_signin', 'user_signup']});
// Meteor.Router.filter('canPost', {only: ['posts_pending', 'comment_reply', 'post_submit']});
// Meteor.Router.filter('canEdit', {only: ['post_edit', 'comment_edit']});
// Meteor.Router.filter('requirePost', {only: ['post_page', 'post_edit']});
// Meteor.Router.filter('isAdmin', {only: ['posts_pending', 'users', 'settings', 'categories', 'admin']});
// Meteor.Router.filter('setRequestTimestamp', {only: ['post_page']});
2013-04-26 17:28:09 +09:00
2013-10-06 08:37:17 +09:00
// Meteor.startup(function() {
// Meteor.autorun(function() {
// // grab the current page from the router, so this re-runs every time it changes
// Meteor.Router.page();
// if(Meteor.Router.page() !== "loading"){
// console.log('------ '+Meteor.Router.page()+' ------');
2013-10-06 08:37:17 +09:00
// // note: posts_digest doesn't use paginated subscriptions so it cannot have a rank
// if(_.contains(['posts_top', 'posts_new', 'posts_pending', 'posts_best'], Meteor.Router.page())){
// Session.set('isPostsList', true);
// }else{
// Session.set('isPostsList', false);
// }
2013-10-06 08:37:17 +09:00
// }
// });
// });
// }());