WIP: Add effects tab to actor sheets

This commit is contained in:
Johannes Loher 2021-07-20 02:16:43 +02:00
parent 02ba524eea
commit e39d245aff
20 changed files with 267 additions and 49 deletions

View file

@ -18,6 +18,7 @@ SPDX-License-Identifier: MIT
<a class="ds4-sheet-tab-nav__item item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a>
<a class="ds4-sheet-tab-nav__item item" data-tab="spells">{{localize 'DS4.HeadingSpells'}}</a>
<a class="ds4-sheet-tab-nav__item item" data-tab="abilities">{{localize 'DS4.HeadingAbilities'}}</a>
<a class="ds4-sheet-tab-nav__item item" data-tab="effects">{{localize 'DS4.HeadingEffects'}}</a>
<a class="ds4-sheet-tab-nav__item item" data-tab="biography">{{localize 'DS4.HeadingBiography'}}</a>
</nav>
@ -37,6 +38,9 @@ SPDX-License-Identifier: MIT
{{!-- Abilities Tab --}}
{{> systems/ds4/templates/sheets/actor/tabs/abilities.hbs}}
{{!-- Effects Tab --}}
{{> systems/ds4/templates/sheets/actor/tabs/effects.hbs}}
{{!-- Biography Tab --}}
{{> systems/ds4/templates/sheets/actor/tabs/biography.hbs}}

View file

@ -0,0 +1,19 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
{{!
!-- Render an "add" button.
!-- @param class: The css class to use for the link element
!-- @param title: The title to use for the link element (will be localized)
!-- @param type: An optional property to use as data-type attribute
}}
<div>
<a class="{{class}}" title="{{localize title}}" {{#if type}}data-type="{{type}}" {{/if}}>
<i class="fas fa-plus"></i>
{{localize "DS4.UserInteractionAdd"}}
</a>
</div>

View file

@ -0,0 +1,31 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
{{!--
!-- Render an effect list entry row.
!-- @param effectData: The data of the item.
--}}
<li class="ds4-effect-list__row item" data-item-id="{{itemData._id}}">
{{!-- enabled --}}
<input class="ds4-effect-list__editable ds4-effect-list__editable--checkbox effect-change" type="checkbox" {{checked
(ne effectData.disabled)}} data-dtype="Boolean" data-property="disabled"
title="{{localize 'DS4.EffectEnabled'}}">
{{!-- icon --}}
{{> systems/ds4/templates/sheets/actor/components/rollable-image.hbs rollable=false src=effectData.icon
alt=(localize "DS4.EffectIconAltText" label=effectData.label) title=effectData.label}}
{{!-- label --}}
<div title="{{effectData.label}}">{{effectData.label}}</div>
{{!-- source --}}
<div>{{effectData.source}}</div>
{{!-- control buttons --}}
{{> systems/ds4/templates/sheets/actor/components/overview-control-buttons.hbs
class="ds4-effect-list__control-buttons" }}
</li>

View file

@ -0,0 +1,26 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
{{!--
!-- Render an effect list header row.
--}}
<li class="ds4-effect-list__row ds4-effect-list__row--header" data-effect-id="{{effectData._id}}">
{{!-- enabled --}}
<div title="{{localize 'DS4.EffectEnabled'}}">{{localize 'DS4.EffectEnabledAbbr'}}</div>
{{!-- icon --}}
<div></div>
{{!-- label --}}
<div>{{localize 'DS4.EffectLabel'}}</div>
{{!-- origin --}}
<div>{{localize 'DS4.EffectSource'}}</div>
{{!-- control buttons placeholder --}}
<div></div>
</li>

View file

@ -41,7 +41,8 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='weapon'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='weapon'}}
{{!-- ARMOR --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeArmorPlural'}}</h4>
@ -79,7 +80,8 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='armor'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='armor'}}
{{!-- SHIELD --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeShieldPlural'}}</h4>
@ -100,7 +102,8 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='shield'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='shield'}}
{{!-- EQUIPMENT --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeEquipmentPlural'}}</h4>
@ -120,7 +123,8 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='equipment'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='equipment'}}
{{!-- LOOT --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeLootPlural'}}</h4>
@ -139,4 +143,5 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='loot'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='loot'}}

View file

@ -1,17 +0,0 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
{{!
!-- Render an "add" button for adding an item of given data type.
!-- @param dataType: hand over the dataType to the partial as hash parameter
}}
<div class="item-controls">
<a class="item-control item-create" title="Create item" data-type="{{dataType}}">
<i class="fas fa-plus"></i>
{{localize "DS4.UserInteractionAddItem"}}
</a>
</div>

View file

@ -11,7 +11,8 @@ SPDX-License-Identifier: MIT
!-- @param class: Additional CSS class(es) for the controls
--}}
<div class="item-controls {{class}}">
<a class="item-control item-edit" title="{{localize 'DS4.UserInteractionEditItem'}}"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="{{localize 'DS4.UserInteractionDeleteItem'}}"><i
<a class="item-control item-edit" title="{{localize 'DS4.UserInteractionEditItemTitle'}}"><i
class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="{{localize 'DS4.UserInteractionDeleteItemTitle'}}"><i
class="fas fa-trash"></i></a>
</div>

View file

@ -20,6 +20,7 @@ SPDX-License-Identifier: MIT
<a class="ds4-sheet-tab-nav__item item" data-tab="special-creature-abilities">{{localize
'DS4.HeadingSpecialCreatureAbilities'}}</a>
<a class="ds4-sheet-tab-nav__item item" data-tab="spells">{{localize 'DS4.HeadingSpells'}}</a>
<a class="ds4-sheet-tab-nav__item item" data-tab="effects">{{localize 'DS4.HeadingEffects'}}</a>
<a class="ds4-sheet-tab-nav__item item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a>
</nav>
@ -37,6 +38,9 @@ SPDX-License-Identifier: MIT
{{!-- Spells Tab --}}
{{> systems/ds4/templates/sheets/actor/tabs/spells.hbs}}
{{!-- Effects Tab --}}
{{> systems/ds4/templates/sheets/actor/tabs/effects.hbs}}
{{!-- Description Tab --}}
{{> systems/ds4/templates/sheets/actor/tabs/description.hbs}}
</section>

View file

@ -22,7 +22,8 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='talent'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='talent'}}
{{!-- RACIAL ABILITY --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeRacialAbilityPlural'}}</h4>
@ -34,7 +35,8 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='racialAbility'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='racialAbility'}}
{{!-- LANGUAGE --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeLanguagePlural'}}</h4>
@ -46,7 +48,8 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='language'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='language'}}
{{!-- ALPHABET --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeAlphabetPlural'}}</h4>
@ -58,5 +61,6 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='alphabet'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='alphabet'}}
</div>

View file

@ -0,0 +1,19 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
<div class="tab effects" data-group="primary" data-tab="effects">
{{#unless (isEmpty data.effects)}}
<ol class="ds4-effect-list">
{{> systems/ds4/templates/sheets/actor/components/effect-list-header.hbs}}
{{#each enrichedEffects as |effectData id| }}
{{> systems/ds4/templates/sheets/actor/components/effect-list-entry.hbs effectData=effectData}}
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddEffectTitle'
class='effect-create'}}
</div>

View file

@ -14,5 +14,6 @@ SPDX-License-Identifier: MIT
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='specialCreatureAbility'}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='specialCreatureAbility'}}
</div>

View file

@ -93,5 +93,6 @@ titleKey=titleKey}}
{{/each}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/overview-add-button.hbs dataType='spell' }}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='spell'}}
</div>