nathanbreitsch / storytime

Make stories with your friends!
0 stars 0 forks source link

Refactor Controllers #3

Closed nathanbreitsch closed 10 years ago

nathanbreitsch commented 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}}); }});