corrected object tag properties
This commit is contained in:
@@ -22,8 +22,9 @@ export class ItemSheetL5r5e extends ItemSheet {
|
|||||||
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList();
|
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList();
|
||||||
|
|
||||||
// Prepare Properties (id => object)
|
// Prepare Properties (id => object)
|
||||||
if (sheetData.data.properties) {
|
sheetData.data.propertiesList = [];
|
||||||
sheetData.data.propertiesList = sheetData.data.properties.map((e) => game.items.get(e));
|
if (Array.isArray(sheetData.data.properties)) {
|
||||||
|
sheetData.data.propertiesList = sheetData.data.properties.map((e) => game.items.get(e.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sheetData;
|
return sheetData;
|
||||||
@@ -89,23 +90,23 @@ export class ItemSheetL5r5e extends ItemSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ok add item
|
// Ok add item
|
||||||
this._addProperty(item.id);
|
this._addProperty(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a property to the current item
|
* Add a property to the current item
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_addProperty(id) {
|
_addProperty(item) {
|
||||||
let props = this.entity.data.data.properties || [];
|
let props = this.entity.data.data.properties || [];
|
||||||
if (!Array.isArray(props)) {
|
if (!Array.isArray(props)) {
|
||||||
props = [];
|
props = [];
|
||||||
}
|
}
|
||||||
if (props.includes(id)) {
|
if (props.findIndex((p) => p.id === item.id) !== -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
props.push(id);
|
props.push({ id: item.id, name: item.name });
|
||||||
|
|
||||||
this.entity.update({
|
this.entity.update({
|
||||||
data: {
|
data: {
|
||||||
@@ -120,12 +121,12 @@ export class ItemSheetL5r5e extends ItemSheet {
|
|||||||
*/
|
*/
|
||||||
_deleteProperty(id) {
|
_deleteProperty(id) {
|
||||||
let props = this.entity.data.data.properties || [];
|
let props = this.entity.data.data.properties || [];
|
||||||
if (!Array.isArray(props) || !props.includes(id)) {
|
if (!Array.isArray(props) || props.findIndex((p) => p.id === id) === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.entity.update({
|
this.entity.update({
|
||||||
data: {
|
data: {
|
||||||
properties: props.filter((e) => e !== id),
|
properties: props.filter((p) => p.id !== id),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,10 @@
|
|||||||
<li class="item-edit" title="{{localize 'l5r5e.global.edit'}}"><i class="fas fa-edit"></i></li>
|
<li class="item-edit" title="{{localize 'l5r5e.global.edit'}}"><i class="fas fa-edit"></i></li>
|
||||||
<li class="item-delete" title="{{localize 'l5r5e.global.delete'}}"><i class="fas fa-trash"></i></li>
|
<li class="item-delete" title="{{localize 'l5r5e.global.delete'}}"><i class="fas fa-trash"></i></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="item-description">{{{ item.data.properties }}}</div>
|
<div class="item-properties">
|
||||||
|
{{#each item.data.properties as |property id|}}
|
||||||
|
{{{ property.name }}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
<div class="item-description">{{{ item.data.description }}}</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="text-block-header">{{ localize 'l5r5e.properties' }}</legend>
|
<legend class="text-block-header">{{ localize 'l5r5e.properties' }}</legend>
|
||||||
<!-- TODO data.properties a faire en dnd avec les items de type "property" -->
|
{{> 'systems/l5r5e/templates/items/property/properties.html' properties=data.propertiesList }}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
<li class="item-edit" title="{{localize 'l5r5e.global.edit'}}"><i class="fas fa-edit"></i></li>
|
<li class="item-edit" title="{{localize 'l5r5e.global.edit'}}"><i class="fas fa-edit"></i></li>
|
||||||
<li class="item-delete" title="{{localize 'l5r5e.global.delete'}}"><i class="fas fa-trash"></i></li>
|
<li class="item-delete" title="{{localize 'l5r5e.global.delete'}}"><i class="fas fa-trash"></i></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="item-properties">
|
||||||
|
{{#each item.data.properties as |property id|}}
|
||||||
|
{{{ property.name }}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
<div class="item-description">{{{ item.data.description }}}</div>
|
<div class="item-description">{{{ item.data.description }}}</div>
|
||||||
<div class="item-properties">{{{ item.data.properties }}}</div>
|
|
||||||
</li>
|
</li>
|
||||||
@@ -33,28 +33,18 @@
|
|||||||
{{!-- Sheet Tab Navigation --}}
|
{{!-- Sheet Tab Navigation --}}
|
||||||
<nav class="sheet-tabs tabs" data-group="primary">
|
<nav class="sheet-tabs tabs" data-group="primary">
|
||||||
<a class="item" data-tab="description">Description</a>
|
<a class="item" data-tab="description">Description</a>
|
||||||
<a class="item" data-tab="attributes">Attributes</a>
|
<a class="item" data-tab="properties">Properties</a>
|
||||||
</nav>
|
</nav>
|
||||||
{{!-- Description Tab --}}
|
{{!-- Description Tab --}}
|
||||||
<article class="tab flexcol" data-group="primary" data-tab="description">
|
<article class="tab flexcol" data-group="primary" data-tab="description">
|
||||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||||
</article>
|
</article>
|
||||||
{{!-- Attributes Tab --}}
|
{{!-- properties Tab --}}
|
||||||
<article class="tab attributes" data-group="primary" data-tab="attributes">
|
<article class="tab properties" data-group="primary" data-tab="properties">
|
||||||
<ul class="attributes-header flexrow">
|
<fieldset>
|
||||||
<li class="attribute-key">Attribute Key</li>
|
<legend class="text-block-header">{{ localize 'l5r5e.properties' }}</legend>
|
||||||
<li class="attribute-value">Value</li>
|
{{> 'systems/l5r5e/templates/items/property/properties.html' properties=data.propertiesList }}
|
||||||
<li class="attribute-label">Label</li>
|
</fieldset>
|
||||||
<li class="attribute-dtype">Data Type</li>
|
|
||||||
<li class="attribute-control" data-action="create" title="{{ localize 'l5r5e.add' }}"><i class="fas fa-plus"></i></li>
|
|
||||||
</ul>
|
|
||||||
<ol class="attributes-list">
|
|
||||||
<fieldset>
|
|
||||||
<legend class="text-block-header">{{ localize 'l5r5e.properties' }}</legend>
|
|
||||||
<!-- TODO data.properties a faire en dnd avec les items de type "property" -->
|
|
||||||
</fieldset>
|
|
||||||
<!--{{#each data.attributes as |attr key|}} {{/each}}-->
|
|
||||||
</ol>
|
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -7,5 +7,10 @@
|
|||||||
<li class="item-edit" title="{{localize 'l5r5e.global.edit'}}"><i class="fas fa-edit"></i></li>
|
<li class="item-edit" title="{{localize 'l5r5e.global.edit'}}"><i class="fas fa-edit"></i></li>
|
||||||
<li class="item-delete" title="{{localize 'l5r5e.global.delete'}}"><i class="fas fa-trash"></i></li>
|
<li class="item-delete" title="{{localize 'l5r5e.global.delete'}}"><i class="fas fa-trash"></i></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="item-description">{{{ item.data.properties }}}</div>
|
<div class="item-properties">
|
||||||
|
{{#each item.data.properties as |property id|}}
|
||||||
|
{{{ property.name }}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
<div class="item-description">{{{ item.data.description }}}</div>
|
||||||
</li>
|
</li>
|
||||||
Reference in New Issue
Block a user