mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 12:16:37 -04: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', {
|
this.route('home', {
|
||||||
path: '/',
|
path: '/',
|
||||||
template:'posts_list',
|
template:'posts_list',
|
||||||
waitOn: postsSubscriptions.top = postListSubscription(selectTop, sortPosts('score'), 10),
|
waitOn: postListSubscription(selectTop, sortPosts('score'), 11),
|
||||||
after: function() {
|
after: function() {
|
||||||
Session.set('view', 'top');
|
Session.set('view', 'top');
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ Router.map(function() {
|
||||||
this.route('posts_top', {
|
this.route('posts_top', {
|
||||||
path: '/top',
|
path: '/top',
|
||||||
template:'posts_list',
|
template:'posts_list',
|
||||||
waitOn: postsSubscriptions.top = postListSubscription(selectTop, sortPosts('score'), 11),
|
waitOn: postListSubscription(selectTop, sortPosts('score'), 11),
|
||||||
after: function() {
|
after: function() {
|
||||||
Session.set('view', 'top');
|
Session.set('view', 'top');
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ Router.map(function() {
|
||||||
this.route('posts_new', {
|
this.route('posts_new', {
|
||||||
path: '/new',
|
path: '/new',
|
||||||
template:'posts_list',
|
template:'posts_list',
|
||||||
waitOn: postsSubscriptions.new = postListSubscription(selectNew, sortPosts('submitted'), 12),
|
waitOn: postListSubscription(selectNew, sortPosts('submitted'), 12),
|
||||||
after: function() {
|
after: function() {
|
||||||
Session.set('view', 'new');
|
Session.set('view', 'new');
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ Router.map(function() {
|
||||||
this.route('posts_best', {
|
this.route('posts_best', {
|
||||||
path: '/best',
|
path: '/best',
|
||||||
template:'posts_list',
|
template:'posts_list',
|
||||||
waitOn: postsSubscriptions.best = postListSubscription(selectBest, sortPosts('baseScore'), 13),
|
waitOn: postListSubscription(selectBest, sortPosts('baseScore'), 13),
|
||||||
after: function() {
|
after: function() {
|
||||||
Session.set('view', 'best');
|
Session.set('view', 'best');
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ Router.map(function() {
|
||||||
this.route('posts_pending', {
|
this.route('posts_pending', {
|
||||||
path: '/pending',
|
path: '/pending',
|
||||||
template:'posts_list',
|
template:'posts_list',
|
||||||
waitOn: postsSubscriptions.pending = postListSubscription(selectPending, sortPosts('createdAt'), 14),
|
waitOn: postListSubscription(selectPending, sortPosts('createdAt'), 14),
|
||||||
after: function() {
|
after: function() {
|
||||||
Session.set('view', 'pending');
|
Session.set('view', 'pending');
|
||||||
}
|
}
|
||||||
|
@ -295,22 +295,25 @@ Router.map(function() {
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
|
|
||||||
// this.route('category', {
|
this.route('category', {
|
||||||
// path: '/c/:slug/',
|
path: '/c/:slug',
|
||||||
// waitOn:
|
template:'posts_list',
|
||||||
// before: function() {
|
waitOn: function() {
|
||||||
// view = 'top';
|
Session.set('view', 'top');
|
||||||
// Session.set('categorySlug', this.params.slug);
|
Session.set('categorySlug', this.params.slug);
|
||||||
// Router._categoryFilter = true;
|
return postListSubscription(selectTop, sortPosts('score'), 10)
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// this.route('category_view', {
|
// this.route('category_view', {
|
||||||
// path: '/c/:slug/:view',
|
// path: '/c/:slug/:view',
|
||||||
// waitOn:
|
// waitOn: function() {
|
||||||
// before: function() {
|
// Session.set('view', this.params.view);
|
||||||
// var view = this.params.view;
|
|
||||||
// Session.set('categorySlug', this.params.slug);
|
// Session.set('categorySlug', this.params.slug);
|
||||||
|
// return postListSubscription(selectTop, sortPosts('score'), 10),
|
||||||
|
// },
|
||||||
|
// before: function() {
|
||||||
|
|
||||||
// Router._categoryFilter = true;
|
// Router._categoryFilter = true;
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
Template.posts_list.helpers({
|
Template.posts_list.helpers({
|
||||||
posts: function() {
|
posts: function() {
|
||||||
console.log(postsSubscriptions[Session.get('view')])
|
// console.log(Router.current().waitOn[0])
|
||||||
return postsSubscriptions[Session.get('view')].fetch();
|
return Router.current().waitOn[0].fetch();
|
||||||
},
|
},
|
||||||
postsReady: function() {
|
postsReady: function() {
|
||||||
return postsSubscriptions[Session.get('view')].ready();
|
return Router.current().waitOn[0].ready();
|
||||||
},
|
},
|
||||||
allPostsLoaded: function(){
|
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);
|
Session.set('allPostsLoaded', allPostsLoaded);
|
||||||
return allPostsLoaded;
|
return allPostsLoaded;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ Template.posts_list.events({
|
||||||
'click .more-link': function(e) {
|
'click .more-link': function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
Session.set('currentScroll',$('body').scrollTop());
|
Session.set('currentScroll',$('body').scrollTop());
|
||||||
postsSubscriptions[Session.get('view')].loadNextPage();
|
Router.current().waitOn[0].loadNextPage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue