Files
DiceCloud/rpg-docs/client/views/character/proficiencies/proficiencyEditList/proficiencyEditList.js
2015-04-22 12:44:25 +02:00

31 lines
617 B
JavaScript

Template.proficiencyEditList.helpers({
proficiencies: function(){
var selector = {
"parent.id": this.parentId,
"charId": this.charId,
};
if (this.parentGroup){
selector["parent.group"] = this.parentGroup;
}
return Proficiencies.find(selector);
}
});
Template.proficiencyEditList.events({
"tap #addProficiencyButton": function(){
if (!_.isBoolean(this.enabled)) {
this.enabled = true;
}
Proficiencies.insert({
charId: this.charId,
parent: {
id: this.parentId,
collection: this.parentCollection,
},
enabled: this.enabled,
value: 1,
type: "skill",
});
},
});