Files
DiceCloud/rpg-docs/client/views/character/proficiencies/proficiencyEditList/proficiencyEditList.js
2017-01-12 15:28:59 +02:00

32 lines
646 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,
group: this.parentGroup,
},
enabled: this.enabled,
value: 1,
type: "skill",
});
},
});