Closed nathanbreitsch closed 10 years ago
Make a controller file for each template in client/views as described in the meteor book.
I'm talking about these things:
Template.story.story = function(){ return Story.find({}); };
Template.top.sentences = function(){ return Sentences.find({},{sort:{score:-1}}); };
Template.top.events({ 'click .upvote': function(){ //upvote logic Sentences.update(this._id, {$inc:{score:1}}); },
'click .downvote': function(){ //downvote logic Sentences.update(this._id, {$inc:{score:-1}}); }});
Make a controller file for each template in client/views as described in the meteor book.
I'm talking about these things:
Template.story.story = function(){ return Story.find({}); };
Template.top.sentences = function(){ return Sentences.find({},{sort:{score:-1}}); };
Template.top.events({ 'click .upvote': function(){ //upvote logic Sentences.update(this._id, {$inc:{score:1}}); },
'click .downvote': function(){ //downvote logic Sentences.update(this._id, {$inc:{score:-1}}); }});