diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 0a500414..5ca1f257 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -8,6 +8,7 @@ import { DS4CreatureActorSheet } from "./actor/sheets/creature-sheet"; import { createCheckRoll } from "./rolls/check-factory"; import { registerSystemSettings } from "./settings"; import { migration } from "./migrations"; +import handlebarsHelpers from "./handlebars-helpers"; Hooks.once("init", async () => { console.log(`DS4 | Initializing the DS4 Game System\n${DS4.ASCII}`); @@ -39,7 +40,8 @@ Hooks.once("init", async () => { Items.unregisterSheet("core", ItemSheet); Items.registerSheet("ds4", DS4ItemSheet, { makeDefault: true }); - registerHandlebarsPartials(); + await registerHandlebarsPartials(); + registerHandlebarsHelpers(); }); async function registerHandlebarsPartials() { @@ -65,6 +67,10 @@ async function registerHandlebarsPartials() { return loadTemplates(templatePaths); } +function registerHandlebarsHelpers() { + Object.entries(handlebarsHelpers).forEach(([key, helper]) => Handlebars.registerHelper(key, helper)); +} + /** * This function runs after game data has been requested and loaded from the servers, so entities exist */ diff --git a/src/module/handlebars-helpers.ts b/src/module/handlebars-helpers.ts new file mode 100644 index 00000000..2790ea43 --- /dev/null +++ b/src/module/handlebars-helpers.ts @@ -0,0 +1,6 @@ +export default { htmlToPlainText }; + +function htmlToPlainText(input: string | null | undefined): string | null | undefined { + if (!input) return; + return $(input).text(); +} diff --git a/src/scss/components/_forms.scss b/src/scss/components/_forms.scss index 9f8f8174..7da745c8 100644 --- a/src/scss/components/_forms.scss +++ b/src/scss/components/_forms.scss @@ -28,15 +28,16 @@ header.sheet-header { padding: 0px; margin: $header-top-margin 10px $header-top-margin 0; border-bottom: 0; + @include font-heading-upper; + display: block; input { width: 100%; height: 100%; margin: 0; border: none; background-color: transparent; + @include font-heading-upper; } - @include font-heading-upper; - display: block; } h2.item-type { @include font-heading-upper; diff --git a/src/scss/components/_tabs.scss b/src/scss/components/_tabs.scss index fbeb2350..b46da6b6 100644 --- a/src/scss/components/_tabs.scss +++ b/src/scss/components/_tabs.scss @@ -1,10 +1,10 @@ nav.tabs { - height: 40px; + height: auto; border-top: 2px groove $c-border-groove; border-bottom: 2px groove $c-border-groove; .item { - line-height: 40px; + // line-height: 40px; font-weight: bold; } diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index 681a9a7d..41c8edd8 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -79,11 +79,12 @@ data-dtype="Number" data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" /> {{!-- name --}} + data-property="name" title="{{htmlToPlainText item.data.data.description}}" /> {{!-- item type specifics --}} {{> @partial-block}} {{!-- description --}} -
{{{item.data.data.description}}}
+
+ {{{item.data.data.description}}}
{{!-- control buttons --}} {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} @@ -194,4 +195,4 @@ {{/itemListEntry}} {{/each}} -{{/ifHasItemOfType}} \ No newline at end of file +{{/ifHasItemOfType}} diff --git a/src/templates/actor/partials/special-creature-abilities-overview.hbs b/src/templates/actor/partials/special-creature-abilities-overview.hbs index a79d5d27..8b9f5195 100644 --- a/src/templates/actor/partials/special-creature-abilities-overview.hbs +++ b/src/templates/actor/partials/special-creature-abilities-overview.hbs @@ -20,9 +20,10 @@ {{!-- name --}} + data-property="name" title="{{htmlToPlainText item.data.data.description}}"> {{!-- description --}} -
{{{item.data.data.description}}}
+
+ {{{item.data.data.description}}}
{{!-- control buttons --}} {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index d9d72357..8bd974ad 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -10,24 +10,25 @@ !-- @param unitAbbrs: mapping of allowed unitDatum.unit values to unit abbreviation --}} {{#*inline "unit"}} -
+
{{#if unitDatum.value }} {{unitDatum.value}} {{lookup unitAbbrs unitDatum.unit}} {{else}}-{{/if}}
{{/inline}} -{{!-- +{{!-- !-- Two templates based on the "unit" template for displaying values with unit. !-- Both accept a `config` object holding the unitNames and unitAbbr instead of !-- directly handing over the latter two. --}} {{#*inline "temporalUnit"}} -{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} +{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum +localizationString=localizationString}} {{/inline}} {{#*inline "distanceUnit"}} -{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} +{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum +localizationString=localizationString}} {{/inline}} @@ -38,7 +39,8 @@
  1. {{!-- equipped --}} -
    {{localize 'DS4.ItemEquippedAbbr'}}
    +
    {{localize 'DS4.ItemEquippedAbbr'}} +
    {{!-- image --}}
    {{!-- name --}} @@ -52,7 +54,8 @@ {{!-- duration --}}
    {{!-- cooldown duration --}} -
    +
    {{!-- description --}} {{!--
    {{localize 'DS4.Description'}}
    --}} {{!-- control buttons placeholder --}} @@ -60,29 +63,31 @@
  2. {{#each itemsByType.spell as |item id|}}
  3. - + {{!-- image --}}
    {{!-- name --}} + data-property="name" title="{{htmlToPlainText item.data.data.description}}" /> {{!-- spell type --}}
    {{!-- spell bonus --}} - + {{!-- max. distance --}} - {{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance config=../config}} + {{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance + config=../config}} {{!-- duration --}} {{> temporalUnit localizationString='DS4.SpellDuration' unitDatum=item.data.data.duration config=../config}} {{!-- cooldown duration --}} - {{> temporalUnit localizationString='DS4.SpellCooldownDuration' unitDatum=item.data.data.cooldownDuration config=../config}} + {{> temporalUnit localizationString='DS4.SpellCooldownDuration' unitDatum=item.data.data.cooldownDuration + config=../config}} {{!-- description --}} {{!--
    {{{item.data.data.description}}}
    --}} {{!-- control buttons --}} @@ -92,4 +97,4 @@
{{!-- add button --}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='spell' }} -
\ No newline at end of file + diff --git a/src/templates/actor/partials/talents-abilities-overview.hbs b/src/templates/actor/partials/talents-abilities-overview.hbs index 19bac512..70a4d43c 100644 --- a/src/templates/actor/partials/talents-abilities-overview.hbs +++ b/src/templates/actor/partials/talents-abilities-overview.hbs @@ -14,7 +14,7 @@ --}} {{#*inline "ifHasItemOfType"}} {{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}} - {{> @partial-block}} +{{> @partial-block}} {{/if}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} {{/inline}} @@ -50,7 +50,7 @@ {{!-- name --}} + data-property="name" title="{{htmlToPlainText item.data.data.description}}">
{{!-- acquired rank --}} {{> talentRankValue item=item property='base' localizeString='DS4.TalentRankBase'}} @@ -65,7 +65,8 @@ {{> talentRankValue item=item property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}}
{{!-- description --}} -
{{{item.data.data.description}}}
+
+ {{{item.data.data.description}}}
{{!-- control buttons --}} {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} @@ -88,9 +89,10 @@ {{!-- name --}} + data-property="name" title="{{htmlToPlainText item.data.data.description}}""> {{!-- description --}} -
{{{item.data.data.description}}}
+
+ {{{item.data.data.description}}}
{{!-- control buttons --}} {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} @@ -170,4 +172,4 @@ {{/each}} {{/ifHasItemOfType}} - \ No newline at end of file +