From dceaccb4d12074c1cb1c429a0f47f5baf259257b Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 4 Sep 2025 20:53:02 +0800 Subject: [PATCH] ui: add confirm to domain_delete --- packages/ui-default/locales/zh.yaml | 1 + .../ui-default/pages/domain_dashboard.page.ts | 16 ++++++++++++++++ .../ui-default/templates/domain_dashboard.html | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packages/ui-default/pages/domain_dashboard.page.ts diff --git a/packages/ui-default/locales/zh.yaml b/packages/ui-default/locales/zh.yaml index f19a3962b..903c8f1cc 100644 --- a/packages/ui-default/locales/zh.yaml +++ b/packages/ui-default/locales/zh.yaml @@ -189,6 +189,7 @@ Completed: 已完成 Config: 配置 Confirm deleting the selected roles?: 您确定删除所选角色吗? Confirm deleting this comment? Its replies will be deleted as well.: 确认删除这个评论吗?回复会被同时删除。 +Confirm deleting this domain? This action cannot be undone.: '确认删除此域?此操作无法撤销。' Confirm deleting this reply?: 确认删除这个回复吗? Confirm rejudge this problem?: 确定要重测这道题吗? Confirm removing the selected users?: 您确定将所选用户移除吗? diff --git a/packages/ui-default/pages/domain_dashboard.page.ts b/packages/ui-default/pages/domain_dashboard.page.ts new file mode 100644 index 000000000..7a4ee5322 --- /dev/null +++ b/packages/ui-default/pages/domain_dashboard.page.ts @@ -0,0 +1,16 @@ +import { confirm } from 'vj/components/dialog'; +import { NamedPage } from 'vj/misc/Page'; +import { i18n } from 'vj/utils'; + +export default new NamedPage('domain_dashboard', () => { + let confirmed = false; + $(document).on('submit', '#delete-domain-form', (ev) => { + if (confirmed) return; + ev.preventDefault(); + confirm(i18n('Confirm deleting this domain? This action cannot be undone.')).then((yes) => { + if (!yes) return; + confirmed = true; + $(ev.currentTarget).submit(); + }); + }); +}); diff --git a/packages/ui-default/templates/domain_dashboard.html b/packages/ui-default/templates/domain_dashboard.html index 3c4dc0bbd..03a8a026b 100644 --- a/packages/ui-default/templates/domain_dashboard.html +++ b/packages/ui-default/templates/domain_dashboard.html @@ -31,7 +31,7 @@

{{ _('Delete Domain') }}

-
+