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

@@ -39,9 +39,22 @@
<button class="template-select-btn">Create Your Own Protocol</button>
<p class="template-description">Start with a blank protocol and build it from scratch.</p>
</div>
<!-- Template options will be populated by JavaScript -->
<!-- Template options from Hugo data -->
{{ range $filename, $template := .Site.Data.templates }}
<div class="template-option" data-template-id="{{ $template.id }}">
<button class="template-select-btn">{{ $template.title }}</button>
<p class="template-description">{{ $template.description }}</p>
</div>
{{ end }}
</div>
</div>
<!-- Make template data available to JavaScript -->
<script>
window.allTemplates = {{ .Site.Data.templates | jsonify }};
console.log('Templates loaded from Hugo data:', Object.keys(window.allTemplates).length, 'templates');
</script>
</div>

View File

@@ -16,8 +16,7 @@
<!-- Custom JS for the builder -->
{{ if eq .Layout "builder" }}
<script defer src="{{ "js/debug.js" | relURL }}"></script>
<script type="module" src="{{ "js/templates/index.js" | relURL }}"></script>
<script type="module" src="{{ "js/builder.js" | relURL }}"></script>
<script defer src="{{ "js/builder.js" | relURL }}"></script>
<!-- Auto-resize textareas script -->
<script>