feat: add a special actor sheet that is displayed to users with the LIMITED permission for the actor

This actor sheet only shows image, name, and biography/description of the actor.
This commit is contained in:
Johannes Loher 2022-11-03 23:02:46 +01:00
parent 63e888e39d
commit fc9f4b49b5
9 changed files with 52 additions and 4 deletions

View file

@ -14,9 +14,11 @@
&__img {
border: none;
cursor: pointer;
height: 100px;
width: 100px;
&--editable {
cursor: pointer;
}
}
&__data {

View file

@ -0,0 +1,9 @@
/*
* SPDX-FileCopyrightText: 2022 Johannes Loher
*
* SPDX-License-Identifier: MIT
*/
.ds4-description {
height: 100%;
}

View file

@ -35,6 +35,7 @@
@use "components/actor/core_value";
@use "components/actor/core_values";
@use "components/actor/currency";
@use "components/actor/description";
@use "components/actor/profile";
@use "components/actor/talent_rank_equation";

View file

@ -39,6 +39,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options, DS4ActorSheetD
override get template(): string {
const basePath = "systems/ds4/templates/sheets/actor";
if (!getGame().user?.isGM && this.actor.limited) return `${basePath}/limited-sheet.hbs`;
return `${basePath}/${this.actor.data.type}-sheet.hbs`;
}

View file

@ -18,6 +18,7 @@ export default async function registerHandlebarsPartials(): Promise<void> {
"systems/ds4/templates/sheets/actor/components/core-values.hbs",
"systems/ds4/templates/sheets/actor/components/creature-properties.hbs",
"systems/ds4/templates/sheets/actor/components/currency.hbs",
"systems/ds4/templates/sheets/actor/components/description.hbs",
"systems/ds4/templates/sheets/actor/components/effect-list-entry.hbs",
"systems/ds4/templates/sheets/actor/components/effect-list-header.hbs",
"systems/ds4/templates/sheets/actor/components/item-list-entry.hbs",

View file

@ -11,7 +11,7 @@ SPDX-License-Identifier: MIT
!-- @param @partial-block: Properties to render in the second header row.
--}}
<header class="ds4-actor-header">
<img class="ds4-actor-header__img" src="{{data.img}}" data-edit="img" alt="{{localize 'DS4.ActorImageAltText'}}"
<img class="ds4-actor-header__img{{#if editable}} ds4-actor-header__img--editable{{/if}}" src="{{data.img}}" data-edit="img" alt="{{localize 'DS4.ActorImageAltText'}}"
title="{{data.name}}" height="100" width="100" />
<div class="ds4-actor-header__data">
<div class="ds4-actor-header__data-row">
@ -20,10 +20,14 @@ SPDX-License-Identifier: MIT
<input class="ds4-actor-header__name-input" name="name" type="text" id="name-{{data._id}}"
value="{{data.name}}" placeholder="{{localize 'DS4.ActorName'}}" />
</h1>
{{#unless limited}}
{{> systems/ds4/templates/sheets/actor/components/actor-progression.hbs}}
{{/unless}}
</div>
{{#unless limited}}
<div class="ds4-actor-header__data-row">
{{> @partial-block}}
</div>
{{/unless}}
</div>
</header>

View file

@ -0,0 +1,10 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-License-Identifier: MIT
--}}
<div class="ds4-description">
{{editor content=data.data.baseInfo.description target="data.baseInfo.description" button=true owner=owner
editable=editable}}
</div>

View file

@ -0,0 +1,21 @@
{{!--
SPDX-FileCopyrightText: 2022 Johannes Loher
SPDX-License-Identifier: MIT
--}}
<form class="{{cssClass}} ds4-sheet-form" autocomplete="off">
{{!-- Header --}}
{{#> systems/ds4/templates/sheets/actor/components/actor-header.hbs}}
{{/systems/ds4/templates/sheets/actor/components/actor-header.hbs}}
{{!-- Sheet Body --}}
<section class="ds4-sheet-body">
{{#if (eq data.type 'character')}}
{{> systems/ds4/templates/sheets/actor/components/biography.hbs}}
{{else}}
{{> systems/ds4/templates/sheets/actor/components/description.hbs}}
{{/if}}
</section>
</form>

View file

@ -5,6 +5,5 @@ SPDX-License-Identifier: MIT
--}}
<div class="ds4-sheet-tab tab description" data-group="primary" data-tab="description">
{{editor content=data.data.baseInfo.description target="data.baseInfo.description" button=true owner=owner
editable=editable}}
{{> systems/ds4/templates/sheets/actor/components/description.hbs}}
</div>