Filtrer les catégories sans compétences

This commit is contained in:
Vincent Vandemeulebrouck 2022-08-27 22:48:08 +02:00
parent 6e361a5531
commit e4da124579
2 changed files with 61 additions and 55 deletions

View File

@ -239,7 +239,8 @@ export class RdDUtility {
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1))); Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
Handlebars.registerHelper('sortCompetence', competences => competences.sort((a, b) => { Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.visible)
.sort((a, b) => {
if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) {
if (a.name.includes("Cité")) return -1; if (a.name.includes("Cité")) return -1;
if (b.name.includes("Cité")) return 1; if (b.name.includes("Cité")) return 1;
@ -268,7 +269,8 @@ export class RdDUtility {
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
} }
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
})); })
);
return loadTemplates(templatePaths); return loadTemplates(templatePaths);
} }

View File

@ -1,7 +1,9 @@
<header class="competence-header flexrow"> {{#if competences}}
<div class="flex-shrink">
<header class="competence-header flexrow">
<span class="competence-title">{{categorie}}</span> <span class="competence-title">{{categorie}}</span>
</header> </header>
<ul class="item-list alterne-list competence-list"> <ul class="item-list alterne-list competence-list">
{{#if @root.options.vueDetaillee}} {{#if @root.options.vueDetaillee}}
<li class="item flexrow list-item "> <li class="item flexrow list-item ">
@ -24,4 +26,6 @@
{{#each competences as |comp key|}} {{#each competences as |comp key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}}
{{/each}} {{/each}}
</ul> </ul>
</div>
{{/if}}