mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: add homework files & enhance delete operation (#755)
This commit is contained in:
1 parent
61e56adead
commit
f0219116f3
12 files changed
+175
-13
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import $ from 'jquery';
|
||||
import { ConfirmDialog } from 'vj/components/dialog';
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
import { i18n, request, tpl } from 'vj/utils';
|
||||
|
||||
export default new NamedPage('homework_edit', () => {
|
||||
let confirmed = false;
|
||||
$(document).on('click', '[value="delete"]', (ev) => {
|
||||
ev.preventDefault();
|
||||
if (confirmed) {
|
||||
return request.post('', { operation: 'delete' }).then((res) => {
|
||||
window.location.href = res.url;
|
||||
});
|
||||
}
|
||||
const message = 'Confirm deleting this homework? Its files and status will be deleted as well.';
|
||||
return new ConfirmDialog({
|
||||
$body: tpl.typoMsg(i18n(message)),
|
||||
}).open().then((action) => {
|
||||
if (action !== 'yes') return;
|
||||
confirmed = true;
|
||||
ev.target.click();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user