Add module data path

This commit is contained in:
LeRatierBretonnien 2023-01-25 16:46:32 +01:00
parent 00c8ae8f85
commit 8e37ccb631
5 changed files with 57 additions and 7 deletions

View File

@ -52,8 +52,12 @@ export class Avd12ItemSheet extends ItemSheet {
// Specific case for formating descriptions of sub-items
if (this.object.type == "module") {
for (let level of this.object.system.levels) {
for (let id in level.features) {
level.features[id].descriptionHTML = await TextEditor.enrichHTML(level.features[id].system.description, { async: true })
if ( level && level.features) {
for (let id in level.features) {
if ( level.features[id] ) {
level.features[id].descriptionHTML = await TextEditor.enrichHTML(level.features[id].system.description, { async: true })
}
}
}
}
}
@ -249,6 +253,12 @@ export class Avd12ItemSheet extends ItemSheet {
levels[levelIndex].choices[choiceIndex].features[featureId] = undefined
this.object.update({ 'system.levels': levels })
})
html.find('.module-level-delete').click(ev => {
let levels = duplicate(this.object.system.levels)
let levelIndex = Number($(ev.currentTarget).data("level-index"))
levels.splice(levelIndex,levelIndex)
this.object.update({ 'system.levels': levels })
})
html.find('.choice-level-selected').change(ev => {
this.processChoiceLevelSelection(ev)

View File

@ -1336,3 +1336,21 @@ ul, li {
border-radius: 3px;
border: 2px ridge #846109;
}
.module-level-box {
background: linear-gradient(to bottom, #6c95b9fc 5%, #105177ab 100%);
border-radius: 5px;
padding: 4px;
margin-bottom: 8px;
margin-left: 12px;
border: 2px ridge #846109;
max-width: 45%;
min-height: 64px;
align-content: center;
}
.color-selected {
background: linear-gradient(to bottom, #9ae470fc 5%, #247e30ab 100%);
}
.flex-center {
align-items: center;
align-content: space-between;
}

View File

@ -64,7 +64,7 @@
],
"title": "AnyVenture D12 RPG",
"url": "https://www.uberwald.me/gitea/public/fvtt-avd12",
"version": "10.0.24",
"download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.24.zip",
"version": "10.0.25",
"download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.25.zip",
"background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp"
}

View File

@ -15,7 +15,23 @@
{{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}}
<div class="tab details" data-group="primary" data-tab="details">
TODO : The tre of module choices will be displayed here for players, with the "selected" option only
<div class="flexcol">
{{#each system.levels as |level index|}}
<div class="flexrow flex-center">
{{#each level.choices as |choice choiceIndex|}}
<span class="module-level-box {{#if choice.selected}}color-selected{{/if}}">
<ul>
{{#each choice.features as |feature id|}}
<li>{{feature.name}}</li>
{{/each}}
</ul>
</span>
{{/each}}
</div>
{{/each}}
</div>
</div>
{{#if isGM}}
@ -27,6 +43,9 @@
<hr>
<li class="flexrow">
<h2 class="item-field-label-long">Level {{add index 1}}</h2>
<span class="item-field-label-short">
<a class="item-control module-level-delete" data-level-index="{{index}}" title="Delete Level"><i class="fas fa-trash"></i></a>
</span>
</li>
<ul class="ul-level1">

View File

@ -41,10 +41,13 @@
</li>
{{/if}}
<!--
<li class="flexrow">
<label class="item-field-label-long">Selected</label>
<input type="checkbox" class="item-field-label-short" name="system.selected" {{checked system.selected}} />
</li>
-->
</ul>
</div>
</div>