From 8c8d484dcefb34584b5cb6795ae1d3b257f0eb05 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 16 Nov 2025 23:06:33 +0000 Subject: [PATCH] Enhance exam order editing: hide edit button during editing, improve save button attributes, and clean up controls after saving --- templates/exam_overview_js.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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 () {