|
@@ -24,9 +24,17 @@ PostsListController = RouteController.extend({
|
|
|
waitOn: function () {
|
|
|
return Meteor.subscribe('posts', this.findOptions());
|
|
|
},
|
|
|
+ posts: function () {
|
|
|
+ return Posts.find({}, this.findOptions());
|
|
|
+ },
|
|
|
data: function () {
|
|
|
+ var hasMore = this.posts().count() === this.postsLimit();
|
|
|
+ var nextPath = this.route.path({
|
|
|
+ postsLimit: this.postsLimit() + this.increment
|
|
|
+ });
|
|
|
return {
|
|
|
- posts: Posts.find({}, this.findOptions())
|
|
|
+ posts: this.posts(),
|
|
|
+ nextPath: hasMore ? nextPath : null
|
|
|
};
|
|
|
}
|
|
|
});
|
|
@@ -59,8 +67,8 @@ Router.route('/submit', {
|
|
|
|
|
|
// C'est un nom de route, pas un nom de template. Mais IR le prend comme nom de
|
|
|
// template par défaut.
|
|
|
-Router.route('/:postLimit?', {
|
|
|
- name: 'postsList',
|
|
|
+Router.route('/:postsLimit?', {
|
|
|
+ name: 'postsList'
|
|
|
});
|
|
|
|
|
|
var requireLogin = function () {
|