ds4/src/templates/actor/partials/talents-abilities-overview.hbs

150 lines
5.8 KiB
Handlebars
Raw Normal View History

{{!-- TODO: Refactor to avoid code duplication with creature-special-abilities-overview and talents-overview --}}
{{!-- ======================================================================== --}}
{{!-- INLINE PARTIAL DEFINITIONS --}}
{{!-- ======================================================================== --}}
{{!--
!-- Render the given partial block only if the given itemsArray has length > 0,
!-- else only an add button.
!--
!-- @param itemsArray: the array with the items to check the length of
!-- @param dataType: the string type of the item
--}}
{{#*inline "ifHasItemOfType"}}
{{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}}
{{> @partial-block}}
{{/if}}
2021-01-23 23:44:49 +01:00
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
{{/inline}}
{{!--
!-- Render a talent list row from a given item.
!-- It is a flexbox with a child for each item value of interest.
!-- The partial assumes a variable item to be given in the context.
!--
!-- @param item: hand over the item to the partial as hash parameter
--}}
{{#*inline "talentListEntry"}}
2021-02-25 22:22:05 +01:00
<li class="ds4-item-list__row item" data-item-id="{{item._id}}">
2021-01-07 20:20:40 +01:00
{{!-- image --}}
2021-02-25 22:22:05 +01:00
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
2021-01-07 20:20:40 +01:00
{{!-- name --}}
2021-02-25 22:22:05 +01:00
<input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
data-property="name" title="{{htmlToPlainText item.data.description}}">
2021-02-25 22:22:05 +01:00
{{!-- talent tank equation --}}
{{> systems/ds4/templates/actor/partials/talent-rank-equation.hbs talentRank=item.data.rank}}
2021-01-07 20:20:40 +01:00
{{!-- description --}}
2021-02-25 22:22:05 +01:00
<div class="ds4-item-list__description" title="{{htmlToPlainText item.data.description}}">
{{{item.data.description}}}</div>
2021-01-07 20:20:40 +01:00
{{!-- control buttons --}}
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
</li>
{{/inline}}
2021-02-25 22:22:05 +01:00
{{!--
!-- Render a list header for a base item list entry from a given item.
!-- The partial assumes a variable dataType to be given in the context.
--}}
{{#*inline "talentListHeader"}}
<li class="ds4-item-list__row ds4-item-list__row--header">
{{!-- image --}}
<div></div>
{{!-- name --}}
<div>{{localize 'DS4.ItemName'}}</div>
{{!-- rank info --}}
<div>{{localize 'DS4.TalentRank'}}</div>
{{!-- description --}}
<div>{{localize 'DS4.Description'}}</div>
{{!-- control buttons placeholder --}}
<div></div>
</li>
{{/inline}}
2021-01-07 20:20:40 +01:00
{{!--
!-- Render a list row for a base item from a given item.
!-- Base item means it just has an image, a description, and a name (and effects).
2021-01-07 20:20:40 +01:00
!-- It is a flexbox with a child for each item value of interest.
!-- The partial assumes a variable item to be given in the context.
!--
!-- @param item: hand over the item to the partial as hash parameter
--}}
{{#*inline "baseItemListEntry"}}
2021-02-25 22:22:05 +01:00
<li class="ds4-item-list__row item" data-item-id="{{item._id}}">
2021-01-07 20:20:40 +01:00
{{!-- image --}}
2021-02-25 22:22:05 +01:00
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
2021-01-07 20:20:40 +01:00
{{!-- name --}}
2021-02-25 22:22:05 +01:00
<input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
data-property="name" title="{{htmlToPlainText item.data.description}}">
2021-01-07 20:20:40 +01:00
{{!-- description --}}
2021-02-25 22:22:05 +01:00
<div class="ds4-item-list__description" title="{{htmlToPlainText item.data.description}}">
{{{item.data.description}}}</div>
2021-01-07 20:20:40 +01:00
{{!-- control buttons --}}
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
</li>
{{/inline}}
{{!--
2021-01-23 23:44:49 +01:00
!-- Render a list header for a base item list entry from a given item.
!-- The partial assumes a variable dataType to be given in the context.
--}}
{{#*inline "baseItemListHeader"}}
2021-02-25 22:22:05 +01:00
<li class="ds4-item-list__row ds4-item-list__row--header">
{{!-- image --}}
2021-02-25 22:22:05 +01:00
<div></div>
{{!-- name --}}
2021-02-25 22:22:05 +01:00
<div>{{localize 'DS4.ItemName'}}</div>
{{!-- description --}}
2021-02-25 22:22:05 +01:00
<div>{{localize 'DS4.Description'}}</div>
2021-01-23 23:44:49 +01:00
{{!-- control buttons placeholder --}}
<div></div>
</li>
{{/inline}}
{{!-- ======================================================================== --}}
<div class="tab talents-abilities" data-group="primary" data-tab="talents-abilities">
2021-02-25 22:22:05 +01:00
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeTalentPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent' }}
2021-02-25 22:22:05 +01:00
<ol class="ds4-item-list ds4-item-list--talent item-list">
{{> talentListHeader}}
{{#each itemsByType.talent as |item id|}}
2021-01-07 20:20:40 +01:00
{{> talentListEntry item=item}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
2021-01-07 20:20:40 +01:00
2021-02-25 22:22:05 +01:00
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeRacialAbilityPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.racialAbility dataType='racialAbility' }}
2021-02-25 22:22:05 +01:00
<ol class="ds4-item-list ds4-item-list--racial-ability item-list">
{{> baseItemListHeader}}
2021-01-07 20:20:40 +01:00
{{#each itemsByType.racialAbility as |item id|}}
{{> baseItemListEntry item=item}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
2021-02-25 22:22:05 +01:00
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeLanguagePlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.language dataType='language' }}
2021-02-25 22:22:05 +01:00
<ol class="ds4-item-list ds4-item-list--language item-list">
{{> baseItemListHeader}}
{{#each itemsByType.language as |item id|}}
{{> baseItemListEntry item=item}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
2021-02-25 22:22:05 +01:00
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeAlphabetPlural'}}</h4>
{{#> ifHasItemOfType itemsArray=itemsByType.alphabet dataType='alphabet' }}
2021-02-25 22:22:05 +01:00
<ol class="ds4-item-list ds4-item-list--alphabet item-list">
{{> baseItemListHeader}}
{{#each itemsByType.alphabet as |item id|}}
{{> baseItemListEntry item=item}}
{{/each}}
</ol>
{{/ifHasItemOfType}}
</div>