ui: add alert/prompt/confirm helper function (#1018)

This commit is contained in:
undefined authored and GitHub committed 2025-07-19 11:27:37 +01:00
1 parent 2d7979105e
commit d4271b3fbd
12 files changed
+176 -196

No files matched your search

@@ -1,7 +1,7 @@
import $ from 'jquery';
import { ConfirmDialog } from 'vj/components/dialog';
import { confirm } from 'vj/components/dialog';
import { NamedPage } from 'vj/misc/Page';
import { i18n, request, tpl } from 'vj/utils';
import { i18n, request } from 'vj/utils';
export default new NamedPage('training_edit', () => {
let confirmed = false;
@@ -13,10 +13,8 @@ export default new NamedPage('training_edit', () => {
});
}
const message = 'Confirm deleting this training? Its files and status will be deleted as well.';
return new ConfirmDialog({
$body: tpl.typoMsg(i18n(message)),
}).open().then((action) => {
if (action !== 'yes') return;
return confirm(i18n(message)).then((yes) => {
if (!yes) return;
confirmed = true;
ev.target.click();
});