From 81cb3bb6bd7f69c8924ae35d0acfe6b19a45286a Mon Sep 17 00:00:00 2001 From: fabres Date: Wed, 22 Jul 2026 01:10:24 +0200 Subject: [PATCH] fix: DialogV2 - formes imbriquees, boutons, styles et positionnement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - retire les
dans les templates DialogV2 (absorbe par V2) - ajoute window: {frame, positioned} et enleve height:fit-content (bloquait deplacement vertical) - ajoute buttons: [Fermer] sur tous les DialogV2 qui en manquaient - style des dialogs chronologie, calendar-editor, stress - corrige duplication des boutons calendrier a chaque re-render - HandlebarsApplicationMixin sur FenetreRechercheTirage - corrige selecteurs :input→input,select,textarea (jQuery→natif) - ajoute banniere ASCII console au demarrage --- css/foundryvtt-reve-de-dragon.css | 127 +++++++++++++++++++++ less/foundryvtt-reve-de-dragon.less | 132 ++++++++++++++++++++++ module/dialog-chronologie.js | 22 ++-- module/dialog-select.js | 3 +- module/rdd-commands.js | 5 +- module/rdd-main.js | 9 ++ module/sommeil/dialog-stress.js | 7 +- module/time/rdd-calendrier-editor.js | 3 +- module/time/rdd-calendrier.js | 3 + module/tirage/fenetre-recherche-tirage.js | 7 +- module/voyage/dialog-fatigue-voyage.js | 3 +- templates/dialog-chronologie.hbs | 4 +- templates/time/calendar-editor.hbs | 29 ++--- 13 files changed, 312 insertions(+), 42 deletions(-) diff --git a/css/foundryvtt-reve-de-dragon.css b/css/foundryvtt-reve-de-dragon.css index 38c46e3f..120cdb8d 100644 --- a/css/foundryvtt-reve-de-dragon.css +++ b/css/foundryvtt-reve-de-dragon.css @@ -5343,6 +5343,9 @@ body { margin: 0; padding: 0.2rem; } +.system-foundryvtt-reve-de-dragon .dialog-aide-commands .window-content { + overflow-y: auto; +} .system-foundryvtt-reve-de-dragon .window-app.sheet .window-content, .system-foundryvtt-reve-de-dragon .application.sheet .window-content { margin: 0.2rem; @@ -6646,6 +6649,130 @@ body { font-family: CaslonAntique; font-size: 1.1rem; } +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono { + padding: 0.5rem 1rem; + font-family: CaslonAntique; + font-size: 1.1rem; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .flexcol { + gap: 0.3rem; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group { + display: flex; + flex-direction: row; + align-items: center; + padding: 2px 0; + gap: 0.3rem; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group > label { + flex: 0 0 8rem; + font-weight: 700; + color: var(--rdd-color-text-primary); +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group > input, +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group > select, +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group > textarea { + flex: 1; + background: var(--rdd-input-background); + border: 1px solid var(--rdd-color-border-input); + color: var(--rdd-color-text-primary); + padding: 2px 4px; + border-radius: 0.2rem; + font-family: CaslonAntique; + font-size: 1rem; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group > textarea { + min-height: 4rem; + resize: vertical; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group > select { + height: auto; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group.chronologie-preset label { + flex: 0 0 8rem; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group.chronologie-preset .timestamp-form { + flex: 1; + display: flex; + flex-direction: row; + gap: 0.2rem; + align-items: center; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group.chronologie-preset .timestamp-form select, +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group.chronologie-preset .timestamp-form input { + flex: 1; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .form-group hr { + flex: 1; + border: none; + border-top: 1px solid var(--rdd-color-border-input); + margin: 0; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono button.chronologie-ajouter { + width: 100%; + padding: 0.3rem 1rem; + font-family: CaslonAntique; + font-size: 1.1rem; + background: var(--background-custom-button); + color: var(--major-button-color); + border: 2px ridge #846109; + border-radius: 0.2rem; + cursor: pointer; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono button.chronologie-ajouter:hover { + background: var(--background-custom-button-hover); +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .chronologie-preset-show, +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .chronologie-preset-hide { + cursor: pointer; +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .chronologie-preset-show i, +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .chronologie-preset-hide i { + font-size: 0.9rem; + color: var(--color-controls-light); +} +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .chronologie-preset-show:hover i, +.system-foundryvtt-reve-de-dragon .DialogChronologie .rdddialogchrono .chronologie-preset-hide:hover i { + opacity: 0.6; +} +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor { + padding: 0.5rem 1rem; + font-family: CaslonAntique; + font-size: 1.1rem; +} +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor .flexcol.calendar-timestamp-edit { + gap: 0.2rem; +} +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor .flexcol.calendar-timestamp-edit .flexrow { + display: flex; + flex-direction: row; + align-items: center; + gap: 0.2rem; +} +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor .flexcol.calendar-timestamp-edit .flexrow > label { + flex: 0 0 8rem; + font-weight: 700; + color: var(--rdd-color-text-primary); +} +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor .flexcol.calendar-timestamp-edit .flexrow > input, +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor .flexcol.calendar-timestamp-edit .flexrow > select { + flex: 1; + background: var(--rdd-input-background); + border: 1px solid var(--rdd-color-border-input); + color: var(--rdd-color-text-primary); + padding: 2px 4px; + border-radius: 0.2rem; + font-family: CaslonAntique; + font-size: 1rem; +} +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor .flexcol.calendar-timestamp-edit .flexrow > input[type="number"] { + max-width: 4rem; + text-align: right; +} +.system-foundryvtt-reve-de-dragon .rdd-dialog-calendar-editor .flexcol.calendar-timestamp-edit .flexrow img { + width: 1.2rem; + height: 1.2rem; +} .system-foundryvtt-reve-de-dragon .rdd-calendar-astrologie.application .window-content { backdrop-filter: none; } diff --git a/less/foundryvtt-reve-de-dragon.less b/less/foundryvtt-reve-de-dragon.less index 20a59085..5d0ab586 100644 --- a/less/foundryvtt-reve-de-dragon.less +++ b/less/foundryvtt-reve-de-dragon.less @@ -69,6 +69,9 @@ margin: 0; padding: 0.2rem; } + .dialog-aide-commands .window-content { + overflow-y: auto; + } .window-app.sheet .window-content, .application.sheet .window-content { margin: 0.2rem; @@ -1394,6 +1397,135 @@ } } } + .DialogChronologie { + .rdddialogchrono { + padding: 0.5rem 1rem; + font-family: CaslonAntique; + font-size: 1.1rem; + + .flexcol { gap: 0.3rem; } + + .form-group { + display: flex; + flex-direction: row; + align-items: center; + padding: 2px 0; + gap: 0.3rem; + + > label { + flex: 0 0 8rem; + font-weight: 700; + color: var(--rdd-color-text-primary); + } + + > input, + > select, + > textarea { + flex: 1; + background: var(--rdd-input-background); + border: 1px solid var(--rdd-color-border-input); + color: var(--rdd-color-text-primary); + padding: 2px 4px; + border-radius: 0.2rem; + font-family: CaslonAntique; + font-size: 1rem; + } + + > textarea { + min-height: 4rem; + resize: vertical; + } + + > select { height: auto; } + + &.chronologie-preset { + label { flex: 0 0 8rem; } + .timestamp-form { + flex: 1; + display: flex; + flex-direction: row; + gap: 0.2rem; + align-items: center; + select, input { flex: 1; } + } + } + + hr { + flex: 1; + border: none; + border-top: 1px solid var(--rdd-color-border-input); + margin: 0; + } + } + + button.chronologie-ajouter { + width: 100%; + padding: 0.3rem 1rem; + font-family: CaslonAntique; + font-size: 1.1rem; + background: var(--background-custom-button); + color: var(--major-button-color); + border: 2px ridge #846109; + border-radius: 0.2rem; + cursor: pointer; + + &:hover { + background: var(--background-custom-button-hover); + } + } + + .chronologie-preset-show, + .chronologie-preset-hide { + cursor: pointer; + i { font-size: 0.9rem; color: var(--color-controls-light); } + &:hover i { opacity: 0.6; } + } + } + } + .rdd-dialog-calendar-editor { + padding: 0.5rem 1rem; + font-family: CaslonAntique; + font-size: 1.1rem; + + .flexcol.calendar-timestamp-edit { + gap: 0.2rem; + + .flexrow { + display: flex; + flex-direction: row; + align-items: center; + gap: 0.2rem; + + > label { + flex: 0 0 8rem; + font-weight: 700; + color: var(--rdd-color-text-primary); + } + + > input, + > select { + flex: 1; + background: var(--rdd-input-background); + border: 1px solid var(--rdd-color-border-input); + color: var(--rdd-color-text-primary); + padding: 2px 4px; + border-radius: 0.2rem; + font-family: CaslonAntique; + font-size: 1rem; + } + + > input[type="number"] { + max-width: 4rem; + text-align: right; + } + + img { + width: 1.2rem; + height: 1.2rem; + } + } + } + } .rdd-calendar-astrologie { &.application .window-content { backdrop-filter: none; diff --git a/module/dialog-chronologie.js b/module/dialog-chronologie.js index 47636885..e2c6f0ea 100644 --- a/module/dialog-chronologie.js +++ b/module/dialog-chronologie.js @@ -76,19 +76,19 @@ export class DialogChronologie extends foundry.applications.api.DialogV2 { this.close() } else { - const journal = this._val("form.rdddialogchrono select[name='journalId']") + const journal = this._val(".rdddialogchrono select[name='journalId']") ui.notifications.warn(`Le journal ${journal} n'est pas accessible`) } } async forceValidation() { - this.element.querySelectorAll("form.rdddialogchrono :input").forEach(el => el.dispatchEvent(new Event("change"))) + this.element.querySelectorAll(".rdddialogchrono input, .rdddialogchrono select, .rdddialogchrono textarea").forEach(el => el.dispatchEvent(new Event("change"))) } _val(sel) { return this.element.querySelector(sel)?.value ?? "" } findJournal() { - const journalId = this._val("form.rdddialogchrono :input[name='journalId']") + const journalId = this._val("[name='journalId']") const journalEntry = game.journal.get(journalId) return { journalId, journalEntry } } @@ -99,16 +99,16 @@ export class DialogChronologie extends foundry.applications.api.DialogV2 { extractJournalParameters() { return { - auteur: this._val("form.rdddialogchrono :input[name='auteur']"), - information: this._val("form.rdddialogchrono :input[name='information']"), + auteur: this._val("[name='auteur']"), + information: this._val("[name='information']"), dateRdD: { - jour: this._val("form.rdddialogchrono :input[name='chronologie.jourDuMois']"), - mois: RdDTimestamp.definition(this._val("form.rdddialogchrono :input[name='chronologie.mois']")), - annee: this._val("form.rdddialogchrono :input[name='chronologie.annee']"), - heure: RdDTimestamp.definition(this._val("form.rdddialogchrono :input[name='chronologie.heure']")), - minute: this._val("form.rdddialogchrono :input[name='chronologie.minute']"), + jour: this._val("[name='chronologie.jourDuMois']"), + mois: RdDTimestamp.definition(this._val("[name='chronologie.mois']")), + annee: this._val("[name='chronologie.annee']"), + heure: RdDTimestamp.definition(this._val("[name='chronologie.heure']")), + minute: this._val("[name='chronologie.minute']"), }, - dateReel: this._val("form.rdddialogchrono :input[name='dateReel']").replace('T', ' ') + dateReel: this._val("[name='dateReel']").replace('T', ' ') } } diff --git a/module/dialog-select.js b/module/dialog-select.js index eb4237fd..cc008667 100644 --- a/module/dialog-select.js +++ b/module/dialog-select.js @@ -19,7 +19,8 @@ export class DialogSelect extends foundry.applications.api.DialogV2 { title, content, classes: ["rdd-dialog-select"], - position: { width: 'fit-content', height: 'fit-content' } + position: { width: 'fit-content' }, + buttons: [{ action: "close", label: "Fermer", icon: "fa-solid fa-xmark", callback: () => this.close() }] }) this.selectionData = selectionData this.onSelectChoice = onSelectChoice diff --git a/module/rdd-commands.js b/module/rdd-commands.js index b4a6153d..e9ab9f44 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -272,6 +272,7 @@ export class RdDCommands { new foundry.applications.api.DialogV2({ title: "Commandes disponibles dans le tchat", content: html, + classes: ["dialog-aide-commands"], buttons: [{ label: "Fermer", action: "close" }], position: { width: 600, height: 600 } }).render({ force: true }); @@ -279,9 +280,7 @@ export class RdDCommands { /* -------------------------------------------- */ static _chatAnswer(msg, content) { - msg.whisper = [game.user.id]; - msg.content = content; - ChatMessage.create(msg); + ChatMessage.create({ whisper: [game.user.id], content, speaker: msg.speaker }); } /* -------------------------------------------- */ diff --git a/module/rdd-main.js b/module/rdd-main.js index 48366092..c8b8a92c 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -406,6 +406,15 @@ export class SystemReveDeDragon { } async onReady() { + const asciiLogo = `██████╗ ███████╗██╗ ██╗███████╗ ██████╗ ███████╗ ██████╗ ██████╗ █████╗ ██████╗ ██████╗ ███╗ ██╗ +██╔══██╗██╔════╝██║ ██║██╔════╝ ██╔══██╗██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██╔═══██╗████╗ ██║ +██████╔╝█████╗ ██║ ██║█████╗ ██║ ██║█████╗ ██║ ██║██████╔╝███████║██║ ███╗██║ ██║██╔██╗ ██║ +██╔══██╗██╔══╝ ╚██╗ ██╔╝██╔══╝ ██║ ██║██╔══╝ ██║ ██║██╔══██╗██╔══██║██║ ██║██║ ██║██║╚██╗██║ +██║ ██║███████╗ ╚████╔╝ ███████╗ ██████╔╝███████╗ ██████╔╝██║ ██║██║ ██║╚██████╔╝╚██████╔╝██║ ╚████║ +╚═╝ ╚═╝╚══════╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ +` + console.log(asciiLogo) + /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ diff --git a/module/sommeil/dialog-stress.js b/module/sommeil/dialog-stress.js index 6dc2925d..9fe0c2d9 100644 --- a/module/sommeil/dialog-stress.js +++ b/module/sommeil/dialog-stress.js @@ -17,8 +17,9 @@ export class DialogStress extends foundry.applications.api.DialogV2 { super({ title: "Donner du stress", content, + window: { frame: true, positioned: true }, classes: ["DialogStress"], - position: { width: 400, height: 'fit-content' }, + position: { width: 400 }, buttons: [ { label: "Stress !", action: "stress", callback: () => this.onStress() } ] @@ -26,8 +27,8 @@ export class DialogStress extends foundry.applications.api.DialogV2 { this.dialogData = dialogData } - _onRender(context) { - super._onRender(context) + _onRender(context, options) { + super._onRender(context, options) this.element.querySelectorAll("input.select-actor").forEach(el => el.addEventListener("change", event => this.onSelectActor(event)) ) diff --git a/module/time/rdd-calendrier-editor.js b/module/time/rdd-calendrier-editor.js index fdf7ffc5..05ab4d28 100644 --- a/module/time/rdd-calendrier-editor.js +++ b/module/time/rdd-calendrier-editor.js @@ -6,7 +6,8 @@ export class RdDCalendrierEditor extends foundry.applications.api.DialogV2 { title: "Editeur de date/heure", content: html, classes: ["rdd-dialog-calendar-editor"], - position: { width: 400, height: 'fit-content' }, + window: { frame: true, positioned: true }, + position: { width: 400 }, buttons: [ { label: "Enregistrer", action: "save", callback: () => this.saveCalendrier() } ] diff --git a/module/time/rdd-calendrier.js b/module/time/rdd-calendrier.js index 984f3469..d7839d3f 100644 --- a/module/time/rdd-calendrier.js +++ b/module/time/rdd-calendrier.js @@ -148,18 +148,21 @@ export class RdDCalendrier extends HandlebarsApplicationMixin(foundry.applicatio if (!game.user.isGM) return; const hdr = this.element.querySelector('.window-header'); if (!hdr) return; + if (hdr.querySelector('[data-action="edit-calendar"]')) return; const refBtn = hdr.querySelector('[data-action="toggleControls"]'); if (!refBtn) return; const astroBtn = document.createElement('button'); astroBtn.type = 'button'; astroBtn.className = 'header-control icon fa-solid fa-moon-over-sun'; astroBtn.dataset.tooltip = 'Astrologie'; + astroBtn.dataset.action = 'edit-astrology'; astroBtn.addEventListener('click', () => this.showAstrologieEditor()); hdr.insertBefore(astroBtn, refBtn); const editBtn = document.createElement('button'); editBtn.type = 'button'; editBtn.className = 'header-control icon fa-solid fa-calendar-pen'; editBtn.dataset.tooltip = 'Éditer date'; + editBtn.dataset.action = 'edit-calendar'; editBtn.addEventListener('click', () => this.showCalendarEditor()); hdr.insertBefore(editBtn, refBtn); } diff --git a/module/tirage/fenetre-recherche-tirage.js b/module/tirage/fenetre-recherche-tirage.js index ab7c3975..0cb32fba 100644 --- a/module/tirage/fenetre-recherche-tirage.js +++ b/module/tirage/fenetre-recherche-tirage.js @@ -67,7 +67,12 @@ function $loadFilters(parameters) { }) } -export class FenetreRechercheTirage extends foundry.applications.api.ApplicationV2 { +const { HandlebarsApplicationMixin } = foundry.applications.api; +export class FenetreRechercheTirage extends HandlebarsApplicationMixin(foundry.applications.api.ApplicationV2) { + static PARTS = { + main: { template: "systems/foundryvtt-reve-de-dragon/templates/tirage/fenetre-recherche-tirage.hbs" } + } + static DEFAULT_OPTIONS = { classes: ["fenetre-recherche-tirage"], window: { diff --git a/module/voyage/dialog-fatigue-voyage.js b/module/voyage/dialog-fatigue-voyage.js index 4781459d..81aad1ab 100644 --- a/module/voyage/dialog-fatigue-voyage.js +++ b/module/voyage/dialog-fatigue-voyage.js @@ -74,7 +74,8 @@ export class DialogFatigueVoyage extends foundry.applications.api.DialogV2 { title: "Fatigue de voyage", content, classes: ["dialog-fatigue-voyage"], - position: { width: 600, height: 'fit-content' } + position: { width: 600 }, + buttons: [{ label: "Fermer", action: "close" }] }) this.parameters = parameters this.controls = {} diff --git a/templates/dialog-chronologie.hbs b/templates/dialog-chronologie.hbs index 6f99d4ad..5911496b 100644 --- a/templates/dialog-chronologie.hbs +++ b/templates/dialog-chronologie.hbs @@ -1,4 +1,4 @@ - +
@@ -49,4 +49,4 @@
- \ No newline at end of file +
\ No newline at end of file diff --git a/templates/time/calendar-editor.hbs b/templates/time/calendar-editor.hbs index 604a526f..816b5777 100644 --- a/templates/time/calendar-editor.hbs +++ b/templates/time/calendar-editor.hbs @@ -1,19 +1,10 @@ -
-
-
-

Edition du Calendrier

-
-
- - {{!-- Sheet Body --}} -
-
- {{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs" - (timestamp-extract timestamp) - path='calendar' - label='Date courante' - disabled='' - }} -
-
-
+
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs" + (timestamp-extract timestamp) + path='calendar' + label='Date courante' + disabled='' + }} +
+