Refactor the sections of the PC sheet into their own partials for ease of reading, and localize the Aspect block labels

This commit is contained in:
Oliver-Akins 2023-12-28 22:55:49 -07:00
parent be197617cc
commit fae962dc7e
13 changed files with 350 additions and 318 deletions

View file

@ -6,6 +6,18 @@ export const partials = [
`actors/char-sheet-mvp/partials/skill.hbs`,
`partials/panel.hbs`,
`items/aspect.hbs`,
// All of the partials for the PC sheet panels
`actors/char-sheet-mvp/panels/aspect.pc.hbs`,
`actors/char-sheet-mvp/panels/backpack.pc.hbs`,
`actors/char-sheet-mvp/panels/mounts.pc.hbs`,
`actors/char-sheet-mvp/panels/profile.pc.hbs`,
`actors/char-sheet-mvp/panels/roles.pc.hbs`,
`actors/char-sheet-mvp/panels/spells.pc.hbs`,
`actors/char-sheet-mvp/panels/storage.pc.hbs`,
`actors/char-sheet-mvp/panels/summons.pc.hbs`,
`actors/char-sheet-mvp/panels/sync.pc.hbs`,
`actors/char-sheet-mvp/panels/weapons.pc.hbs`,
];
export async function registerHandlebarsHelpers() {
@ -21,7 +33,18 @@ export async function preloadHandlebarsTemplates() {
for ( const partial of partials ) {
console.debug(`Loading partial: ${partial}`);
const path = `${pathPrefix}${partial}`;
paths[`dotdungeon.${partial.split(`/`).pop().replace(`.hbs`, ``)}`] = path;
/*
Converts a path/to/template.pc.hbs into a "pc.template" alias for
ease of use in partial referencing
*/
const alias = partial
.split(`/`)
.pop()
.split(`.`)
.slice(0, -1)
.reverse()
.join(`.`);
paths[`dotdungeon.${alias}`] = path;
};
console.debug(`Loaded ${partials.length} partials`);