Make items editable again int items-list

This commit is contained in:
Johannes Loher 2021-02-25 21:04:15 +01:00
parent aac4b014b0
commit 1676a7b8c4
3 changed files with 20 additions and 20 deletions

View file

@ -65,17 +65,17 @@
<li class="ds4-item-list__row item" data-item-id="{{item._id}}"> <li class="ds4-item-list__row item" data-item-id="{{item._id}}">
{{!-- equipped --}} {{!-- equipped --}}
{{#if (ne item.type 'loot')}} {{#if (ne item.type 'loot')}}
<input class="ds4-item-list__editable ds4-item-list__editable--checkbox" type="checkbox" {{checked <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'}}"> item.data.equipped}} data-dtype="Boolean" data-property="data.equipped" title="{{localize 'DS4.ItemEquipped'}}">
{{/if}} {{/if}}
{{!-- image --}} {{!-- image --}}
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div> <div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
{{!-- amount --}} {{!-- amount --}}
<input class="ds4-item-list__editable" type="number" min="0" step="1" value="{{item.data.quantity}}" <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'}}" /> data-dtype="Number" data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" />
{{!-- name --}} {{!-- name --}}
<input class="ds4-item-list__editable" type="text" value="{{item.name}}" data-dtype="String" data-property="name" <input class="ds4-item-list__editable item-change" type="text" value="{{item.name}}" data-dtype="String"
title="{{htmlToPlainText item.data.description}}" /> data-property="name" title="{{htmlToPlainText item.data.description}}" />
{{!-- item type specifics --}} {{!-- item type specifics --}}
{{> @partial-block}} {{> @partial-block}}
{{!-- description --}} {{!-- description --}}
@ -168,8 +168,8 @@
{{/itemListHeader}} {{/itemListHeader}}
{{#each itemsByType.equipment as |item id|}} {{#each itemsByType.equipment as |item id|}}
{{#> itemListEntry item=item }} {{#> itemListEntry item=item }}
<input class="ds4-item-list__editable" type="text" value="{{item.data.storageLocation}}" data-dtype="String" <input class="ds4-item-list__editable item-change" type="text" value="{{item.data.storageLocation}}"
data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}"> data-dtype="String" data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}">
{{/itemListEntry}} {{/itemListEntry}}
{{/each}} {{/each}}
</ol> </ol>
@ -184,8 +184,8 @@
{{/itemListHeader}} {{/itemListHeader}}
{{#each itemsByType.loot as |item id|}} {{#each itemsByType.loot as |item id|}}
{{#> itemListEntry item=item }} {{#> itemListEntry item=item }}
<input class="ds4-item-list__editable" type="text" value="{{item.data.storageLocation}}" data-dtype="String" <input class="ds4-item-list__editable item-change" type="text" value="{{item.data.storageLocation}}"
data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}"> data-dtype="String" data-property="data.storageLocation" title="{{localize 'DS4.StorageLocation'}}">
{{/itemListEntry}} {{/itemListEntry}}
{{/each}} {{/each}}
</ol> </ol>

View file

@ -59,13 +59,13 @@ localizationString=localizationString}}
</li> </li>
{{#each itemsByType.spell as |item id|}} {{#each itemsByType.spell as |item id|}}
<li class="ds4-item-list__row item" data-item-id="{{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" type="checkbox" {{checked <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" item.data.data.equipped}} data-dtype="Boolean" data-property="data.equipped"
title="{{localize 'DS4.ItemEquipped'}}"> title="{{localize 'DS4.ItemEquipped'}}">
{{!-- image --}} {{!-- image --}}
<div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div> <div class="ds4-item-list__image" style="background-image: url('{{item.img}}')" title="{{item.name}}"></div>
{{!-- name --}} {{!-- name --}}
<input class="ds4-item-list__editable" type="text" value="{{item.name}}" data-dtype="String" <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}}" /> data-property="name" title="{{htmlToPlainText item.data.data.description}}" />
{{!-- spell type --}} {{!-- spell type --}}
<div class="ds4-item-list__image" <div class="ds4-item-list__image"
@ -73,7 +73,7 @@ localizationString=localizationString}}
title="{{lookup ../config.i18n.spellTypes item.data.data.spellType}}"> title="{{lookup ../config.i18n.spellTypes item.data.data.spellType}}">
</div> </div>
{{!-- spell bonus --}} {{!-- spell bonus --}}
<input class="ds4-item-list__editable" type="text" data-dtype="String" data-property="data.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'}}" /> value="{{item.data.data.bonus}}" title="{{localize 'DS4.SpellBonus'}}" />
{{!-- max. distance --}} {{!-- max. distance --}}
{{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance {{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance

View file

@ -24,14 +24,14 @@
!-- Render an input element for a rank value property of an item. !-- Render an input element for a rank value property of an item.
!-- !--
!-- @param item: the item !-- @param item: the item
!-- @param property: the key of the property in item.data.data (if 'base', the max value is set automatically) !-- @param property: the key of the property in item.data (if 'base', the max value is set automatically)
!-- @param disabled: if given, is placed plainly into the input as HTML property; !-- @param disabled: if given, is placed plainly into the input as HTML property;
!-- meant to be set to "disabled" to disable the input element !-- meant to be set to "disabled" to disable the input element
--}} --}}
{{#*inline "talentRankValue"}} {{#*inline "talentRankValue"}}
<input class="item-num-val item-change" data-dtype="Number" type="number" min="0" step="1" {{#if (eq property 'base' ) <input class="item-num-val item-change" data-dtype="Number" type="number" min="0" step="1" {{#if (eq property 'base' )
}}max="{{item.data.data.rank.max}}" {{/if}} {{disabled}} data-property="data.rank.{{property}}" }}max="{{item.data.rank.max}}" {{/if}} {{disabled}} data-property="data.rank.{{property}}"
value="{{lookup item.data.data.rank property}}" title="{{localize localizeString}}" /> value="{{lookup item.data.rank property}}" title="{{localize localizeString}}" />
{{/inline}} {{/inline}}
@ -50,7 +50,7 @@
</div> </div>
{{!-- name --}} {{!-- name --}}
<input class="flex2 item-name item-change" type="text" value="{{item.name}}" data-dtype="String" <input class="flex2 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
data-property="name" title="{{htmlToPlainText item.data.data.description}}"> data-property="name" title="{{htmlToPlainText item.data.description}}">
<div class="flex3 flexrow talent-ranks-equation"> <div class="flex3 flexrow talent-ranks-equation">
{{!-- acquired rank --}} {{!-- acquired rank --}}
{{> talentRankValue item=item property='base' localizeString='DS4.TalentRankBase'}} {{> talentRankValue item=item property='base' localizeString='DS4.TalentRankBase'}}
@ -65,8 +65,8 @@
{{> talentRankValue item=item property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}} {{> talentRankValue item=item property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}}
</div> </div>
{{!-- description --}} {{!-- description --}}
<div class="flex4 item-description" title="{{htmlToPlainText item.data.data.description}}"> <div class="flex4 item-description" title="{{htmlToPlainText item.data.description}}">
{{{item.data.data.description}}}</div> {{{item.data.description}}}</div>
{{!-- control buttons --}} {{!-- control buttons --}}
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
</li> </li>
@ -89,10 +89,10 @@
</div> </div>
{{!-- name --}} {{!-- name --}}
<input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String" <input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String"
data-property="name" title="{{htmlToPlainText item.data.data.description}}""> data-property="name" title="{{htmlToPlainText item.data.description}}"">
{{!-- description --}} {{!-- description --}}
<div class=" flex3 item-description" title="{{htmlToPlainText item.data.data.description}}"> <div class=" flex3 item-description" title="{{htmlToPlainText item.data.description}}">
{{{item.data.data.description}}}</div> {{{item.data.description}}}</div>
{{!-- control buttons --}} {{!-- control buttons --}}
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
</li> </li>