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}`,
|
title: `Chronologie - ${timeData.jourDuMois} ${timeData.mois.label} - Heure ${timeData.heure.label}`,
|
||||||
content: html,
|
content: html,
|
||||||
buttons: {
|
buttons: {
|
||||||
ajout: { label: "Ajouter", callback: it => this.ajouter() },
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
super(conf, options);
|
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-show").click(event => this.showChronologiePreset(true));
|
||||||
this.html.find("a.chronologie-preset-hide").click(event => this.showChronologiePreset(false));
|
this.html.find("a.chronologie-preset-hide").click(event => this.showChronologiePreset(false));
|
||||||
|
this.html.find("button.chronologie-ajouter").click(event => this.ajouter());
|
||||||
}
|
}
|
||||||
|
|
||||||
showChronologiePreset(showPreset) {
|
showChronologiePreset(showPreset) {
|
||||||
@ -79,9 +79,16 @@ export class DialogChronologie extends Dialog {
|
|||||||
async ajouter() {
|
async ajouter() {
|
||||||
await this.forceValidation();
|
await this.forceValidation();
|
||||||
const { journalId, journalEntry } = this.findJournal();
|
const { journalId, journalEntry } = this.findJournal();
|
||||||
|
if (journalEntry?.canUserModify(game.user)) {
|
||||||
// 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);
|
||||||
|
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() {
|
async forceValidation() {
|
||||||
|
@ -45,5 +45,8 @@
|
|||||||
</label>
|
</label>
|
||||||
<textarea autocomplete="off" title="Information" name="information" autofocus>{{information}}</textarea>
|
<textarea autocomplete="off" title="Information" name="information" autofocus>{{information}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<button class="chronologie-ajouter">Ajouter au journal</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
Loading…
Reference in New Issue
Block a user