Improvements in template handling and loading

This commit is contained in:
Nathan Schneider
2025-07-22 12:17:25 -06:00
parent 3ef15444fe
commit 847b603734
59 changed files with 1070 additions and 2153 deletions

View File

@@ -1,26 +1,34 @@
console.log('Testing toggle button functionality');
// Debug script to inspect template loading
// Debug script for dispute protocol builder
console.log("Debug script loaded");
document.addEventListener('DOMContentLoaded', function() {
console.log("DOM loaded in debug script");
// Log raw templates
console.log("Raw Protocol Templates:", typeof rawProtocolTemplates !== 'undefined' ? rawProtocolTemplates.length : "undefined");
if (typeof rawProtocolTemplates !== 'undefined') {
console.log("Template titles:", rawProtocolTemplates.map(t => t.title));
}
// Log processed templates
// Check template system after a delay
setTimeout(() => {
const templateSelect = document.getElementById('protocol-template');
if (templateSelect) {
console.log("Template options:", templateSelect.options.length);
const options = Array.from(templateSelect.options).map(o => o.textContent);
console.log("Option texts:", options);
// Check if templates are loaded
if (window.allTemplates) {
let templatesData;
try {
templatesData = typeof window.allTemplates === 'string' ?
JSON.parse(window.allTemplates) : window.allTemplates;
const templateCount = Object.keys(templatesData).length;
console.log(`✓ Templates loaded: ${templateCount} templates available`);
console.log("Template IDs:", Object.keys(templatesData));
} catch (error) {
console.error("✗ Error parsing templates:", error);
}
} else {
console.log("Template select element not found");
console.warn("Templates not found in window.allTemplates");
}
}, 1000);
// Check if template options are in the DOM
const templateOptions = document.querySelectorAll('.template-option');
console.log(`✓ Template options in DOM: ${templateOptions.length} found`);
// Check if form fields exist
const textareas = document.querySelectorAll('textarea');
console.log(`✓ Form fields: ${textareas.length} textareas found`);
}, 500);
});