added equipped and owner to item sheet

Additions:
- added equipped checkbox to item sheet
- added item owner to item properties list
- added some translations
- added some TODOs

Changes:
- item properties owner, equipped, quantity, storageLocation
  are only shown if item is owned by an actor
- moved item properties price and availability
  to details tab
- shortened ItemEquipped translation
- added item.actor and item.isOwned property values
  to data returned from DS4ItemSheet.getData
  (properties aren't accessible in Handlebars)
This commit is contained in:
Gesina Schwalbe 2020-12-30 23:50:27 +01:00
parent 589a3c87ce
commit 29d34daa9a
5 changed files with 41 additions and 21 deletions

View file

@ -16,7 +16,8 @@
"DS4.Quantity": "Quantity",
"DS4.PriceGold": "Price (Gold)",
"DS4.StorageLocation": "Stored at",
"DS4.ItemEquipped": "Item equipped?",
"DS4.ItemEquipped": "Equipped?",
"DS4.ItemOwner": "Owner",
"DS4.ItemAvailability": "Availability",
"DS4.ItemAvailabilityHamlet": "Hamlet",
"DS4.ItemAvailabilityVilage": "Village",

View file

@ -26,7 +26,7 @@ export class DS4ItemSheet extends ItemSheet<DS4ItemDataType, DS4Item> {
/** @override */
getData(): ItemSheetData<DS4ItemDataType, DS4Item> {
const data = { ...super.getData(), config: CONFIG.DS4 };
const data = { ...super.getData(), config: CONFIG.DS4, isOwned: this.item.isOwned, actor: this.item.actor };
console.log(data);
return data;
}

View file

@ -1,4 +1,6 @@
{{!-- TODO: Where possible use icons with complete names as hovers instead of long names --}}
{{!-- TODO: For items list: only show header, if list is not empty --}}
{{!-- TODO: Reduce code duplications --}}
{{!-- TODO: Change from flex layout to grid layout --}}
{{!-- Tab with overview and quick-actions on owned items --}}
<div class="tab items" data-group="primary" data-tab="items">

View file

@ -1,27 +1,29 @@
<div class="tab flexrow" data-group="primary" data-tab="description">
<div class="side-properties">
{{#if isOwned}}
<div class="side-property">
<label for="data.quantity">{{localize "DS4.Quantity"}}</label>
<label for="data.actor">{{localize 'DS4.ItemOwner'}}</label>
<a class="entity-link" draggable="true" data-entity="Actor" data-id="{{actor._id}}"><i
class="fas fa-user"></i>{{actor.name}}</a>
</div>
{{#if (ne data.equipped undefined)}}<div class="side-property">
<label for="data.equipped">{{localize 'DS4.ItemEquipped'}}</label>
<input type="checkbox" name="data.equipped" data-dtype="Boolean" {{checked data.equipped}} title="{{localize 'DS4.ItemEquipped'}}">
</div>
{{/if}}
<div class="side-property">
<label for="data.quantity">{{localize 'DS4.Quantity'}}</label>
<input type="number" data-dtype="Number" name="data.quantity" value="{{data.quantity}}" />
</div>
<div class="side-property">
<label for="data.storageLocation">{{localize "DS4.StorageLocation"}}</label>
<label for="data.storageLocation">{{localize 'DS4.StorageLocation'}}</label>
<input type="text" data-dtype="String" name="data.storageLocation" value="{{data.storageLocation}}" />
</div>
<div class="side-property">
<label for="data.price">{{localize "DS4.PriceGold"}}</label>
<input type="number" data-dtype="Number" name="data.price" value="{{data.price}}" />
</div>
<div class="side-property">
<label for="data.availability">{{localize "DS4.ItemAvailability"}}</label>
<select name="data.availability" data-type="String">
{{#select data.availability}}
{{#each config.itemAvailabilities as |value key|}}
<option value="{{key}}">{{value}}</option>
{{/each}}
{{/select}}
</select>
</div>
{{else}}
<p>Item isn't owned.</p>
{{/if}}
</div>
<div class="description">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</div>

View file

@ -1,5 +1,20 @@
{{!-- The item tab for details. --}}
<div class="tab details" data-group="primary" data-tab="details">
{{!-- As you add new fields, add them in here! --}}
<p>Nothing to see yet.</p>
<div class="side-properties">
<div class="side-property">
<label for="data.price">{{localize "DS4.PriceGold"}}</label>
<input type="number" data-dtype="Number" name="data.price" value="{{data.price}}" />
</div>
<div class="side-property">
<label for="data.availability">{{localize "DS4.ItemAvailability"}}</label>
<select name="data.availability" data-type="String">
{{#select data.availability}}
{{#each config.itemAvailabilities as |value key|}}
<option value="{{key}}">{{value}}</option>
{{/each}}
{{/select}}
</select>
</div>
</div>
</div>