From e73c55954af6ab7fb2af6713922c466371098856 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 17 Jun 2026 13:59:21 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A2=20Publish-Button=20im=20Header=20+?= =?UTF-8?q?=20=E2=9C=8F=EF=B8=8F=20Spieltitel=20inline=20editierbar=20+=20?= =?UTF-8?q?partielles=20DB-Update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 66ae5e2..eba155a 100644 --- a/app.py +++ b/app.py @@ -1202,6 +1202,9 @@ def submission_detail(sub_id: int): ← Zurück

{type_emoji} #{row['id']}

{row['channel']} · {row['created_at']}
{f'
📍 {row["halle"]}
' if row['halle'] else ''} +
+ +
@@ -1213,7 +1216,11 @@ def submission_detail(sub_id: int):
Status
{row['status']}
Kategorie
{row['category'] or '-'}
📍 Halle / Stand
{row['halle'] or '– nicht erkannt –'}
-
🎯 Spieltitel
{row['spiel_titel'] or '–'}
+
🎯 Spieltitel
+ + + +
@@ -1307,6 +1314,30 @@ if (_llmBtn) {{ this.textContent = '🤖 LLM-Zusammenfassung'; }}); }} +var _spielBtn = document.getElementById('saveSpielTitelBtn'); +var _spielInput = document.getElementById('spielTitelInline'); +var _spielStatus = document.getElementById('spielTitelStatus'); +if (_spielBtn && _spielInput) {{ + _spielBtn.addEventListener('click', async function() {{ + this.disabled = true; + _spielStatus.style.display = 'none'; + try {{ + const formData = new FormData(); + formData.append('action', 'save'); + formData.append('spiel_titel', _spielInput.value.trim()); + const r = await fetch('/submission/{row["id"]}/update-summary', {{method:'POST', body:formData}}); + if (r.ok) {{ + _spielStatus.textContent = '✓ Gespeichert'; + _spielStatus.style.display = 'inline'; + setTimeout(() => {{ _spielStatus.style.display = 'none'; }}, 2000); + }} + }} catch(err) {{ _spielStatus.textContent = 'Fehler'; _spielStatus.style.display = 'inline'; }} + this.disabled = false; + }}); + _spielInput.addEventListener('keydown', function(e) {{ + if (e.key === 'Enter') {{ e.preventDefault(); _spielBtn.click(); }} + }}); +}} """ @@ -1330,10 +1361,33 @@ def submission_update_summary(sub_id: int): elif action == "done": db.execute("UPDATE submissions SET status='done' WHERE id=?", (sub_id,)) elif action == "save": - db.execute( - "UPDATE submissions SET summary=?, publish_name=?, halle=?, spiel_titel=? WHERE id=?", - (summary or None, publish_name or None, halle or None, spiel_titel or None, sub_id), - ) + # Partial update — only update fields that are provided + fields = [] + params = [] + if summary: + fields.append("summary=?") + params.append(summary) + if publish_name: + fields.append("publish_name=?") + params.append(publish_name) + if halle: + fields.append("halle=?") + params.append(halle) + if spiel_titel: + fields.append("spiel_titel=?") + params.append(spiel_titel) + # Clear fields explicitly set to empty + if request.form.get("summary") is not None and not summary: + fields.append("summary=NULL") + if request.form.get("publish_name") is not None and not publish_name: + fields.append("publish_name=NULL") + if request.form.get("halle") is not None and not halle: + fields.append("halle=NULL") + if request.form.get("spiel_titel") is not None and not spiel_titel: + fields.append("spiel_titel=NULL") + if fields: + params.append(sub_id) + db.execute(f"UPDATE submissions SET {', '.join(fields)} WHERE id=?", params) elif action == "save_media": # Collect media publish flags from form import re