Merge branch '012_equipped_flag' into 'master'

Equipped flag shown in item sheet

See merge request dungeonslayers/ds4!15
This commit is contained in:
Gesina Schwalbe 2020-12-31 16:37:21 +01:00
commit 88f821c7aa
5 changed files with 42 additions and 21 deletions

View file

@ -1,5 +1,6 @@
{
"DS4.UserInteractionAddItem": "Add item",
"DS4.NotOwned": "No owner",
"DS4.Description": "Description",
"DS4.DescriptionAbbr": "Desc",
"DS4.Details": "Details",
@ -16,7 +17,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}}
{{localize "DS4.NotOwned"}}
{{/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>