#1 Fix item deletion
This commit is contained in:
parent
4f61eb3ef2
commit
9ea19a5509
@ -92,7 +92,7 @@ export class SoSActorSheet extends ActorSheet {
|
|||||||
// Delete Inventory Item
|
// Delete Inventory Item
|
||||||
html.find('.item-delete').click(ev => {
|
html.find('.item-delete').click(ev => {
|
||||||
const li = $(ev.currentTarget).parents(".item");
|
const li = $(ev.currentTarget).parents(".item");
|
||||||
RdDUtility.confirmerSuppression(this, li);
|
SoSUtility.confirmDelete(this, li);
|
||||||
});
|
});
|
||||||
|
|
||||||
html.find('.stat-label a').click((event) => {
|
html.find('.stat-label a').click((event) => {
|
||||||
|
@ -219,6 +219,36 @@ export class SoSUtility extends Entity {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async confirmDelete(actorSheet, li) {
|
||||||
|
let itemId = li.data("item-id");
|
||||||
|
let objet = actorSheet.actor.items.find(item => item._id == itemId);
|
||||||
|
let msgTxt = "<p>Are you sure to delete this item ?";
|
||||||
|
let buttons = {
|
||||||
|
delete: {
|
||||||
|
icon: '<i class="fas fa-check"></i>',
|
||||||
|
label: "Yes, delete it",
|
||||||
|
callback: () => {
|
||||||
|
console.log("Delete : ", itemId);
|
||||||
|
actorSheet.actor.deleteOwnedItem(itemId);
|
||||||
|
li.slideUp(200, () => actorSheet.render(false));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
icon: '<i class="fas fa-times"></i>',
|
||||||
|
label: "Cancel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
msgTxt += "</p>";
|
||||||
|
let d = new Dialog({
|
||||||
|
title: "Confirm deletion",
|
||||||
|
content: msgTxt,
|
||||||
|
buttons: buttons,
|
||||||
|
default: "cancel"
|
||||||
|
});
|
||||||
|
d.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async applyDamage( flipData ) {
|
static async applyDamage( flipData ) {
|
||||||
if (!this.registry) this.registry = {};
|
if (!this.registry) this.registry = {};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "foundryvtt-shadows-over-sol",
|
"name": "foundryvtt-shadows-over-sol",
|
||||||
"title": "Shadows over Sol",
|
"title": "Shadows over Sol",
|
||||||
"description": "Shadows over Sol for FoundryVTT",
|
"description": "Shadows over Sol for FoundryVTT",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"manifestPlusVersion": "1.0.0",
|
"manifestPlusVersion": "1.0.0",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.9",
|
"compatibleCoreVersion": "0.7.9",
|
||||||
|
Loading…
Reference in New Issue
Block a user