From 30758b5c5401477c0efea4219c410bb8989e9805 Mon Sep 17 00:00:00 2001 From: "Ja (Thanakul) Wattanawong" Date: Wed, 3 Apr 2019 18:16:28 -0700 Subject: [PATCH 1/2] initial add of button --- server/controllers/admin.py | 10 ++++++++++ server/templates/staff/student/assignment.html | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/server/controllers/admin.py b/server/controllers/admin.py index 3eb8e6627..d16051af7 100644 --- a/server/controllers/admin.py +++ b/server/controllers/admin.py @@ -184,6 +184,16 @@ def grading_view(backup, form=None, is_composition=False): backup=backup, group=group, files=files, diff_type=diff_type, task=task, form=form, is_composition=is_composition) +@admin.route('/delete_backup/', methods=["POST"]) +@is_staff() +def delete_backup(bid): + backup = Backup.query.get(bid) + if not backup: + abort(404) + + db.session.delete(backup) + db.session.commit() + @admin.route('/grading/') @is_staff() def grading(bid): diff --git a/server/templates/staff/student/assignment.html b/server/templates/staff/student/assignment.html index d78994ab3..123ec53ad 100644 --- a/server/templates/staff/student/assignment.html +++ b/server/templates/staff/student/assignment.html @@ -201,7 +201,7 @@

Backups/Submissions

Submitter ID Scores - Action + Actions Flag @@ -231,6 +231,9 @@

Backups/Submissions

Grade + + Delete + From 7d5f92a58c405f56b1edd211cb9748a5c601c885 Mon Sep 17 00:00:00 2001 From: "Ja (Thanakul) Wattanawong" Date: Wed, 3 Apr 2019 19:04:09 -0700 Subject: [PATCH 2/2] change to form type --- server/templates/staff/student/assignment.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/templates/staff/student/assignment.html b/server/templates/staff/student/assignment.html index 123ec53ad..ac91774f0 100644 --- a/server/templates/staff/student/assignment.html +++ b/server/templates/staff/student/assignment.html @@ -231,9 +231,11 @@

Backups/Submissions

Grade - - Delete - + {% call forms.render_form_bare(csrf_form, action_url=url_for('.delete_backup', bid=item.id), class_='') %} + + {% endcall %}