diff --git a/templates/exam_overview_js.html b/templates/exam_overview_js.html
index 2b6ba740..d27d785d 100644
--- a/templates/exam_overview_js.html
+++ b/templates/exam_overview_js.html
@@ -143,7 +143,8 @@
})
})
$("#button-edit-order").click(function (evt) {
- $(this).remove();
+ // hide the edit button while in edit mode so we can restore it after saving
+ $(this).addClass('d-none').prop('disabled', true);
sortable('.sortable');
$("#full-question-list").addClass('sorting');
@@ -215,7 +216,7 @@
});
$("#full-question-list").after($(
- ""
+ ""
).click(() => {
new_order = [];
$("#full-question-list li").each((n, el) => {
@@ -237,6 +238,20 @@
if (data.status == "success") {
toastr.info('Exam order changed.')
renumber();
+
+ // cleanup ordering controls and restore edit button
+ $('#random-order-button').remove();
+ $('#save-order-button').remove();
+ $('#cancel-order-button').remove();
+ // remove per-item move controls
+ $('#full-question-list .move-up, #full-question-list .move-down').remove();
+ // remove fallback delete buttons if desired (keep server-side removes intact)
+ $('#full-question-list .exam-question-delete').remove();
+ // remove visual sorting state
+ $('#full-question-list').removeClass('sorting');
+
+ // restore the edit button so the user can re-enter edit mode
+ $('#button-edit-order').removeClass('d-none').prop('disabled', false);
}
})
.always(function () {