Added ability to add/edit buffs
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<template name="customBuffEdit">
|
||||
{{#with buff}}
|
||||
{{#baseEditDialog title=name hideColor=true}}
|
||||
<!--name-->
|
||||
<paper-input id="buffNameInput" class="fullwidth" label="Name" value={{name}}></paper-input>
|
||||
|
||||
<!--description-->
|
||||
<paper-textarea label="Description" id="buffDescriptionInput" value={{description}}></paper-textarea>
|
||||
|
||||
{{> effectsEditList parentId=_id parentCollection="Buffs" charId=charId name=name enabled=false}}
|
||||
{{> attackEditList parentId=_id parentCollection="Buffs" charId=charId name=name enabled=false}}
|
||||
{{> proficiencyEditList parentId=_id parentCollection="Buffs" charId=charId enabled=false}}
|
||||
{{/baseEditDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
@@ -0,0 +1,35 @@
|
||||
Template.customBuffEdit.helpers({
|
||||
buff: function(){
|
||||
return CustomBuffs.findOne(this.buffId);
|
||||
},
|
||||
});
|
||||
|
||||
const debounce = (f) => _.debounce(f, 300);
|
||||
|
||||
Template.customBuffEdit.events({
|
||||
"input #buffNameInput": debounce(function(event){
|
||||
const input = event.currentTarget;
|
||||
var name = input.value;
|
||||
if (!name){
|
||||
input.invalid = true;
|
||||
input.errorMessage = "Name is required";
|
||||
} else {
|
||||
input.invalid = false;
|
||||
CustomBuffs.update(this._id, {
|
||||
$set: {name: name}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}
|
||||
}),
|
||||
"input #buffDescriptionInput": debounce(function(event){
|
||||
var description = event.currentTarget.value;
|
||||
CustomBuffs.update(this._id, {
|
||||
$set: {description: description}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user