Chronologie +/-
Quand le journal est sélectionné, la fenêtre de chronologie s'ouvre avec les informations présaisies masquées. Le bouton + permet de les afficher. Le bouton - de les masquer.
This commit is contained in:
parent
05e48b61ff
commit
03f84eb3f7
@ -1,5 +1,6 @@
|
|||||||
import { SYSTEM_RDD } from "./constants.js";
|
import { SYSTEM_RDD } from "./constants.js";
|
||||||
import { Grammar } from "./grammar.js";
|
import { Grammar } from "./grammar.js";
|
||||||
|
import { HtmlUtility } from "./html-utility.js";
|
||||||
import { RdDTimestamp } from "./rdd-timestamp.js";
|
import { RdDTimestamp } from "./rdd-timestamp.js";
|
||||||
|
|
||||||
|
|
||||||
@ -27,27 +28,10 @@ export class DialogChronologie extends Dialog {
|
|||||||
dateReel: DialogChronologie.getCurrentDateTime()
|
dateReel: DialogChronologie.getCurrentDateTime()
|
||||||
};
|
};
|
||||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData);
|
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData);
|
||||||
const dialog = new DialogChronologie(html);
|
const dialog = new DialogChronologie(html, dialogData);
|
||||||
dialog.render(true);
|
dialog.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(html) {
|
|
||||||
const options = {
|
|
||||||
classes: ["DialogChronologie"],
|
|
||||||
width: 500,
|
|
||||||
height: 'fit-content',
|
|
||||||
'z-index': 99999
|
|
||||||
};
|
|
||||||
const conf = {
|
|
||||||
title: "Chronologie",
|
|
||||||
content: html,
|
|
||||||
buttons: {
|
|
||||||
ajout: { label: "Ajouter", callback: it => this.ajouter() },
|
|
||||||
}
|
|
||||||
};
|
|
||||||
super(conf, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
static getCurrentDateTime() {
|
static getCurrentDateTime() {
|
||||||
return new Date().toLocaleString("sv-SE", {
|
return new Date().toLocaleString("sv-SE", {
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
@ -58,9 +42,38 @@ export class DialogChronologie extends Dialog {
|
|||||||
}).replace(" ", "T");
|
}).replace(" ", "T");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor(html, dialogData) {
|
||||||
|
const options = {
|
||||||
|
classes: ["DialogChronologie"],
|
||||||
|
width: 500,
|
||||||
|
height: 'fit-content',
|
||||||
|
'z-index': 99999
|
||||||
|
};
|
||||||
|
const timeData = dialogData.timestamp.toCalendrier()
|
||||||
|
const conf = {
|
||||||
|
title: `Chronologie - ${timeData.jourDuMois} ${timeData.mois.label} - Heure ${timeData.heure.label}`,
|
||||||
|
content: html,
|
||||||
|
buttons: {
|
||||||
|
ajout: { label: "Ajouter", callback: it => this.ajouter() },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
super(conf, options);
|
||||||
|
this.dialogData = dialogData;
|
||||||
|
}
|
||||||
|
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
|
||||||
this.html = html;
|
this.html = html;
|
||||||
|
super.activateListeners(html);
|
||||||
|
this.showChronologiePreset(!game.journal.get(this.dialogData.journalId).canUserModify(game.user))
|
||||||
|
|
||||||
|
this.html.find("a.chronologie-preset-show").click(event => this.showChronologiePreset(true));
|
||||||
|
this.html.find("a.chronologie-preset-hide").click(event => this.showChronologiePreset(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
showChronologiePreset(showPreset) {
|
||||||
|
HtmlUtility.showControlWhen(this.html.find(".chronologie-preset-show"), !showPreset);
|
||||||
|
HtmlUtility.showControlWhen(this.html.find(".chronologie-preset-hide"), showPreset);
|
||||||
|
HtmlUtility.showControlWhen(this.html.find(".chronologie-preset"), showPreset);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ajouter() {
|
async ajouter() {
|
||||||
@ -68,7 +81,6 @@ export class DialogChronologie extends Dialog {
|
|||||||
const { journalId, journalEntry } = this.findJournal();
|
const { journalId, journalEntry } = this.findJournal();
|
||||||
// ajouter à la page ou créer une page
|
// ajouter à la page ou créer une page
|
||||||
this.addContentToJournal(journalEntry, await this.prepareChronologieEntry());
|
this.addContentToJournal(journalEntry, await this.prepareChronologieEntry());
|
||||||
|
|
||||||
this.storeLatestUsedJournalEntry(journalId);
|
this.storeLatestUsedJournalEntry(journalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
<form class="rdddialogchrono">
|
<form class="rdddialogchrono">
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="auteur">Auteur</label>
|
<label class="flex-shrink" for="auteur">Auteur</label>
|
||||||
<input type="text" name="auteur" value="{{auteur}}" data-dtype="String" {{#unless isGM}}disabled{{/unless}}/>
|
<input type="text" name="auteur" value="{{auteur}}" data-dtype="String" {{#unless isGM}}disabled{{/unless}}/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group chronologie-preset">
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs"
|
{{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs"
|
||||||
(timestamp-extract timestamp)
|
(timestamp-extract timestamp)
|
||||||
path='chronologie'
|
path='chronologie'
|
||||||
label='Date en jeu'
|
label='Date en jeu'
|
||||||
disabled=''
|
disabled=''
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group chronologie-preset">
|
||||||
<label for="dateReel">Date réelle</label>
|
<label class="flex-shrink" for="dateReel">Date réelle</label>
|
||||||
<input type="datetime-local" name="dateReel" value="{{dateReel}}" data-dtype="String" />
|
<input type="datetime-local" name="dateReel" value="{{dateReel}}" data-dtype="String" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group chronologie-preset">
|
||||||
<label for="journalId">Journal</label>
|
<label class="flex-shrink" for="journalId">Journal</label>
|
||||||
<select type="text" name="journalId" value="{{journalId}}" data-dtype="String">
|
<select type="text" name="journalId" value="{{journalId}}" data-dtype="String">
|
||||||
{{#select journalId}}
|
{{#select journalId}}
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
@ -35,8 +35,14 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group chronologie-preset">
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="information">Information</label>
|
<label class="flex-shrink" for="information">Information
|
||||||
|
<a class="chronologie-preset-show"><i class="fas fa-plus-square"></i></a>
|
||||||
|
<a class="chronologie-preset-hide"><i class="fas fa-minus-square"></i></a>
|
||||||
|
</label>
|
||||||
<textarea autocomplete="off" title="Information" name="information" autofocus>{{information}}</textarea>
|
<textarea autocomplete="off" title="Information" name="information" autofocus>{{information}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user