Add the item UUID into the fieldset and add a context menu to edit/delete primary attributes

This commit is contained in:
Oliver 2026-04-23 21:18:57 -06:00
parent 60d29adc3e
commit e9d92d3db1
2 changed files with 31 additions and 1 deletions

View file

@ -248,6 +248,32 @@ export class PlayerSheet extends
], ],
{ jQuery: false, fixed: true }, { jQuery: false, fixed: true },
); );
new ContextMenu.implementation(
this.element,
`fieldset.attribute`,
[
{
label: _loc(`taf.misc.edit`),
condition: (el) => {
const itemUuid = el.dataset.itemUuid;
const itemExists = itemUuid != null && itemUuid !== ``;
return this.isEditable && itemExists;
},
onClick: editItemFromElement,
},
{
label: _loc(`taf.misc.delete`),
condition: (el) => {
const itemUuid = el.dataset.itemUuid;
const itemExists = itemUuid != null && itemUuid !== ``;
return this.isEditable && itemExists;
},
onClick: deleteItemFromElement,
},
],
{ jQuery: false, fixed: true },
);
}; };
async close() { async close() {

View file

@ -1,7 +1,11 @@
{{#if hasAttributes}} {{#if hasAttributes}}
<div class="attributes"> <div class="attributes">
{{#each attrs as | attr |}} {{#each attrs as | attr |}}
<fieldset data-foreign-uuid="{{ attr.uuid }}"> <fieldset
class="attribute"
data-item-uuid="{{ attr.uuid }}"
data-foreign-uuid="{{ attr.uuid }}"
>
<legend> <legend>
{{ attr.name }} {{ attr.name }}
</legend> </legend>