mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 11:01:38 -05:00
still has errors, but a cleaner solution
This commit is contained in:
parent
745fa28370
commit
06f55f62db
2 changed files with 25 additions and 22 deletions
|
@ -245,7 +245,7 @@ Router.map(function() {
|
|||
this.route('home', {
|
||||
path: '/',
|
||||
template:'posts_list',
|
||||
waitOn: postsSubscriptions.top = postListSubscription(selectTop, sortPosts('score'), 10),
|
||||
waitOn: postListSubscription(selectTop, sortPosts('score'), 11),
|
||||
after: function() {
|
||||
Session.set('view', 'top');
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ Router.map(function() {
|
|||
this.route('posts_top', {
|
||||
path: '/top',
|
||||
template:'posts_list',
|
||||
waitOn: postsSubscriptions.top = postListSubscription(selectTop, sortPosts('score'), 11),
|
||||
waitOn: postListSubscription(selectTop, sortPosts('score'), 11),
|
||||
after: function() {
|
||||
Session.set('view', 'top');
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ Router.map(function() {
|
|||
this.route('posts_new', {
|
||||
path: '/new',
|
||||
template:'posts_list',
|
||||
waitOn: postsSubscriptions.new = postListSubscription(selectNew, sortPosts('submitted'), 12),
|
||||
waitOn: postListSubscription(selectNew, sortPosts('submitted'), 12),
|
||||
after: function() {
|
||||
Session.set('view', 'new');
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ Router.map(function() {
|
|||
this.route('posts_best', {
|
||||
path: '/best',
|
||||
template:'posts_list',
|
||||
waitOn: postsSubscriptions.best = postListSubscription(selectBest, sortPosts('baseScore'), 13),
|
||||
waitOn: postListSubscription(selectBest, sortPosts('baseScore'), 13),
|
||||
after: function() {
|
||||
Session.set('view', 'best');
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ Router.map(function() {
|
|||
this.route('posts_pending', {
|
||||
path: '/pending',
|
||||
template:'posts_list',
|
||||
waitOn: postsSubscriptions.pending = postListSubscription(selectPending, sortPosts('createdAt'), 14),
|
||||
waitOn: postListSubscription(selectPending, sortPosts('createdAt'), 14),
|
||||
after: function() {
|
||||
Session.set('view', 'pending');
|
||||
}
|
||||
|
@ -295,22 +295,25 @@ Router.map(function() {
|
|||
|
||||
// Categories
|
||||
|
||||
// this.route('category', {
|
||||
// path: '/c/:slug/',
|
||||
// waitOn:
|
||||
// before: function() {
|
||||
// view = 'top';
|
||||
// Session.set('categorySlug', this.params.slug);
|
||||
// Router._categoryFilter = true;
|
||||
// }
|
||||
// });
|
||||
this.route('category', {
|
||||
path: '/c/:slug',
|
||||
template:'posts_list',
|
||||
waitOn: function() {
|
||||
Session.set('view', 'top');
|
||||
Session.set('categorySlug', this.params.slug);
|
||||
return postListSubscription(selectTop, sortPosts('score'), 10)
|
||||
}
|
||||
});
|
||||
|
||||
// this.route('category_view', {
|
||||
// path: '/c/:slug/:view',
|
||||
// waitOn:
|
||||
// before: function() {
|
||||
// var view = this.params.view;
|
||||
// waitOn: function() {
|
||||
// Session.set('view', this.params.view);
|
||||
// Session.set('categorySlug', this.params.slug);
|
||||
// return postListSubscription(selectTop, sortPosts('score'), 10),
|
||||
// },
|
||||
// before: function() {
|
||||
|
||||
// Router._categoryFilter = true;
|
||||
// }
|
||||
// });
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
Template.posts_list.helpers({
|
||||
posts: function() {
|
||||
console.log(postsSubscriptions[Session.get('view')])
|
||||
return postsSubscriptions[Session.get('view')].fetch();
|
||||
// console.log(Router.current().waitOn[0])
|
||||
return Router.current().waitOn[0].fetch();
|
||||
},
|
||||
postsReady: function() {
|
||||
return postsSubscriptions[Session.get('view')].ready();
|
||||
return Router.current().waitOn[0].ready();
|
||||
},
|
||||
allPostsLoaded: function(){
|
||||
allPostsLoaded = postsSubscriptions[Session.get('view')].fetch().length < postsSubscriptions[Session.get('view')].loaded();
|
||||
allPostsLoaded = Router.current().waitOn[0].fetch().length < Router.current().waitOn[0].loaded();
|
||||
Session.set('allPostsLoaded', allPostsLoaded);
|
||||
return allPostsLoaded;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ Template.posts_list.events({
|
|||
'click .more-link': function(e) {
|
||||
e.preventDefault();
|
||||
Session.set('currentScroll',$('body').scrollTop());
|
||||
postsSubscriptions[Session.get('view')].loadNextPage();
|
||||
Router.current().waitOn[0].loadNextPage();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue