Now only show edit and add buttons to writers, not readers

This commit is contained in:
Stefan Zermatten
2015-05-12 11:34:37 +02:00
parent ff8ae89722
commit bf032bcdf3
11 changed files with 68 additions and 36 deletions

View File

@@ -11,6 +11,18 @@ Template.baseDialog.helpers({
editing: function(){
return Template.instance().editing.get();
},
showEdit: function() {
if (this.hideEdit) return false;
var charId = Template.parentData().charId;
if (charId){
var char = Characters.findOne(charId);
var userId = Meteor.userId();
if (char && userId)
return char.owner === userId ||
_.contains(char.writers, userId);
}
return true;
},
});
Template.baseDialog.events({