Reputation: 199
I very new to meteor I'm adding the update feature to the parties demo I now would like to only show the "Modify" button to the party's owner I tried
{{# with party}}
{{#if owner currentUser }}
<br/><input type="button" value="Modifier" class="btn btn-small edit">
{{/if}
but offcourse this is not the right way to do it I can't find how to access the user object in the template to compare it
please help
Upvotes: 1
Views: 2143
Reputation: 8918
You always have access to the Template object instance with this
(a party
instance in this example) inside the helper methods:
Template.details.isOwner = function() {
return this.owner === Meteor.userId();
};
{{#if isOwner}}
<br/><input type="button" value="Modifier" class="btn btn-small edit">
{{/if}}
(It's very similar to the canRemove
helper that's already in the Parties
example.)
Upvotes: 5