Add Crispy Forms integration to QuestionForm and update question_form template for improved layout and usability

This commit is contained in:
Ross
2025-11-03 13:39:35 +00:00
parent 3a5ceabff0
commit 6d02b35f86
3 changed files with 69 additions and 19 deletions
+7 -6
View File
@@ -334,6 +334,7 @@ document.addEventListener('DOMContentLoaded', function() {
//}
// fallback to any table on the page that looks like it has selection
var any = document.querySelector('table.js-row-selectable') //|| Array.from(document.querySelectorAll('table')).find(function(t){ return t.querySelector && (t.querySelector('input[name="selection"]') || t.querySelector('input[type="checkbox"]')); });
console.log('findTableForControl fallback', any);
return any || null;
}
@@ -374,12 +375,12 @@ document.addEventListener('DOMContentLoaded', function() {
container.parentNode.insertBefore(wrapper, container);
}
// Create controls for any table that looks selectable but lacks a control block
Array.from(document.querySelectorAll('table')).forEach(function(t){
if (t.querySelector && (t.querySelector('input[name="selection"]') || t.querySelector('input[type="checkbox"]'))) {
ensureControlsForTable(t);
}
});
//// Create controls for any table that looks selectable but lacks a control block
//Array.from(document.querySelectorAll('table')).forEach(function(t){
// if (t.querySelector && (t.querySelector('input[name="selection"]') || t.querySelector('input[type="checkbox"]'))) {
// ensureControlsForTable(t);
// }
//});
// For every toggle button (supports both unsuffixed and suffixed IDs)
document.querySelectorAll('button[id^="toggle-row-selection"]').forEach(function(toggleBtn) {