20q again, added a refresh bt and fix css

This commit is contained in:
Vlyan
2020-12-28 09:48:49 +01:00
parent 84f346448d
commit 175c18a4dc
6 changed files with 51 additions and 31 deletions

View File

@@ -35,11 +35,30 @@ export class TwentyQuestionsDialog extends FormApplication {
height: 600,
resizable: true,
closeOnSubmit: false,
submitOnClose: true,
submitOnClose: false,
submitOnChange: true,
});
}
/**
* Add a refresh button on top of sheet
* Allow a GM or player to see the change made by another player without closing the dialog
* @override
*/
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
buttons.unshift({
label: game.i18n.localize("l5r5e.twenty_questions.bt_refresh"),
class: "twenty-questions",
icon: "fas fa-sync-alt",
onclick: async () => {
await new TwentyQuestionsDialog(this.actor).render(true);
},
});
return buttons;
}
/**
* Create dialog
*/
@@ -182,15 +201,15 @@ export class TwentyQuestionsDialog extends FormApplication {
this.errors = this.object.validateForm();
// Only on close/submit
if (event.type === "submit") {
// Store this form datas in actor
this.actor.data.data.twenty_questions = this.object.data;
this.actor.update({
data: {
twenty_questions: this.object.data,
},
});
}
// if (event.type === "submit") {
// Store this form datas in actor
this.actor.data.data.twenty_questions = this.object.data;
this.actor.update({
data: {
twenty_questions: this.object.data,
},
});
// }
this.render(false);
}