Split into tabs

This commit is contained in:
WBHarry 2025-08-05 20:22:46 +02:00
parent 4827b337d0
commit d385bd1a90
7 changed files with 141 additions and 5 deletions

View file

@ -34,9 +34,18 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
};
static PARTS = {
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
settings: { template: 'systems/daggerheart/templates/settings/homebrew-settings/settings.hbs' },
domains: { template: 'systems/daggerheart/templates/settings/homebrew-settings/domains.hbs' },
downtime: { template: 'systems/daggerheart/templates/settings/homebrew-settings/downtime.hbs' }
};
/** @inheritdoc */
static TABS = {
main: {
template: 'systems/daggerheart/templates/settings/homebrew-settings.hbs',
scrollable: ['']
tabs: [{ id: 'settings' }, { id: 'domains' }, { id: 'downtime' }],
initial: 'settings',
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
}
};
@ -200,4 +209,13 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
}
return obj;
}
_getTabs(tabs) {
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active;
v.cssClass = v.active ? 'active' : '';
}
return tabs;
}
}

View file

@ -2,8 +2,6 @@ import { defaultRestOptions } from '../../config/generalConfig.mjs';
import { ActionsField } from '../fields/actionField.mjs';
export default class DhHomebrew extends foundry.abstract.DataModel {
static LOCALIZATION_PREFIXES = ['DAGGERHEART.SETTINGS.Homebrew']; // Doesn't work for some reason
static defineSchema() {
const fields = foundry.data.fields;
return {
@ -98,6 +96,16 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
{ initial: defaultRestOptions.shortRest() }
)
})
}),
domains: new fields.SchemaField({
id: new fields.StringField({ required: true }),
label: new fields.StringField({ required: true, initial: '', label: 'DAGGERHEART.GENERAL.label' }),
src: new fields.FilePathField({
categories: ['IMAGE'],
base64: false,
label: 'Image'
}),
description: new fields.StringField({ label: 'DAGGERHEART.GENERAL.description' })
})
};
}