Files
fvtt-celestopol/module/applications/sheets/base-item-sheet.mjs
LeRatierBretonnier ea3064d7a2 fix: tests complets - onglets, message de tchat, scores bonus/malus
- Onglets item (Anomalie/Aspect/Attribut): correction tabGroups + data-group sur chaque <a> et <section>
- Onglets acteur (PJ/PNJ): tab.cssClass dans les templates pour l'état actif initial
- Message de tchat: alignement des noms de variables _getChatCardData <-> chat-message.hbs
  - actorName, actorImg, success/failure, diceResults, statLabel/skillLabel localisés
  - difficultyLabel et moonPhaseLabel localisés depuis SYSTEM
- Dialogue de jet (roll-dialog.hbs): correction noms variables + min/max modificateur
- lang/fr.json: ajout Roll.title, Roll.roll, clés Moon (minuscules), Difficulty (unknown/ardu)
- character.mjs: passage statLabel à CelestopolRoll.prompt()
- global.less: padding + overflow-y sur .tab pour contenu visible
- item-scores.hbs: passage system=system au partial + suppression garde isEditable
- Templates anomaly/aspect/attribute: passage system=system au partial item-scores
- chat-message.mjs: getHTML() → renderHTML() (dépréciation FVTT v13)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 11:09:17 +01:00

55 lines
1.6 KiB
JavaScript

const { HandlebarsApplicationMixin } = foundry.applications.api
export default class CelestopolItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["fvtt-celestopol", "item"],
position: { width: 580, height: "auto" },
form: { submitOnChange: true },
window: { resizable: true },
actions: {
editImage: CelestopolItemSheet.#onEditImage,
},
}
/** Default tab group for item sheets */
tabGroups = { "item-tabs": "description" }
/** @override */
async _prepareContext() {
return {
fields: this.document.schema.fields,
systemFields: this.document.system.schema.fields,
item: this.document,
system: this.document.system,
source: this.document.toObject(),
isEditable: this.isEditable,
activeTab: this.tabGroups["item-tabs"] ?? "description",
}
}
/** @override */
_onRender(context, options) {
// Wire up tab navigation for inline item tabs
this.element.querySelectorAll('.item-tabs [data-tab]').forEach(tabEl => {
tabEl.addEventListener('click', () => {
const group = "item-tabs"
this.changeTab(tabEl.dataset.tab, group)
})
})
}
static async #onEditImage(event, target) {
const attr = target.dataset.edit
const current = foundry.utils.getProperty(this.document, attr)
const fp = new FilePicker({
current,
type: "image",
callback: (path) => this.document.update({ [attr]: path }),
top: this.position.top + 40,
left: this.position.left + 10,
})
return fp.browse()
}
}