Add image upload preview functionality; update titles and templates for consistency

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-29 13:02:11 +02:00
parent 8871f136d4
commit 3224d16197
13 changed files with 75 additions and 35 deletions
+22
View File
@@ -18,6 +18,28 @@ document.addEventListener("DOMContentLoaded", () => {
});
}
// ── Image upload preview ───────────────────────────────
const imageInput = document.getElementById("reference_image");
const imagePreviewWrap = document.getElementById("image-upload-preview");
const imagePreview = document.getElementById("image-upload-preview-img");
const imageFilename = document.getElementById("image-upload-filename");
if (imageInput && imagePreviewWrap && imagePreview && imageFilename) {
imageInput.addEventListener("change", () => {
const file = imageInput.files && imageInput.files[0];
if (!file) {
imagePreviewWrap.hidden = true;
imagePreview.removeAttribute("src");
imageFilename.textContent = "";
return;
}
imagePreview.src = URL.createObjectURL(file);
imageFilename.textContent = file.name;
imagePreviewWrap.hidden = false;
});
}
// ── Generate dropdown tabs ─────────────────────────────
document.querySelectorAll(".tab-btn").forEach((btn) => {
btn.addEventListener("click", () => {
+4
View File
@@ -359,6 +359,10 @@ pre {
margin-top: 0.5rem;
}
.image-upload-preview {
margin-top: 0.75rem;
}
/* ─── Admin table ──────────────────────────────────────── */
.stats-grid {
display: grid;