Implemented enabling/disabling of features

This commit is contained in:
Thaum
2015-03-11 09:43:45 +00:00
parent 297e54cdc2
commit 2b9cbcf717
7 changed files with 92 additions and 4 deletions

View File

@@ -24,6 +24,12 @@ Template.features.helpers({
characterProficiencies: function(){
var char = Characters.findOne(this._id);
return char && char.proficiencies;
},
canEnable: function(){
return this.enabled !== "alwaysEnabled";
},
isEnabled: function(){
return this.enabled !== "disabled";
}
});
@@ -83,6 +89,15 @@ Template.features.events({
data: {charId: charId, field: "proficiencies", title: "Proficiencies", color: "q"},
heroId: this._id + "proficiencies"
});
},
"tap .enabledCheckbox": function(event){
event.stopPropagation();
},
"change .enabledCheckbox": function(event){
var enabled;
if(this.enabled === "enabled") enabled = "disabled";
else enabled = "enabled";
Features.update(this._id, {$set: {enabled: enabled}});
}
});