fix: DialogV2 - formes imbriquees, boutons, styles et positionnement

- retire les <form> 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
This commit is contained in:
fabres
2026-07-22 01:10:24 +02:00
parent e0e3d4f230
commit 81cb3bb6bd
13 changed files with 312 additions and 42 deletions
+127
View File
@@ -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;
}
+132
View File
@@ -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;
+11 -11
View File
@@ -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', ' ')
}
}
+2 -1
View File
@@ -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
+2 -3
View File
@@ -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 });
}
/* -------------------------------------------- */
+9
View File
@@ -406,6 +406,15 @@ export class SystemReveDeDragon {
}
async onReady() {
const asciiLogo = `██████╗ ███████╗██╗ ██╗███████╗ ██████╗ ███████╗ ██████╗ ██████╗ █████╗ ██████╗ ██████╗ ███╗ ██╗
██╔══██╗██╔════╝██║ ██║██╔════╝ ██╔══██╗██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██╔═══██╗████╗ ██║
██████╔╝█████╗ ██║ ██║█████╗ ██║ ██║█████╗ ██║ ██║██████╔╝███████║██║ ███╗██║ ██║██╔██╗ ██║
██╔══██╗██╔══╝ ╚██╗ ██╔╝██╔══╝ ██║ ██║██╔══╝ ██║ ██║██╔══██╗██╔══██║██║ ██║██║ ██║██║╚██╗██║
██║ ██║███████╗ ╚████╔╝ ███████╗ ██████╔╝███████╗ ██████╔╝██║ ██║██║ ██║╚██████╔╝╚██████╔╝██║ ╚████║
╚═╝ ╚═╝╚══════╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝
`
console.log(asciiLogo)
/* -------------------------------------------- */
/* Foundry VTT Initialization */
/* -------------------------------------------- */
+4 -3
View File
@@ -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))
)
+2 -1
View File
@@ -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() }
]
+3
View File
@@ -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);
}
+6 -1
View File
@@ -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: {
+2 -1
View File
@@ -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 = {}
+2 -2
View File
@@ -1,4 +1,4 @@
<form class="rdddialogchrono">
<div class="rdddialogchrono">
<div class="flexcol">
<div class="form-group">
<label class="flex-shrink" for="auteur">Auteur</label>
@@ -49,4 +49,4 @@
<button class="chronologie-ajouter">Ajouter au journal</button>
</div>
</div>
</form>
</div>
+10 -19
View File
@@ -1,19 +1,10 @@
<form class="rdd-dialog-calendar-editor" autocomplete="off">
<header class="sheet-header">
<div class="header-fields">
<h1 class="charname">Edition du Calendrier</h1>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
{{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs"
(timestamp-extract timestamp)
path='calendar'
label='Date courante'
disabled=''
}}
</div>
</section>
</form>
<div class="rdd-dialog-calendar-editor" autocomplete="off">
<div class="form-group">
{{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs"
(timestamp-extract timestamp)
path='calendar'
label='Date courante'
disabled=''
}}
</div>
</div>