add support for limited sheets
This commit is contained in:
@@ -99,21 +99,48 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) {
|
||||
return context;
|
||||
}
|
||||
|
||||
/** @override - Manipulate which PARTS are rendered. */
|
||||
_configureRenderOptions(options) {
|
||||
super._configureRenderOptions(options);
|
||||
|
||||
if (!this.actor.limited) return;
|
||||
|
||||
// Hide most PARTS on limited sheets.
|
||||
options.parts = ["header"];
|
||||
|
||||
if (this.actor.type === "agent") options.parts.push("tabs", "bio");
|
||||
}
|
||||
|
||||
/** @override - Manipulate which TABS are rendered. */
|
||||
_prepareTabs(group) {
|
||||
const tabs = super._prepareTabs(group);
|
||||
|
||||
// Hide most TABS on limited sheets.
|
||||
if (!this.actor.limited || this.actor.type !== "agent") return tabs;
|
||||
|
||||
// Override settings to activate bio tab (only tab shown).
|
||||
return { bio: { ...tabs.bio, active: true, cssClass: "active" } };
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _onRender(context, options) {
|
||||
await super._onRender(context, options);
|
||||
const { element } = this;
|
||||
|
||||
// Reset height if this is a limited sheet.
|
||||
if (this.actor.limited) {
|
||||
this.setPosition({ height: "auto" });
|
||||
this.setPosition({ height: Number.parseInt(this.element.style.height) });
|
||||
}
|
||||
|
||||
this._setRightClickListeners();
|
||||
|
||||
if (this.actor.isOwner) {
|
||||
const handler = (ev) => this._onDragStart(ev);
|
||||
element.querySelectorAll("li.item").forEach((li) => {
|
||||
if (li.classList.contains("inventory-header")) return;
|
||||
li.setAttribute("draggable", true);
|
||||
li.addEventListener("dragstart", handler, false);
|
||||
});
|
||||
}
|
||||
const handler = (ev) => this._onDragStart(ev);
|
||||
element.querySelectorAll("li.item").forEach((li) => {
|
||||
if (li.classList.contains("inventory-header")) return;
|
||||
li.setAttribute("draggable", true);
|
||||
li.addEventListener("dragstart", handler, false);
|
||||
});
|
||||
}
|
||||
|
||||
/** @override - Add buttons to the header controls. */
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
*/
|
||||
export default async function preloadHandlebarsTemplates() {
|
||||
return foundry.applications.handlebars.loadTemplates([
|
||||
"systems/deltagreen/templates/actor/limited-sheet.html",
|
||||
"systems/deltagreen/templates/actor/npc-limited-sheet.html",
|
||||
"systems/deltagreen/templates/dialog/modify-percentile-roll.html",
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<form class="{{cssClass}} {{getCharacterSheetStyle}} flexcol" autocomplete="off">
|
||||
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
|
||||
<div class="header-fields">
|
||||
|
||||
{{!-- Name, Profession, Portrait --}}
|
||||
<div class="flexrow">
|
||||
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="150" width="100"/>
|
||||
<div class="horizontal-flex-column">
|
||||
<div>
|
||||
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" title="{{localize 'DG.AgentNameFieldTooltip' }}"/></h1>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="profession"><input name="system.biography.profession" type="text" value="{{actor.system.biography.profession}}" placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}"/></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="bio">{{localize 'DG.Navigation.CV'}}</a>
|
||||
</nav>
|
||||
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
{{!-- Biography Tab --}}
|
||||
<div class="tab bio" data-group="primary" data-tab="bio">
|
||||
{{> "systems/deltagreen/templates/actor/partials/cv-partial.html" }}
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<form class="{{cssClass}} {{getCharacterSheetStyle}} flexcol" autocomplete="off">
|
||||
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
|
||||
<div class="header-fields">
|
||||
|
||||
{{!-- Name, Profession, Portrait --}}
|
||||
<div class="flexrow">
|
||||
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="150" width="100"/>
|
||||
<div class="horizontal-flex-column">
|
||||
<div>
|
||||
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" title="{{localize 'DG.AgentNameFieldTooltip' }}"/></h1>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="profession"><input name="system.biography.profession" type="text" value="{{actor.system.biography.profession}}" placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}"/></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user