mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 01:36:08 +08:00
core&ui: fix homework operation (#500)
This commit is contained in:
1 parent
b5a5633b73
commit
fdfa5e9722
2 files changed
+11
-11
No files matched your search
@@ -109,14 +109,6 @@ class HomeworkDetailHandler extends Handler {
|
||||
await contest.attend(domainId, tdoc.docId, this.user._id);
|
||||
this.back();
|
||||
}
|
||||
|
||||
@param('tid', Types.ObjectID)
|
||||
async postDelete(domainId: string, tid: ObjectID) {
|
||||
const tdoc = await contest.get(domainId, tid);
|
||||
if (!this.user.own(tdoc)) this.checkPerm(PERM.PERM_EDIT_HOMEWORK);
|
||||
await contest.del(domainId, tid);
|
||||
this.response.redirect = this.url('homework_main');
|
||||
}
|
||||
}
|
||||
|
||||
class HomeworkEditHandler extends Handler {
|
||||
@@ -163,7 +155,7 @@ class HomeworkEditHandler extends Handler {
|
||||
@param('pids', Types.Content)
|
||||
@param('rated', Types.Boolean)
|
||||
@param('assign', Types.CommaSeperatedArray, true)
|
||||
async post(
|
||||
async postUpdate(
|
||||
domainId: string, tid: ObjectID, beginAtDate: string, beginAtTime: string,
|
||||
penaltySinceDate: string, penaltySinceTime: string, extensionDays: number,
|
||||
penaltyRules: PenaltyRules, title: string, content: string, _pids: string, rated = false,
|
||||
@@ -208,6 +200,14 @@ class HomeworkEditHandler extends Handler {
|
||||
this.response.body = { tid };
|
||||
this.response.redirect = this.url('homework_detail', { tid });
|
||||
}
|
||||
|
||||
@param('tid', Types.ObjectID)
|
||||
async postDelete(domainId: string, tid: ObjectID) {
|
||||
const tdoc = await contest.get(domainId, tid);
|
||||
if (!this.user.own(tdoc)) this.checkPerm(PERM.PERM_EDIT_HOMEWORK);
|
||||
await contest.del(domainId, tid);
|
||||
this.response.redirect = this.url('homework_main');
|
||||
}
|
||||
}
|
||||
|
||||
export async function apply(ctx) {
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
}) }}
|
||||
<div class="row"><div class="columns">
|
||||
{% if page_name == 'homework_edit' %}
|
||||
<button type="submit" class="rounded primary button">
|
||||
<button name="operation" value="update" type="submit" class="rounded primary button">
|
||||
{{ _('Update') }}
|
||||
</button>
|
||||
<button name="operation" value="update" type="submit" formaction="{{ url('homework_create') }}" class="rounded button">
|
||||
@@ -103,7 +103,7 @@
|
||||
</button>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<button type="submit" class="rounded primary button">
|
||||
<button name="operation" value="update" type="submit" class="rounded primary button">
|
||||
{{ _('Create') }}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
Reference in new issue
Block a user