From fc9f4b49b52f2a271b782fc77c7df61e75933bc9 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Thu, 3 Nov 2022 23:02:46 +0100 Subject: [PATCH] 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. --- scss/components/actor/_actor_header.scss | 4 +++- scss/components/actor/_description.scss | 9 ++++++++ scss/ds4.scss | 1 + src/actor/actor-sheet.ts | 1 + src/handlebars/handlebars-partials.ts | 1 + .../sheets/actor/components/actor-header.hbs | 6 +++++- .../sheets/actor/components/description.hbs | 10 +++++++++ templates/sheets/actor/limited-sheet.hbs | 21 +++++++++++++++++++ templates/sheets/actor/tabs/description.hbs | 3 +-- 9 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 scss/components/actor/_description.scss create mode 100644 templates/sheets/actor/components/description.hbs create mode 100644 templates/sheets/actor/limited-sheet.hbs diff --git a/scss/components/actor/_actor_header.scss b/scss/components/actor/_actor_header.scss index 075fc3ed..087f3969 100644 --- a/scss/components/actor/_actor_header.scss +++ b/scss/components/actor/_actor_header.scss @@ -14,9 +14,11 @@ &__img { border: none; - cursor: pointer; height: 100px; width: 100px; + &--editable { + cursor: pointer; + } } &__data { diff --git a/scss/components/actor/_description.scss b/scss/components/actor/_description.scss new file mode 100644 index 00000000..35addc9c --- /dev/null +++ b/scss/components/actor/_description.scss @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2022 Johannes Loher + * + * SPDX-License-Identifier: MIT + */ + +.ds4-description { + height: 100%; +} diff --git a/scss/ds4.scss b/scss/ds4.scss index 84bf078c..c854abe4 100644 --- a/scss/ds4.scss +++ b/scss/ds4.scss @@ -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"; diff --git a/src/actor/actor-sheet.ts b/src/actor/actor-sheet.ts index 50224e95..29974877 100644 --- a/src/actor/actor-sheet.ts +++ b/src/actor/actor-sheet.ts @@ -39,6 +39,7 @@ export class DS4ActorSheet extends ActorSheet { "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", diff --git a/templates/sheets/actor/components/actor-header.hbs b/templates/sheets/actor/components/actor-header.hbs index dba65aba..c6b13c78 100644 --- a/templates/sheets/actor/components/actor-header.hbs +++ b/templates/sheets/actor/components/actor-header.hbs @@ -11,7 +11,7 @@ SPDX-License-Identifier: MIT !-- @param @partial-block: Properties to render in the second header row. --}}
- {{localize 'DS4.ActorImageAltText'}}
@@ -20,10 +20,14 @@ SPDX-License-Identifier: MIT + {{#unless limited}} {{> systems/ds4/templates/sheets/actor/components/actor-progression.hbs}} + {{/unless}}
+ {{#unless limited}}
{{> @partial-block}}
+ {{/unless}}
diff --git a/templates/sheets/actor/components/description.hbs b/templates/sheets/actor/components/description.hbs new file mode 100644 index 00000000..d9577545 --- /dev/null +++ b/templates/sheets/actor/components/description.hbs @@ -0,0 +1,10 @@ +{{!-- +SPDX-FileCopyrightText: 2021 Johannes Loher + +SPDX-License-Identifier: MIT +--}} + +
+ {{editor content=data.data.baseInfo.description target="data.baseInfo.description" button=true owner=owner + editable=editable}} +
diff --git a/templates/sheets/actor/limited-sheet.hbs b/templates/sheets/actor/limited-sheet.hbs new file mode 100644 index 00000000..66497eb2 --- /dev/null +++ b/templates/sheets/actor/limited-sheet.hbs @@ -0,0 +1,21 @@ +{{!-- +SPDX-FileCopyrightText: 2022 Johannes Loher + +SPDX-License-Identifier: MIT +--}} + +
+ {{!-- Header --}} + {{#> systems/ds4/templates/sheets/actor/components/actor-header.hbs}} + {{/systems/ds4/templates/sheets/actor/components/actor-header.hbs}} + + + {{!-- 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}} +
+
diff --git a/templates/sheets/actor/tabs/description.hbs b/templates/sheets/actor/tabs/description.hbs index abb9471a..3f202525 100644 --- a/templates/sheets/actor/tabs/description.hbs +++ b/templates/sheets/actor/tabs/description.hbs @@ -5,6 +5,5 @@ SPDX-License-Identifier: MIT --}}
- {{editor content=data.data.baseInfo.description target="data.baseInfo.description" button=true owner=owner - editable=editable}} + {{> systems/ds4/templates/sheets/actor/components/description.hbs}}