Add close button to messages boxes

Add cancel button for private settings message box
Change text in private settings message box
This commit is contained in:
JannisX11 2021-07-25 18:41:58 +02:00
parent 922c352d3c
commit a380b325a3
3 changed files with 12 additions and 7 deletions

View File

@ -211,7 +211,11 @@ const Blockbench = {
if (!options.message) options.message = tl('message.'+options.translateKey+'.message')
}
var jq_dialog = $('<dialog class="dialog paddinged" style="width: auto;" id="message_box"><div class="dialog_handle">'+tl(options.title)+'</div></dialog>')
var jq_dialog = $(`
<dialog class="dialog paddinged" style="width: auto;" id="message_box">
<div class="dialog_handle">${tl(options.title)}</div>
<div class="dialog_close_button" onclick="open_interface.cancel()"><i class="material-icons">clear</i></div>
</dialog>`)
jq_dialog.append('<div class="dialog_bar" style="height: auto; min-height: 56px; margin-bottom: 16px;">'+
marked(tl(options.message))+'</div>'

View File

@ -500,20 +500,21 @@ BARS.defineActions(() => {
}
}
if (private_data.length) {
await new Promise((resolve, reject) => {
let go_on = await new Promise((resolve, reject) => {
Blockbench.showMessageBox({
title: 'dialog.export_private_settings.title',
message: tl('dialog.export_private_settings.message', [private_data.map(key => settings[key].name).join(', ')]),
buttons: ['dialog.export_private_settings.keep', 'dialog.export_private_settings.remove']
buttons: ['dialog.export_private_settings.keep', 'dialog.export_private_settings.omit', 'dialog.cancel']
}, result => {
if (result == 1) {
private_data.forEach(key => {
delete settings_copy[key];
})
}
resolve()
})
resolve(result !== 2);
})
});
if (!go_on) return;
}
Blockbench.export({
resource_id: 'config',

View File

@ -427,9 +427,9 @@
"dialog.flip_animation.offset": "Offset by half the animation length",
"dialog.export_private_settings.title": "Private Settings",
"dialog.export_private_settings.message": "Your file contains the following private informations: **%0**. Remove these values if you plan to share the file with someone else.",
"dialog.export_private_settings.message": "Your file contains the following private informations: **%0**. Leave these values out if you plan to share the file with someone else.",
"dialog.export_private_settings.keep": "Keep",
"dialog.export_private_settings.remove": "Remove",
"dialog.export_private_settings.omit": "Leave Out",
"dialog.settings.title": "Preferences",
"dialog.settings.settings": "Settings",