Message si le journal est inaccessible
This commit is contained in:
parent
03f84eb3f7
commit
f9fd8a1e24
@ -54,7 +54,6 @@ export class DialogChronologie extends Dialog {
|
||||
title: `Chronologie - ${timeData.jourDuMois} ${timeData.mois.label} - Heure ${timeData.heure.label}`,
|
||||
content: html,
|
||||
buttons: {
|
||||
ajout: { label: "Ajouter", callback: it => this.ajouter() },
|
||||
}
|
||||
};
|
||||
super(conf, options);
|
||||
@ -68,6 +67,7 @@ export class DialogChronologie extends Dialog {
|
||||
|
||||
this.html.find("a.chronologie-preset-show").click(event => this.showChronologiePreset(true));
|
||||
this.html.find("a.chronologie-preset-hide").click(event => this.showChronologiePreset(false));
|
||||
this.html.find("button.chronologie-ajouter").click(event => this.ajouter());
|
||||
}
|
||||
|
||||
showChronologiePreset(showPreset) {
|
||||
@ -79,9 +79,16 @@ export class DialogChronologie extends Dialog {
|
||||
async ajouter() {
|
||||
await this.forceValidation();
|
||||
const { journalId, journalEntry } = this.findJournal();
|
||||
if (journalEntry?.canUserModify(game.user)) {
|
||||
// ajouter à la page ou créer une page
|
||||
this.addContentToJournal(journalEntry, await this.prepareChronologieEntry());
|
||||
this.storeLatestUsedJournalEntry(journalId);
|
||||
this.close();
|
||||
}
|
||||
else {
|
||||
const journal = this.html.find("form.rdddialogchrono select[name='journalId']").val();
|
||||
ui.notifications.warn(`Le journal ${journal} n'est pas accessible`);
|
||||
}
|
||||
}
|
||||
|
||||
async forceValidation() {
|
||||
|
@ -45,5 +45,8 @@
|
||||
</label>
|
||||
<textarea autocomplete="off" title="Information" name="information" autofocus>{{information}}</textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="chronologie-ajouter">Ajouter au journal</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user