diff --git a/rpg-docs/client/views/character/buffs/customBuffEdit/customBuffEdit.js b/rpg-docs/client/views/character/buffs/customBuffEdit/customBuffEdit.js
index 66330ba4..76329df4 100644
--- a/rpg-docs/client/views/character/buffs/customBuffEdit/customBuffEdit.js
+++ b/rpg-docs/client/views/character/buffs/customBuffEdit/customBuffEdit.js
@@ -1,3 +1,9 @@
+Template.customBuffEdit.helpers({
+ buff(){
+ return CustomBuffs.findOne(this.customBuffId);
+ },
+});
+
const debounce = (f) => _.debounce(f, 300);
Template.customBuffEdit.events({
@@ -9,7 +15,7 @@ Template.customBuffEdit.events({
input.errorMessage = "Name is required";
} else {
input.invalid = false;
- CustomBuffs.update(this.buff._id, {
+ CustomBuffs.update(this.customBuffId, {
$set: {name: name}
}, {
removeEmptyStrings: false,
@@ -19,7 +25,7 @@ Template.customBuffEdit.events({
}),
"input #buffDescriptionInput": debounce(function(event){
var description = event.currentTarget.value;
- CustomBuffs.update(this.buff._id, {
+ CustomBuffs.update(this.customBuffId, {
$set: {description: description}
}, {
removeEmptyStrings: false,
@@ -29,7 +35,13 @@ Template.customBuffEdit.events({
"iron-select .target-dropdown": function(event){
var detail = event.originalEvent.detail;
var value = detail.item.getAttribute("name");
- if (value === this.buff.target) return;
- CustomBuffs.update(this.buff._id, {$set: {target: value}});
+ const buff = CustomBuffs.findOne(this.customBuffId);
+ if (value === buff.target) return;
+ CustomBuffs.update(this.customBuffId, {$set: {target: value}});
+ },
+ "click #deleteButton": function(event, instance){
+ CustomBuffs.softRemoveNode(instance.data.customBuffId);
+ GlobalUI.deletedToast(instance.data.customBuffId, "Buffs", "Buff");
+ popDialogStack();
},
});
diff --git a/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.html b/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.html
index a3f8cf78..f5abb8eb 100644
--- a/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.html
+++ b/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.html
@@ -20,11 +20,11 @@
-
+
-
\ No newline at end of file
+
+
+
diff --git a/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.js b/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.js
index 54f7fc29..c9f1e752 100644
--- a/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.js
+++ b/rpg-docs/client/views/character/buffs/customBuffEditList/customBuffEditList.js
@@ -14,7 +14,7 @@ Template.customBuffEditList.events({
this.enabled = true;
}
const customBuffId = CustomBuffs.insert({
- name: "New Buff",
+ name: this.name || "New Buff",
charId: this.charId,
parent: {
id: this.parentId,
@@ -23,7 +23,7 @@ Template.customBuffEditList.events({
});
pushDialogStack({
template: "customBuffEdit",
- data: {id: customBuffId},
+ data: {customBuffId},
element: event.currentTarget,
returnElement: () => instance.find(`tr.buff[data-id='${customBuffId}']`),
});
@@ -34,8 +34,8 @@ Template.customBuffEditListItem.events({
"tap .edit-buff": function(event, template){
pushDialogStack({
template: "customBuffEdit",
- data: {buff: this.buff},
+ data: {customBuffId: this.buff._id},
element: event.currentTarget.parentElement.parentElement,
});
},
-});
\ No newline at end of file
+});
diff --git a/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.html b/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.html
index de9e8798..09971a01 100644
--- a/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.html
+++ b/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.html
@@ -1,8 +1,8 @@
-
+
- {{buff.name}}
-
+
+
diff --git a/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.js b/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.js
index 70c8d4da..fdc30712 100644
--- a/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.js
+++ b/rpg-docs/client/views/character/buffs/customBuffView/customBuffView.js
@@ -41,7 +41,16 @@ const applyBuff = function(targetId, buff) {
Proficiencies.insert(temp);
});
-}
+
+ let target;
+ if (targetId == buff.charId) {
+ target = "self";
+ } else {
+ target = Characters.findOne(targetId) || {};
+ target = target && target.name || "target"
+ }
+ GlobalUI.toast(`${buff.name || "Buff"} applied to ${target}`);
+};
Template.customBuffView.helpers({
toSelf: function() {
@@ -65,10 +74,9 @@ Template.customBuffView.events({
applyBuff(targetId, this.buff);
},
});
- }
- else {
+ } else {
var targetId = this.buff.charId;
applyBuff(targetId, this.buff);
}
},
-});
\ No newline at end of file
+});
diff --git a/rpg-docs/client/views/character/buffs/customBuffViewList/customBuffViewList.html b/rpg-docs/client/views/character/buffs/customBuffViewList/customBuffViewList.html
index ea002b05..7aae4d4c 100644
--- a/rpg-docs/client/views/character/buffs/customBuffViewList/customBuffViewList.html
+++ b/rpg-docs/client/views/character/buffs/customBuffViewList/customBuffViewList.html
@@ -5,7 +5,9 @@
Buffs
{{#each buff in buffs}}
- {{> customBuffView buff=buff}}
+