Show actor sheet when clicking actors in item browser (#1930)

This commit is contained in:
Carlos Fernandez 2026-05-26 09:46:08 -04:00 committed by GitHub
parent de0ab9d047
commit c2f8b34ef2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 10 deletions

View file

@ -1,3 +1,4 @@
import { getDocFromElement } from '../../helpers/utils.mjs';
import { RefreshType, socketEvent } from '../../systemRegistration/socket.mjs'; import { RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -47,7 +48,8 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
expandContent: this.expandContent, expandContent: this.expandContent,
resetFilters: this.resetFilters, resetFilters: this.resetFilters,
sortList: this.sortList, sortList: this.sortList,
openSettings: this.openSettings openSettings: this.openSettings,
viewSheet: this.#onViewSheet
}, },
position: { position: {
left: 100, left: 100,
@ -306,7 +308,8 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
{ {
items: this.items, items: this.items,
menu: this.selectedMenu, menu: this.selectedMenu,
formatLabel: this.formatLabel formatLabel: this.formatLabel,
viewSheet: this.items[0] instanceof Actor
} }
); );
@ -568,6 +571,11 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
} }
} }
static async #onViewSheet(_, target) {
const document = await getDocFromElement(target);
document?.sheet?.render(true);
}
_createDragProcess() { _createDragProcess() {
new foundry.applications.ux.DragDrop.implementation({ new foundry.applications.ux.DragDrop.implementation({
dragSelector: '.item-container', dragSelector: '.item-container',

View file

@ -245,7 +245,7 @@
} }
.item-list-header, .item-list-header,
.item-list [data-action='expandContent'] { .item-list .item-info[data-action] {
display: flex; display: flex;
> * { > * {

View file

@ -1,7 +1,7 @@
{{#each items}} {{#each items}}
<div class="item-container" data-item-uuid="{{uuid}}" draggable="true"> <div class="item-container" data-item-uuid="{{uuid}}" draggable="true">
<div class="item-header"> <div class="item-header">
<div class="item-info" data-action="expandContent"> <div class="item-info" {{#if @root.viewSheet}}data-action="viewSheet"{{else}}data-action="expandContent"{{/if}}>
<img src="{{img}}" data-item-key="img" class="item-list-img"> <img src="{{img}}" data-item-key="img" class="item-list-img">
<span data-item-key="name" class="item-list-name">{{name}}</span> <span data-item-key="name" class="item-list-name">{{name}}</span>
{{#each ../menu.data.columns}} {{#each ../menu.data.columns}}
@ -9,11 +9,13 @@
{{/each}} {{/each}}
</div> </div>
</div> </div>
{{#unless viewSheet}}
<div class="item-desc extensible"> <div class="item-desc extensible">
<span class="wrapper"> <span class="wrapper">
{{{system.enrichedTags}}} {{{system.enrichedTags}}}
{{{system.enrichedDescription}}} {{{system.enrichedDescription}}}
</span> </span>
</div> </div>
{{/unless}}
</div> </div>
{{/each}} {{/each}}