extract item-list-entry to commonly used partial
This commit is contained in:
parent
0d486647a2
commit
b3ac3cde84
7 changed files with 164 additions and 213 deletions
|
@ -65,6 +65,7 @@ async function registerHandlebarsPartials() {
|
|||
"systems/ds4/templates/actor/partials/creature-inventory.hbs",
|
||||
"systems/ds4/templates/actor/partials/talent-rank-equation.hbs",
|
||||
"systems/ds4/templates/actor/partials/item-list-header.hbs",
|
||||
"systems/ds4/templates/actor/partials/item-list-entry.hbs",
|
||||
];
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
|
|
46
src/templates/actor/partials/item-list-entry.hbs
Normal file
46
src/templates/actor/partials/item-list-entry.hbs
Normal file
|
@ -0,0 +1,46 @@
|
|||
{{!--
|
||||
!-- Render an item list entry row.
|
||||
!-- If the partial is called with a partial block, the partial block
|
||||
!-- content is inserted before the description.
|
||||
|
||||
!-- @param itemData: The data of the item.
|
||||
!-- @param isEquipable: A flag to enable the equipped column.
|
||||
!-- @param hasQuantity: A flag to enable the quantity column.
|
||||
!-- @param hideDescription: A flag to disable the description column.
|
||||
!-- @param @partial-block: Custom column headers can be passed using the partial block.
|
||||
--}}
|
||||
<li class="ds4-item-list__row item" data-item-id="{{itemData._id}}">
|
||||
{{!-- equipped --}}
|
||||
{{#if isEquipable}}
|
||||
<input class="ds4-item-list__editable ds4-item-list__editable--checkbox item-change" type="checkbox" {{checked
|
||||
itemData.data.equipped}} data-dtype="Boolean" data-property="data.equipped"
|
||||
title="{{localize 'DS4.ItemEquipped'}}">
|
||||
{{/if}}
|
||||
|
||||
{{!-- image --}}
|
||||
<div class="ds4-item-list__image" style="background-image: url('{{itemData.img}}')" title="{{itemData.name}}"></div>
|
||||
|
||||
{{!-- amount --}}
|
||||
{{#if hasQuantity}}
|
||||
<input class="ds4-item-list__editable item-change" type="number" min="0" step="1" value="{{itemData.data.quantity}}"
|
||||
data-dtype="Number" data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" />
|
||||
{{/if}}
|
||||
|
||||
{{!-- name --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{itemData.name}}" data-dtype="String"
|
||||
data-property="name" title="{{htmlToPlainText itemData.data.description}}" />
|
||||
|
||||
{{!-- item type specifics --}}
|
||||
{{#if @partial-block }}
|
||||
{{> @partial-block}}
|
||||
{{/if}}
|
||||
|
||||
{{!-- description --}}
|
||||
{{#unless hideDescription}}
|
||||
<div class="ds4-item-list__description" title="{{htmlToPlainText itemData.data.description}}">
|
||||
{{{itemData.data.description}}}</div>
|
||||
{{/unless}}
|
||||
|
||||
{{!-- control buttons --}}
|
||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||
</li>
|
|
@ -13,22 +13,28 @@
|
|||
{{#if isEquipable}}
|
||||
<div title="{{localize 'DS4.ItemEquipped'}}">{{localize 'DS4.ItemEquippedAbbr'}}</div>
|
||||
{{/if}}
|
||||
|
||||
{{!-- image --}}
|
||||
<div></div>
|
||||
|
||||
{{!-- amount --}}
|
||||
{{#if hasQuantity}}
|
||||
<div title="{{localize 'DS4.Quantity'}}">#</div>
|
||||
{{/if}}
|
||||
|
||||
{{!-- name --}}
|
||||
<div>{{localize 'DS4.ItemName'}}</div>
|
||||
|
||||
{{!-- item type specifics --}}
|
||||
{{#if @partial-block }}
|
||||
{{> @partial-block }}
|
||||
{{/if}}
|
||||
|
||||
{{!-- description --}}
|
||||
{{#unless hideDescription}}
|
||||
<div>{{localize 'DS4.Description'}}</div>
|
||||
{{/unless}}
|
||||
|
||||
{{!-- control buttons placeholder --}}
|
||||
<div></div>
|
||||
</li>
|
||||
|
|
|
@ -19,42 +19,6 @@
|
|||
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
|
||||
{{/inline}}
|
||||
|
||||
{{!--
|
||||
!-- Render a list row from a given item.
|
||||
!-- An equipped checkbox is rendered except for the case item.data.type==='loot'.
|
||||
!-- The partial assumes a variable item to be given in the context.
|
||||
!-- If the partial is called with a partial block, the partial block
|
||||
!-- content is inserted before the description.
|
||||
|
||||
!-- @param item: hand over the item to the partial as hash parameter
|
||||
!-- @param partial-block: hand over custom children in the partial block.
|
||||
--}}
|
||||
{{#*inline "itemListEntry"}}
|
||||
<li class="ds4-item-list__row item" data-item-id="{{item._id}}">
|
||||
{{!-- equipped --}}
|
||||
{{#if (ne item.type 'loot')}}
|
||||
<input class="ds4-item-list__editable ds4-item-list__editable--checkbox item-change" type="checkbox" {{checked
|
||||
item.data.equipped}} data-dtype="Boolean" data-property="data.equipped" title="{{localize 'DS4.ItemEquipped'}}">
|
||||
{{/if}}
|
||||
{{!-- image --}}
|
||||
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
|
||||
{{!-- amount --}}
|
||||
<input class="ds4-item-list__editable item-change" type="number" min="0" step="1" value="{{item.data.quantity}}"
|
||||
data-dtype="Number" data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" />
|
||||
{{!-- name --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||
data-property="name" title="{{htmlToPlainText item.data.description}}" />
|
||||
{{!-- item type specifics --}}
|
||||
{{> @partial-block}}
|
||||
{{!-- description --}}
|
||||
<div class="ds4-item-list__description" title="{{htmlToPlainText item.data.description}}">
|
||||
{{{item.data.description}}}</div>
|
||||
{{!-- control buttons --}}
|
||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||
</li>
|
||||
{{/inline}}
|
||||
|
||||
|
||||
{{!-- ======================================================================== --}}
|
||||
|
||||
{{!-- WEAPONS --}}
|
||||
|
@ -62,23 +26,34 @@
|
|||
{{#> ifHasItemOfType itemsArray=itemsByType.weapon dataType='weapon' }}
|
||||
<ol class="ds4-item-list ds4-item-list--weapon item-list">
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}}
|
||||
{{!-- attack type --}}
|
||||
<div class="ds4-item-list__image" title="{{localize 'DS4.AttackType'}}">{{localize 'DS4.AttackTypeAbbr'}}</div>
|
||||
|
||||
{{!-- weapon bonus --}}
|
||||
<div title="{{localize 'DS4.WeaponBonus'}}">
|
||||
{{localize 'DS4.WeaponBonusAbbr'}}
|
||||
</div>
|
||||
|
||||
{{!-- opponent defense --}}
|
||||
<div title="{{localize 'DS4.OpponentDefense'}}">
|
||||
{{localize 'DS4.OpponentDefenseAbbr'}}
|
||||
</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.weapon as |item id|}}
|
||||
{{#> itemListEntry item=item}}
|
||||
|
||||
{{#each itemsByType.weapon as |itemData id|}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}}
|
||||
{{!-- attack type --}}
|
||||
<div class="ds4-item-list__image"
|
||||
style="background-image: url('{{lookup ../../config.icons.attackTypes item.data.attackType}}')"
|
||||
title="{{lookup ../../config.i18n.attackTypes item.data.attackType}}">
|
||||
style="background-image: url('{{lookup ../../config.icons.attackTypes itemData.data.attackType}}')"
|
||||
title="{{lookup ../../config.i18n.attackTypes itemData.data.attackType}}">
|
||||
</div>
|
||||
<div>{{ item.data.weaponBonus}}</div>
|
||||
<div>{{ item.data.opponentDefense}}</div>
|
||||
{{/itemListEntry}}
|
||||
|
||||
{{!-- weapon bonus --}}
|
||||
<div>{{ itemData.data.weaponBonus}}</div>
|
||||
|
||||
{{!-- opponent defense --}}
|
||||
<div>{{ itemData.data.opponentDefense}}</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-entry.hbs}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
@ -88,22 +63,33 @@
|
|||
{{#> ifHasItemOfType itemsArray=itemsByType.armor dataType='armor' }}
|
||||
<ol class="ds4-item-list ds4-item-list--armor item-list">
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}}
|
||||
{{!-- armor material type --}}
|
||||
<div title="{{localize 'DS4.ArmorMaterialType'}}">{{localize 'DS4.ArmorMaterialTypeAbbr'}}</div>
|
||||
|
||||
{{!-- armor type --}}
|
||||
<div title="{{localize 'DS4.ArmorType'}}">{{localize 'DS4.ArmorTypeAbbr'}}</div>
|
||||
|
||||
{{!-- armor value --}}
|
||||
<div title="{{localize 'DS4.ArmorValue'}}">
|
||||
{{localize 'DS4.ArmorValueAbbr'}}
|
||||
</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.armor as |item id|}}
|
||||
{{#> itemListEntry item=item }}
|
||||
<div title="{{lookup ../../config.i18n.armorMaterialTypes item.data.armorMaterialType}}">
|
||||
{{lookup ../../config.i18n.armorMaterialTypesAbbr item.data.armorMaterialType}}
|
||||
|
||||
{{#each itemsByType.armor as |itemData id|}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}}
|
||||
{{!-- armor material type --}}
|
||||
<div title="{{lookup ../../config.i18n.armorMaterialTypes itemData.data.armorMaterialType}}">
|
||||
{{lookup ../../config.i18n.armorMaterialTypesAbbr itemData.data.armorMaterialType}}
|
||||
</div>
|
||||
<div title="{{lookup ../../config.i18n.armorTypes item.data.armorType}}">
|
||||
{{lookup ../../config.i18n.armorTypesAbbr item.data.armorType}}
|
||||
|
||||
{{!-- armor type --}}
|
||||
<div title="{{lookup ../../config.i18n.armorTypes itemData.dataData.armorType}}">
|
||||
{{lookup ../../config.i18n.armorTypesAbbr itemData.dataData.armorType}}
|
||||
</div>
|
||||
<div>{{ item.data.armorValue}}</div>
|
||||
{{/itemListEntry}}
|
||||
|
||||
{{!-- armor value --}}
|
||||
<div>{{ itemData.data.armorValue}}</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-entry.hbs}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
@ -114,31 +100,34 @@
|
|||
{{#> ifHasItemOfType itemsArray=itemsByType.shield dataType='shield' }}
|
||||
<ol class="ds4-item-list ds4-item-list--shield item-list">
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}}
|
||||
{{!-- armor value --}}
|
||||
<div title="{{localize 'DS4.ArmorValue'}}">
|
||||
{{localize 'DS4.ArmorValueAbbr'}}
|
||||
</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.shield as |item id|}}
|
||||
{{#> itemListEntry item=item }}
|
||||
<div>{{item.data.armorValue}}</div>
|
||||
{{/itemListEntry}}
|
||||
{{#each itemsByType.shield as |itemData id|}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}}
|
||||
{{!-- armor value --}}
|
||||
<div>{{itemData.data.armorValue}}</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-entry.hbs}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
||||
{{!-- EQUIPMENT --}}
|
||||
|
||||
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeEquipmentPlural'}}</h4>
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.equipment dataType='equipment' }}
|
||||
<ol class="ds4-item-list ds4-item-list--equipment item-list">
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}}
|
||||
{{!-- storage location --}}
|
||||
<div>{{localize 'DS4.StorageLocation'}}</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.equipment as |item id|}}
|
||||
{{#> itemListEntry item=item }}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{item.data.storageLocation}}"
|
||||
{{#each itemsByType.equipment as |itemData id|}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}}
|
||||
{{!-- storage location --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{itemData.data.storageLocation}}"
|
||||
data-dtype="String" data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}">
|
||||
{{/itemListEntry}}
|
||||
{{/systems/ds4/templates/actor/partials/item-list-entry.hbs}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
@ -148,13 +137,15 @@
|
|||
{{#> ifHasItemOfType itemsArray=itemsByType.loot dataType='loot' }}
|
||||
<ol class="ds4-item-list ds4-item-list--loot item-list">
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs hasQuantity=true}}
|
||||
{{!-- storage location --}}
|
||||
<div>{{localize 'DS4.StorageLocation'}}</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.loot as |item id|}}
|
||||
{{#> itemListEntry item=item }}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{item.data.storageLocation}}"
|
||||
{{#each itemsByType.loot as |itemData id|}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData hasQuantity=true}}
|
||||
{{!-- storage location --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{itemData.data.storageLocation}}"
|
||||
data-dtype="String" data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}">
|
||||
{{/itemListEntry}}
|
||||
{{/systems/ds4/templates/actor/partials/item-list-entry.hbs}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
|
|
@ -1,39 +1,8 @@
|
|||
{{!-- TODO: Refactor to avoid code duplication with items-overview and talents-overview --}}
|
||||
|
||||
{{!-- ======================================================================== --}}
|
||||
{{!-- INLINE PARTIAL DEFINITIONS --}}
|
||||
{{!-- ======================================================================== --}}
|
||||
|
||||
{{!--
|
||||
!-- 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).
|
||||
!-- 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 "itemListEntry"}}
|
||||
<li class="ds4-item-list__row item " data-item-id="{{item._id}}">
|
||||
{{!-- image --}}
|
||||
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
|
||||
{{!-- name --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||
data-property="name" title="{{htmlToPlainText item.data.description}}" />
|
||||
{{!-- description --}}
|
||||
<div class="ds4-item-list__description" title="{{htmlToPlainText item.data.description}}">
|
||||
{{{item.data.description}}}</div>
|
||||
{{!-- control buttons --}}
|
||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||
</li>
|
||||
{{/inline}}
|
||||
|
||||
{{!-- ======================================================================== --}}
|
||||
|
||||
<div class="tab special-creature-abilities" data-group="primary" data-tab="special-creature-abilities">
|
||||
<ol class="ds4-item-list ds4-item-list--special-creature-ability item-list">
|
||||
{{> systems/ds4/templates/actor/partials/item-list-header.hbs }}
|
||||
{{#each itemsByType.specialCreatureAbility as |item id|}}
|
||||
{{> itemListEntry item=item}}
|
||||
{{#each itemsByType.specialCreatureAbility as |itemData id|}}
|
||||
{{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='specialCreatureAbility' }}
|
||||
|
|
|
@ -5,30 +5,32 @@
|
|||
{{!--
|
||||
!-- Base template to display a value with unit.
|
||||
!-- @param unitDatum: the object to display; must have a value and a unit attribute
|
||||
!-- @param localizationString
|
||||
!-- @param titleKey: The key of the localized title to use.
|
||||
!-- @param unitNames: mapping of allowed unitDatum.unit values to localized unit name
|
||||
!-- @param unitAbbrs: mapping of allowed unitDatum.unit values to unit abbreviation
|
||||
--}}
|
||||
{{#*inline "unit"}}
|
||||
<div title="{{localize localizationString}} [{{lookup unitNames unitDatum.unit}}]">
|
||||
<div title="{{localize titleKey}} [{{lookup unitNames unitDatum.unit}}]">
|
||||
{{#if unitDatum.value }}
|
||||
{{unitDatum.value}} {{lookup unitAbbrs unitDatum.unit}}
|
||||
{{else}}-{{/if}}
|
||||
</div>
|
||||
{{/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.
|
||||
!-- @param titleKey: The key of the localized title to use.
|
||||
--}}
|
||||
{{#*inline "temporalUnit"}}
|
||||
{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum
|
||||
localizationString=localizationString}}
|
||||
titleKey=titleKey}}
|
||||
{{/inline}}
|
||||
|
||||
{{#*inline "distanceUnit"}}
|
||||
{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum
|
||||
localizationString=localizationString}}
|
||||
titleKey=titleKey}}
|
||||
{{/inline}}
|
||||
|
||||
|
||||
|
@ -40,44 +42,43 @@ localizationString=localizationString}}
|
|||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hideDescription=true}}
|
||||
{{!-- spell type --}}
|
||||
<div title="{{localize 'DS4.SpellType'}}">{{localize 'DS4.SpellTypeAbbr'}}</div>
|
||||
|
||||
{{!-- spell bonus --}}
|
||||
<div title="{{localize 'DS4.SpellBonus'}}">{{localize 'DS4.SpellBonusAbbr'}}</div>
|
||||
|
||||
{{!-- max. distance --}}
|
||||
<div title="{{localize 'DS4.SpellMaxDistance'}}"><i class="fas fa-ruler"></i></div>
|
||||
|
||||
{{!-- duration --}}
|
||||
<div title="{{localize 'DS4.SpellDuration'}}"><i class="far fa-clock"></i></div>
|
||||
|
||||
{{!-- cooldown duration --}}
|
||||
<div title="{{localize 'DS4.SpellCooldownDuration'}}"><i class="fas fa-hourglass-half"></i></div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.spell as |item id|}}
|
||||
<li class="ds4-item-list__row item" data-item-id="{{item._id}}">
|
||||
<input class="ds4-item-list__editable ds4-item-list__editable--checkbox item-change" type="checkbox"
|
||||
{{checked item.data.data.equipped}} data-dtype="Boolean" data-property="data.equipped"
|
||||
title="{{localize 'DS4.ItemEquipped'}}">
|
||||
{{!-- image --}}
|
||||
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
|
||||
{{!-- name --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||
data-property="name" title="{{htmlToPlainText item.data.data.description}}" />
|
||||
{{!-- spell type --}}
|
||||
<div class="ds4-item-list__image"
|
||||
style="background-image: url('{{lookup ../config.icons.spellTypes item.data.data.spellType}}')"
|
||||
title="{{lookup ../config.i18n.spellTypes item.data.data.spellType}}">
|
||||
</div>
|
||||
{{!-- spell bonus --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" data-dtype="String"
|
||||
data-property="data.bonus" value="{{item.data.data.bonus}}" title="{{localize 'DS4.SpellBonus'}}" />
|
||||
{{!-- max. distance --}}
|
||||
{{> 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}}
|
||||
{{!-- control buttons --}}
|
||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||
</li>
|
||||
{{#each itemsByType.spell as |itemData id|}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true
|
||||
hideDescription=true}}
|
||||
{{!-- spell type --}}
|
||||
<div class="ds4-item-list__image"
|
||||
style="background-image: url('{{lookup ../../config.icons.spellTypes itemData.data.spellType}}')"
|
||||
title="{{lookup ../../config.i18n.spellTypes itemData.data.spellType}}">
|
||||
</div>
|
||||
|
||||
{{!-- spell bonus --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" data-dtype="String" data-property="data.bonus"
|
||||
value="{{itemData.data.bonus}}" title="{{localize 'DS4.SpellBonus'}}" />
|
||||
|
||||
{{!-- max. distance --}}
|
||||
{{> distanceUnit titleKey='DS4.SpellMaxDistance' unitDatum=itemData.data.maxDistance
|
||||
config=../../config}}
|
||||
|
||||
{{!-- duration --}}
|
||||
{{> temporalUnit titleKey='DS4.SpellDuration' unitDatum=itemData.data.duration config=../../config}}
|
||||
|
||||
{{!-- cooldown duration --}}
|
||||
{{> temporalUnit titleKey='DS4.SpellCooldownDuration' unitDatum=itemData.data.cooldownDuration
|
||||
config=../../config}}
|
||||
{{/systems/ds4/templates/actor/partials/item-list-entry.hbs}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{!-- add button --}}
|
||||
|
|
|
@ -19,114 +19,51 @@
|
|||
{{> 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"}}
|
||||
<li class="ds4-item-list__row item" data-item-id="{{item._id}}">
|
||||
{{!-- image --}}
|
||||
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
|
||||
{{!-- name --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||
data-property="name" title="{{htmlToPlainText item.data.description}}">
|
||||
{{!-- talent tank equation --}}
|
||||
{{> systems/ds4/templates/actor/partials/talent-rank-equation.hbs talentRank=item.data.rank}}
|
||||
{{!-- description --}}
|
||||
<div class="ds4-item-list__description" title="{{htmlToPlainText item.data.description}}">
|
||||
{{{item.data.description}}}</div>
|
||||
{{!-- control buttons --}}
|
||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||
</li>
|
||||
{{/inline}}
|
||||
|
||||
{{!--
|
||||
!-- 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>
|
||||
{{!-- description --}}
|
||||
<div>{{localize 'DS4.Description'}}</div>
|
||||
{{!-- control buttons placeholder --}}
|
||||
<div></div>
|
||||
</li>
|
||||
{{/inline}}
|
||||
|
||||
|
||||
{{!--
|
||||
!-- 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).
|
||||
!-- 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"}}
|
||||
<li class="ds4-item-list__row item" data-item-id="{{item._id}}">
|
||||
{{!-- image --}}
|
||||
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
|
||||
{{!-- name --}}
|
||||
<input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
|
||||
data-property="name" title="{{htmlToPlainText item.data.description}}">
|
||||
{{!-- description --}}
|
||||
<div class="ds4-item-list__description" title="{{htmlToPlainText item.data.description}}">
|
||||
{{{item.data.description}}}</div>
|
||||
{{!-- control buttons --}}
|
||||
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||
</li>
|
||||
{{/inline}}
|
||||
|
||||
{{!-- ======================================================================== --}}
|
||||
|
||||
<div class="tab talents-abilities" data-group="primary" data-tab="talents-abilities">
|
||||
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeTalentPlural'}}</h4>
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent' }}
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent'}}
|
||||
<ol class="ds4-item-list ds4-item-list--talent item-list">
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs }}
|
||||
{{!-- rank info --}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{!-- rank --}}
|
||||
<div>{{localize 'DS4.TalentRank'}}</div>
|
||||
{{/systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.talent as |item id|}}
|
||||
{{> talentListEntry item=item}}
|
||||
{{#each itemsByType.talent as |itemData id|}}
|
||||
{{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}}
|
||||
{{!-- rank --}}
|
||||
{{> systems/ds4/templates/actor/partials/talent-rank-equation.hbs talentRank=itemData.data.rank}}
|
||||
{{/systems/ds4/templates/actor/partials/item-list-entry.hbs}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
||||
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeRacialAbilityPlural'}}</h4>
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.racialAbility dataType='racialAbility' }}
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.racialAbility dataType='racialAbility'}}
|
||||
<ol class="ds4-item-list ds4-item-list--racial-ability item-list">
|
||||
{{> systems/ds4/templates/actor/partials/item-list-header.hbs }}
|
||||
{{#each itemsByType.racialAbility as |item id|}}
|
||||
{{> baseItemListEntry item=item}}
|
||||
{{> systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.racialAbility as |itemData id|}}
|
||||
{{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
||||
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeLanguagePlural'}}</h4>
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.language dataType='language' }}
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.language dataType='language'}}
|
||||
<ol class="ds4-item-list ds4-item-list--language item-list">
|
||||
{{> systems/ds4/templates/actor/partials/item-list-header.hbs }}
|
||||
{{#each itemsByType.language as |item id|}}
|
||||
{{> baseItemListEntry item=item}}
|
||||
{{> systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.language as |itemData id|}}
|
||||
{{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
||||
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeAlphabetPlural'}}</h4>
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.alphabet dataType='alphabet' }}
|
||||
{{#> ifHasItemOfType itemsArray=itemsByType.alphabet dataType='alphabet'}}
|
||||
<ol class="ds4-item-list ds4-item-list--alphabet item-list">
|
||||
{{> systems/ds4/templates/actor/partials/item-list-header.hbs }}
|
||||
{{#each itemsByType.alphabet as |item id|}}
|
||||
{{> baseItemListEntry item=item}}
|
||||
{{> systems/ds4/templates/actor/partials/item-list-header.hbs}}
|
||||
{{#each itemsByType.alphabet as |itemData id|}}
|
||||
{{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}}
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/ifHasItemOfType}}
|
||||
|
|
Loading…
Reference in a new issue