Template.postEdit.events({'submit form':function(e){e.preventDefault();varcurrentPostId=this._id;varpostProperties={url:$(e.target).find('[name=url]').val(),title:$(e.target).find('[name=title]').val()}Posts.update(currentPostId,{$set:postProperties},function(error){if(error){// display the error to the useralert(error.reason);}else{Router.go('postPage',{_id:currentPostId});}});},'click .delete':function(e){e.preventDefault();if(confirm("Delete this post?")){varcurrentPostId=this._id;Posts.remove(currentPostId);Router.go('postsList');}}});

Commit 8-2

Limiting Edits

////

////

Posts=newMeteor.Collection('posts');Posts.allow({update:ownsDocument,remove:ownsDocument});Posts.deny({update:function(userId,post,fieldNames){// may only edit the following two fields:return(_.without(fieldNames,'url','title').length>0);}});