Add the item UUID into the fieldset and add a context menu to edit/delete primary attributes
This commit is contained in:
parent
60d29adc3e
commit
e9d92d3db1
2 changed files with 31 additions and 1 deletions
|
|
@ -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() {
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue