1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00

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

View File

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