Skip to content
Permalink
Browse files

Add a spinner to make pagination nicer

chapter12-5
  • Loading branch information
tmeasday committed Oct 19, 2015
1 parent 6ff286c commit 55a5168443bfff71dc0b56640f75ec920c896be2
Showing with 7 additions and 2 deletions.
  1. +4 −0 client/templates/posts/posts_list.html
  2. +3 −2 lib/router.js
@@ -6,6 +6,10 @@

{{#if nextPath}}
<a class="load-more" href="{{nextPath}}">Load more</a>
{{else}}
{{#unless ready}}
{{> spinner}}
{{/unless}}
{{/if}}
</div>
</template>
@@ -16,8 +16,8 @@ PostsListController = RouteController.extend({
findOptions: function() {
return {sort: {submitted: -1}, limit: this.postsLimit()};
},
waitOn: function() {
return Meteor.subscribe('posts', this.findOptions());
subscriptions: function() {
this.postsSub = Meteor.subscribe('posts', this.findOptions());
},
posts: function() {
return Posts.find({}, this.findOptions());
@@ -27,6 +27,7 @@ PostsListController = RouteController.extend({
var nextPath = this.route.path({postsLimit: this.postsLimit() + this.increment});
return {
posts: this.posts(),
ready: this.postsSub.ready,
nextPath: hasMore ? nextPath : null
};
}

0 comments on commit 55a5168

Please sign in to comment.
You can’t perform that action at this time.