Update button elements in selection controls to ensure proper type attribute for improved accessibility
This commit is contained in:
+2
-2
@@ -74,8 +74,8 @@ class SelectionTable(tables.Table):
|
|||||||
" <div>"
|
" <div>"
|
||||||
" <button class=\"btn btn-outline-secondary btn-sm\" id=\"toggle-row-selection-{}\" type=\"button\">Enable row selection</button>"
|
" <button class=\"btn btn-outline-secondary btn-sm\" id=\"toggle-row-selection-{}\" type=\"button\">Enable row selection</button>"
|
||||||
" <div id=\"selection-controls-{}\" class=\"btn-group ms-2\" role=\"group\" style=\"display:none;\">"
|
" <div id=\"selection-controls-{}\" class=\"btn-group ms-2\" role=\"group\" style=\"display:none;\">"
|
||||||
" <button class=\"btn btn-sm btn-outline-primary\" id=\"select-all-{}\">Select all</button>"
|
" <button type=\"button\" class=\"btn btn-sm btn-outline-primary\" id=\"select-all-{}\">Select all</button>"
|
||||||
" <button class=\"btn btn-sm btn-outline-secondary\" id=\"clear-selection-{}\">Clear</button>"
|
" <button type=\"button\" class=\"btn btn-sm btn-outline-secondary\" id=\"clear-selection-{}\">Clear</button>"
|
||||||
" </div>"
|
" </div>"
|
||||||
" </div>"
|
" </div>"
|
||||||
" <div>"
|
" <div>"
|
||||||
|
|||||||
+15
-9
@@ -859,23 +859,29 @@ def exam_migrate_rapids_to_shorts(request, pk):
|
|||||||
raise PermissionDenied()
|
raise PermissionDenied()
|
||||||
|
|
||||||
from shorts.models import Question as ShortQuestion
|
from shorts.models import Question as ShortQuestion
|
||||||
|
created = []
|
||||||
|
skipped = []
|
||||||
|
failed = []
|
||||||
|
|
||||||
for rapid in exam.exam_questions.all():
|
for rapid in exam.exam_questions.all():
|
||||||
try:
|
try:
|
||||||
q = ShortQuestion.from_rapid(rapid)
|
q = ShortQuestion.from_rapid(rapid)
|
||||||
if q is None:
|
if q is None:
|
||||||
# skipped normal
|
skipped.append(str(rapid.id))
|
||||||
continue
|
else:
|
||||||
except Exception:
|
created.append(str(q.id))
|
||||||
# continue on error
|
except Exception as e:
|
||||||
|
failed.append(str(rapid.id))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
messages.success(request, "Exam migration attempted. Normal questions were skipped.")
|
if created:
|
||||||
|
messages.success(request, f"Created shorts questions: {', '.join(created)}")
|
||||||
|
if skipped:
|
||||||
|
messages.info(request, f"Skipped normal rapids (not migrated): {', '.join(skipped)}")
|
||||||
|
if failed:
|
||||||
|
messages.error(request, f"Failed to migrate rapids: {', '.join(failed)}")
|
||||||
|
|
||||||
# Redirect to the exam overview for shorts if available, otherwise back to rapids exam
|
# Redirect back to the Rapids exam overview (shorts exam may not exist)
|
||||||
try:
|
|
||||||
return redirect("shorts:exam_overview", pk=exam.pk)
|
|
||||||
except Exception:
|
|
||||||
return redirect("rapids:exam_overview", pk=exam.pk)
|
return redirect("rapids:exam_overview", pk=exam.pk)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -369,8 +369,8 @@
|
|||||||
+ ' <div>'
|
+ ' <div>'
|
||||||
+ ' <button class="btn btn-outline-secondary btn-sm" id="toggle-row-selection-' + token + '" type="button">Enable row selection</button>'
|
+ ' <button class="btn btn-outline-secondary btn-sm" id="toggle-row-selection-' + token + '" type="button">Enable row selection</button>'
|
||||||
+ ' <div id="selection-controls-' + token + '" class="btn-group ms-2" role="group" style="display:none;">'
|
+ ' <div id="selection-controls-' + token + '" class="btn-group ms-2" role="group" style="display:none;">'
|
||||||
+ ' <button class="btn btn-sm btn-outline-primary" id="select-all-' + token + '">Select all</button>'
|
+ ' <button type="button" class="btn btn-sm btn-outline-primary" id="select-all-' + token + '">Select all</button>'
|
||||||
+ ' <button class="btn btn-sm btn-outline-secondary" id="clear-selection-' + token + '">Clear</button>'
|
+ ' <button type="button" class="btn btn-sm btn-outline-secondary" id="clear-selection-' + token + '">Clear</button>'
|
||||||
+ ' </div>'
|
+ ' </div>'
|
||||||
+ ' </div>'
|
+ ' </div>'
|
||||||
+ ' <div>'
|
+ ' <div>'
|
||||||
|
|||||||
Reference in New Issue
Block a user