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,36 +239,38 @@ 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)
if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { .sort((a, b) => {
if (a.name.includes("Cité")) return -1; if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) {
if (b.name.includes("Cité")) return 1; if (a.name.includes("Cité")) return -1;
if (a.name.includes("Extérieur")) return -1; if (b.name.includes("Cité")) return 1;
if (b.name.includes("Extérieur")) return 1; if (a.name.includes("Extérieur")) return -1;
if (b.name.includes("Extérieur")) return 1;
return a.name.localeCompare(b.name);
}
if (a.data.categorie.startsWith("melee") && b.data.categorie.startsWith("melee")) {
if (a.name.includes("Corps")) return -1;
if (b.name.includes("Corps")) return 1;
if (a.name.includes("Dague")) return -1;
if (b.name.includes("Dague")) return 1;
if (a.name.includes("Esquive")) return -1;
if (b.name.includes("Esquive")) return 1;
return a.name.localeCompare(b.name);
}
if (a.name.startsWith("Voie") && b.name.startsWith("Voie")) {
if (a.name.includes("Oniros")) return -1;
if (b.name.includes("Oniros")) return 1;
if (a.name.includes("Hypnos")) return -1;
if (b.name.includes("Hypnos")) return 1;
if (a.name.includes("Narcos")) return -1;
if (b.name.includes("Narcos")) return 1;
if (a.name.includes("Thanatos")) return -1;
if (b.name.includes("Thanatos")) return 1;
return a.name.localeCompare(b.name);
}
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
} })
if (a.data.categorie.startsWith("melee") && b.data.categorie.startsWith("melee")) { );
if (a.name.includes("Corps")) return -1;
if (b.name.includes("Corps")) return 1;
if (a.name.includes("Dague")) return -1;
if (b.name.includes("Dague")) return 1;
if (a.name.includes("Esquive")) return -1;
if (b.name.includes("Esquive")) return 1;
return a.name.localeCompare(b.name);
}
if (a.name.startsWith("Voie") && b.name.startsWith("Voie")) {
if (a.name.includes("Oniros")) return -1;
if (b.name.includes("Oniros")) return 1;
if (a.name.includes("Hypnos")) return -1;
if (b.name.includes("Hypnos")) return 1;
if (a.name.includes("Narcos")) return -1;
if (b.name.includes("Narcos")) return 1;
if (a.name.includes("Thanatos")) return -1;
if (b.name.includes("Thanatos")) return 1;
return a.name.localeCompare(b.name);
}
return a.name.localeCompare(b.name);
}));
return loadTemplates(templatePaths); return loadTemplates(templatePaths);
} }

View File

@ -1,27 +1,31 @@
<header class="competence-header flexrow"> {{#if competences}}
<span class="competence-title">{{categorie}}</span> <div class="flex-shrink">
</header> <header class="competence-header flexrow">
<ul class="item-list alterne-list competence-list"> <span class="competence-title">{{categorie}}</span>
{{#if @root.options.vueDetaillee}} </header>
<li class="item flexrow list-item "> <ul class="item-list alterne-list competence-list">
{{#if @root.options.vueDetaillee}}
<span class="competence-label"></span> <li class="item flexrow list-item ">
<span class="competence-value" >Niv.</span>
<span class="competence-xp">xp</span> <span class="competence-label"></span>
{{#if (eq categorie 'Draconic')}} <span class="competence-value" >Niv.</span>
<span class="competence-xp-sort">sort</span> <span class="competence-xp">xp</span>
{{/if}} {{#if (eq categorie 'Draconic')}}
<div class="item-controls"> <span class="competence-xp-sort">sort</span>
<i class="far fa-arrow-alt-circle-up"></i>
<span class="competence-archetype">Arch</span>
<i class="far fa-edit"></i>
{{#if @root.options.isGM}}
<i class="far fa-trash"></i>
{{/if}} {{/if}}
</div> <div class="item-controls">
</li> <i class="far fa-arrow-alt-circle-up"></i>
{{/if}} <span class="competence-archetype">Arch</span>
{{#each competences as |comp key|}} <i class="far fa-edit"></i>
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{#if @root.options.isGM}}
{{/each}} <i class="far fa-trash"></i>
</ul> {{/if}}
</div>
</li>
{{/if}}
{{#each competences as |comp key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}}
{{/each}}
</ul>
</div>
{{/if}}