Fix after testing
This commit is contained in:
@@ -11,7 +11,6 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
|
||||
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-les-heritiers", "sheet", "item"],
|
||||
template: "systems/fvtt-les-heritiers/templates/item-sheet.html",
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
width: 620,
|
||||
height: 550,
|
||||
@@ -142,32 +141,36 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
|
||||
})
|
||||
|
||||
html.find('#add-specialite').click(ev => {
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
let spec = foundry.utils.duplicate(this.item.system.specialites) || []
|
||||
spec.push({ name: "Nouvelle Spécialité", id: foundry.utils.randomID(16), used: false })
|
||||
this.object.update({ 'system.specialites': spec })
|
||||
this.item.update({ 'system.specialites': spec })
|
||||
})
|
||||
html.find('.delete-specialite').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".specialite-item")
|
||||
let index = li.data("specialite-index")
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
let spec = foundry.utils.duplicate(this.item.system.specialites) || []
|
||||
spec.splice(index, 1)
|
||||
this.object.update({ 'system.specialites': spec })
|
||||
this.item.update({ 'system.specialites': spec })
|
||||
})
|
||||
html.find('.edit-specialite').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".specialite-item")
|
||||
let index = li.data("specialite-index")
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
spec[index].name = ev.currentTarget.value
|
||||
spec[index].id = spec[index].id || foundry.utils.randomID(16)
|
||||
this.object.update({ 'system.specialites': spec })
|
||||
let spec = foundry.utils.duplicate(this.item.system.specialites) || []
|
||||
if (spec[index]) {
|
||||
spec[index].name = ev.currentTarget.value
|
||||
spec[index].id = spec[index].id || foundry.utils.randomID(16)
|
||||
this.item.update({ 'system.specialites': spec })
|
||||
}
|
||||
})
|
||||
html.find('.edit-specialite-description').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".specialite-item")
|
||||
let index = li.data("specialite-index")
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
spec[index].description = ev.currentTarget.value
|
||||
spec[index].id = spec[index].id || foundry.utils.randomID(16)
|
||||
this.object.update({ 'system.specialites': spec })
|
||||
let spec = foundry.utils.duplicate(this.item.system.specialites) || []
|
||||
if (spec[index]) {
|
||||
spec[index].description = ev.currentTarget.value
|
||||
spec[index].id = spec[index].id || foundry.utils.randomID(16)
|
||||
this.item.update({ 'system.specialites': spec })
|
||||
}
|
||||
})
|
||||
|
||||
html.find('#add-automation').click(ev => {
|
||||
@@ -203,7 +206,7 @@ export class HeritiersItemSheet extends foundry.appv1.sheets.ItemSheet {
|
||||
/* -------------------------------------------- */
|
||||
get template() {
|
||||
let type = this.item.type;
|
||||
return `systems/fvtt-les-heritiers/templates/item-${type}-sheet.html`;
|
||||
return `systems/fvtt-les-heritiers/templates/item-${type}-sheet.hbs`;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user