diff --git a/client/helpers/router.js b/client/helpers/router.js index a964d51a9..d88d658ea 100644 --- a/client/helpers/router.js +++ b/client/helpers/router.js @@ -248,7 +248,6 @@ Router.map(function() { waitOn: postsSubscriptions.top = postListSubscription(selectTop, sortPosts('score'), 10), after: function() { Session.set('view', 'top'); - currentSubscription = postsSubscriptions.top; } }); @@ -258,7 +257,6 @@ Router.map(function() { waitOn: postsSubscriptions.top = postListSubscription(selectTop, sortPosts('score'), 11), after: function() { Session.set('view', 'top'); - currentSubscription = postsSubscriptions.top; } }); @@ -270,7 +268,6 @@ Router.map(function() { waitOn: postsSubscriptions.new = postListSubscription(selectNew, sortPosts('submitted'), 12), after: function() { Session.set('view', 'new'); - currentSubscription = postsSubscriptions.new; } }); diff --git a/client/views/posts/posts_list.js b/client/views/posts/posts_list.js index 468555094..cb6477075 100644 --- a/client/views/posts/posts_list.js +++ b/client/views/posts/posts_list.js @@ -1,12 +1,13 @@ Template.posts_list.helpers({ posts: function() { - return currentSubscription.fetch(); + console.log(postsSubscriptions[Session.get('view')]) + return postsSubscriptions[Session.get('view')].fetch(); }, postsReady: function() { - return currentSubscription.ready(); + return postsSubscriptions[Session.get('view')].ready(); }, allPostsLoaded: function(){ - allPostsLoaded = currentSubscription.fetch().length < currentSubscription.loaded(); + allPostsLoaded = postsSubscriptions[Session.get('view')].fetch().length < postsSubscriptions[Session.get('view')].loaded(); Session.set('allPostsLoaded', allPostsLoaded); return allPostsLoaded; } @@ -25,7 +26,7 @@ Template.posts_list.events({ 'click .more-link': function(e) { e.preventDefault(); Session.set('currentScroll',$('body').scrollTop()); - currentSubscription.loadNextPage(); + postsSubscriptions[Session.get('view')].loadNextPage(); } });