restores opening of linked documents in their respective sheet

feature/applicationv2
macniel 2025-10-20 10:43:49 +02:00
parent ee578e430e
commit e118e8ba92
7 changed files with 27 additions and 44 deletions

View File

@ -118,8 +118,10 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
}
}
static #openEmbeddedDocument(documentId) {
this.object.items.get(documentId).sheet.render(true)
static #openEmbeddedDocument(event) {
const dataset = event.target.parentElement.dataset
const id = dataset.itemId ?? dataset.id
this.document.items.get(id).sheet.render(true)
}
/**

View File

@ -79,14 +79,17 @@ export class GroupSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
return s
}
static async #openEmbeddedDocument(evt) {
const {documentId} = evt.srcElement.dataset
this.document.items.get(documentId).sheet.render(true)
static #openEmbeddedDocument(event) {
const dataset = event.target.parentElement.dataset
const id = dataset.itemId ?? dataset.id
this.document.items.get(id).sheet.render(true)
}
static async #openActorDocument(evt) {
const {id} = evt.srcElement.dataset
evt.stopPropagation()
static async #openActorDocument(event) {
const dataset = event.target.parentElement.dataset
const id = dataset.itemId ?? dataset.id
game.actors.get(id).sheet.render(true)
}

View File

@ -37,7 +37,7 @@
data-lkp="{{../lkp}}" data-deity="{{this.deity}}">
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}" data-operation="openActorSheet">
<td class="clickable" data-id="{{this.id}}" data-action="openActorSheet">
{{this.name}}</td>
<td></td>
</tr>
@ -56,7 +56,7 @@
data-lkp="{{../lkp}}" data-deity="{{this.deity}}">
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}" data-operation="openActorSheet">
<td class="clickable" data-id="{{this.id}}" data-action="openActorSheet">
{{this.name}}</td>
<td></td>
</tr>
@ -77,7 +77,7 @@
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}"
data-operation="openActorSheet">{{this.name}}</td>
data-action="openActorSheet">{{this.name}}</td>
</tr>
{{/each}}
{{/if}}
@ -96,7 +96,7 @@
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}"
data-operation="openActorSheet">{{this.name}}</td>
data-action="openActorSheet">{{this.name}}</td>
</tr>
{{/each}}
{{/if}}
@ -115,7 +115,7 @@
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}"
data-operation="openActorSheet">{{this.name}}</td>
data-action="openActorSheet">{{this.name}}</td>
</tr>
{{/each}}{{/if}}
{{#if this.countV}}
@ -133,7 +133,7 @@
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}"
data-operation="openActorSheet">{{this.name}}</td>
data-action="openActorSheet">{{this.name}}</td>
</tr>
{{/each}}
{{/if}}
@ -152,7 +152,7 @@
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}"
data-operation="openActorSheet">{{this.name}}</td>
data-action="openActorSheet">{{this.name}}</td>
</tr>
{{/each}}
{{/if}}{{#if this.countVII}}
@ -170,7 +170,7 @@
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}"
data-operation="openActorSheet">{{this.name}}</td>
data-action="openActorSheet">{{this.name}}</td>
</tr>
{{/each}}
{{/if}}{{#if this.countVIII}}
@ -188,7 +188,7 @@
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}"
data-operation="openActorSheet">{{this.name}}</td>
data-action="openActorSheet">{{this.name}}</td>
</tr>
{{/each}}
{{/if}}

View File

@ -32,7 +32,7 @@
<td class="spell rollable">
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td>
<td class="clickable" data-id="{{this.id}}" data-operation="openActorSheet">
<td class="clickable" data-id="{{this.id}}" data-action="openActorSheet">
<span>{{this.name}}</span></td>
<td>{{this.eigenschaft1}}</td>
<td>{{this.eigenschaft2}}</td>

View File

@ -2,27 +2,6 @@
data-tab="{{tabs.inventory.id}}"
data-group="{{tabs.inventory.group}}">
<table class="inventory-table">
<thead>
<tr>
<th colspan="2"></th>
<th>Anzahl</th>
<th>Gewicht</th>
{{> "systems/DSA_4-1/templates/ui/partial-equipment-button.hbs" inventoryItems}}
</tr>
</thead>
<tbody>
{{#each inventoryItems}}
<tr class="equipment" data-item-id="{{this.id}}" draggable="true">
<td class="icon"><img alt="" src="{{this.icon}}" width="16" height="16"></td>
<td class="name">{{this.name}}</td>
<td class="quantity">{{this.quantity}}</td>
<td class="weight">{{this.weight}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</section>

View File

@ -6,7 +6,7 @@
{{#each this.characters}}
{{#if this.isVisible}}
<div class="character">
<div class="header clickable" data-id="{{this.id}}" data-operation="openActorSheet">
<div class="header clickable" data-id="{{this.id}}" data-action="openActorSheet">
<img class="profile-img" src="{{this.img}}" style="object-fit: cover;"
title="{{this.name}}" alt="{{this.name}}"/>
<span class="name">{{this.name}}</span>
@ -24,8 +24,7 @@
{{#each this.fields.head}}
<th>
<div class="character">
<div class="header clickable" data-id="{{this.id}}"
data-operation="openActorSheet">
<div class="header clickable" data-id="{{this.id}}" data-action="openActorDocument">
<img class="profile-img" src="{{this.img}}" style="object-fit: cover;"
title="{{this.name}}" alt="{{this.name}}"/>
<span class="name">{{this.name}}</span>

View File

@ -11,7 +11,7 @@
{{#each this}}
<tr class="equipment" data-item-id="{{this.id}}" draggable="true">
<tr class="equipment" data-item-id="{{this.id}}" draggable="true" data-action="openEmbeddedDocument">
<td class="icon"><img alt="" src="{{this.icon}}" width="16" height="16"></td>
<td class="name">{{this.name}}</td>
<td class="quantity">{{this.quantity}}</td>