Additional buttons can be set in Confirm dialog

This commit is contained in:
isaisstillalive 2020-07-05 21:15:18 +09:00
parent 40674ef0d7
commit 1d44690482
1 changed files with 8 additions and 2 deletions

View File

@ -366,20 +366,26 @@ export class DialogWithForm extends Dialog {
* @param {string} param0.title
* @param {string} param0.desc
* @param {string=} param0.confirmButton
* @param {string=} param0.extraButton
* @param {Array<FormElement>} param0.formElements
*/
constructor({ app, title, desc, formElements, confirmButton = "ok:good" }) {
constructor({ app, title, desc, formElements, confirmButton = "ok:good", extraButton = null }) {
let html = "";
html += desc + "<br>";
for (let i = 0; i < formElements.length; ++i) {
html += formElements[i].getHtml();
}
const buttons = [];
if (extraButton) {
buttons.push(extraButton);
}
buttons.push("cancel:bad", confirmButton);
super({
app,
title: title,
contentHTML: html,
buttons: ["cancel:bad", confirmButton],
buttons: buttons,
type: "info",
closeButton: true,
});