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

@@ -267,6 +267,7 @@
"twenty_questions": {
"title": "Twenty questions",
"bt_abrev": "20Q",
"bt_refresh": "Refresh",
"intro": "You can use this sheet to fill in your answers to The Game of Twenty Questions, and to take notes for later!",
"section": "Legend of the Five Rings Core Rulebook, Chapter 2 : Creating a character, p. 41-95",
"incring1": "Ring increase (1)",

View File

@@ -267,6 +267,7 @@
"twenty_questions": {
"title": "Twenty questions",
"bt_abrev": "20Q",
"bt_refresh": "Refresh",
"intro": "You can use this sheet to fill in your answers to The Game of Twenty Questions, and to take notes for later!",
"section": "Legend of the Five Rings Core Rulebook, Chapter 2 : Creating a character, p. 41-95",
"incring1": "Ring increase (1)",

View File

@@ -267,6 +267,7 @@
"twenty_questions": {
"title": "Vingt questions",
"bt_abrev": "20Q",
"bt_refresh": "Actualiser",
"intro": "Renseignez vos réponses au jeu des vingt questions sur ce formulaire et notez-y des éléments à utiliser ultérieurement !",
"section": "Livre de Règles de La Légende des Cinq Anneaux, Chapitre 2 : Création de personnage, p. 41-95",
"incring1": "Augmentation d'anneau (1)",

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);
}

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +1,20 @@
&.l5r5e {
.twenty-questions-dialog {
table {
width: 100%;
}
table tr td {
vertical-align: top;
}
.third {
width: 230px;
}
.fifty {
width: 49%;
}
.or {
width: 100px;
}
.dropbox {
min-height: 75px;
}
&.twenty-questions-dialog {
table {
width: 100%;
}
table tr td {
vertical-align: top;
}
.third {
width: 230px;
}
.fifty {
width: 49%;
}
.or {
width: 100px;
}
.dropbox {
min-height: 75px;
}
}