From d697c3e26807ac900b614682c95b3ec2a8223cd2 Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Wed, 19 Nov 2025 18:57:09 +0100 Subject: [PATCH 1/2] fix: allow only one instance of mediatype to be present --- app/templates/elsa_mono_form.html | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/templates/elsa_mono_form.html b/app/templates/elsa_mono_form.html index 2b7b055..a147f55 100644 --- a/app/templates/elsa_mono_form.html +++ b/app/templates/elsa_mono_form.html @@ -103,13 +103,13 @@

Medien

- - -
@@ -173,6 +173,9 @@ // Media management functions (global scope for onclick handlers) function addMediaType(type) { + const btn = document.getElementById('btn-' + type); + // Prevent duplicate sections of same type + if (btn && btn.disabled) { return; } const container = document.getElementById('media-sections'); const sectionId = 'section-' + sectionCounter++; @@ -243,6 +246,11 @@ ''; container.appendChild(section); + // Disable button for this type until section removed + if (btn) { + btn.disabled = true; + btn.title = 'Sektion bereits hinzugefügt – entfernen zum erneuten Hinzufügen'; + } // Add first row automatically addMediaRow(sectionId, type); @@ -314,6 +322,7 @@ const section = document.getElementById(sectionId); if (section) { if (confirm('Möchten Sie diese Sektion wirklich entfernen?')) { + const type = section.getAttribute('data-type'); // Clean up tracking for removed rows const rows = section.querySelectorAll('tr[id]'); rows.forEach(row => { @@ -323,6 +332,12 @@ } }); section.remove(); + // Re-enable button for this media type + const btn = document.getElementById('btn-' + type); + if (btn) { + btn.disabled = false; + btn.title = 'Sektion hinzufügen'; + } updateSubmitButton(); } } -- 2.49.1 From 0f934a6671ce5ff43e4b3c1bc0d7f4b0b609051b Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Wed, 19 Nov 2025 18:57:22 +0100 Subject: [PATCH 2/2] chore: switch colors --- app/static/styles.css | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/static/styles.css b/app/static/styles.css index 5ecf7d9..2792960 100644 --- a/app/static/styles.css +++ b/app/static/styles.css @@ -240,6 +240,13 @@ input[type="radio"] { accent-color: var(--control-accent); } } [data-theme="dark"] .btn-secondary:hover { background: #1f2b3f; } +/* Generic disabled button state */ +.btn:disabled { + opacity: 0.55; + cursor: not-allowed; + filter: grayscale(0.15); +} + .actions { margin-top: 16px; display: flex; @@ -537,8 +544,8 @@ input[type="radio"] { accent-color: var(--control-accent); } top: 20px; right: 20px; background: var(--card-bg); - border: 1px solid hsl(142, 71%, 45%); - background-color: hsl(142, 82%, 30%); + border: 1px solid hsl(142, 82%, 30%); + background-color: hsl(142, 71%, 45%); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); padding: 16px 20px; -- 2.49.1