Browse Source

Commit 11.5: Define helper to check ownership.

Frederic G. MARAND 9 years ago
parent
commit
bc47d10db5
1 changed files with 6 additions and 0 deletions
  1. 6 0
      simple-todos.js

+ 6 - 0
simple-todos.js

@@ -53,6 +53,12 @@ if (Meteor.isClient) {
     }
     }
   });
   });
 
 
+  Template.task.helpers({
+    isOwner: function () {
+      return this.owner === Meteor.userId();
+    }
+  });
+
   Template.task.events({
   Template.task.events({
     'click .delete': function (e) {
     'click .delete': function (e) {
       Meteor.call('deleteTask', this._id);
       Meteor.call('deleteTask', this._id);