Created
October 9, 2012 21:28
-
-
Save tsgautier/3861580 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# expose a list of players | |
Template.scores.players = -> | |
return Objects.find({type: 'player'}, sort: sortOrder()).fetch().slice(0,Session.get('page_size')) | |
# expose a user object | |
Template.profile.user = -> | |
return Objects.findOne({type: 'user'}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Objects = new Meteor.Collection("objects") | |
# publish objects of type player | |
Meteor.publish 'players', (page_size, current_page, sort) -> | |
Objects.find({type: 'player'}, sort: sort, skip: (current_page-1)*page_size, limit: page_size) | |
# publish objects of type user | |
Meteor.publish 'users', -> | |
Objects.find {type: 'user'} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment