From d96606c9a43d62c93890f8c240e2dda9a36688d5 Mon Sep 17 00:00:00 2001 From: janis steiner Date: Thu, 7 May 2026 18:33:04 +0200 Subject: [PATCH] enhance comments --- frontend/assets/js/app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/assets/js/app.js b/frontend/assets/js/app.js index d637ed7..4fd8fdc 100644 --- a/frontend/assets/js/app.js +++ b/frontend/assets/js/app.js @@ -128,7 +128,7 @@ function renderTimeline() { ${renderComments(e)}
- +
@@ -154,8 +154,9 @@ function renderComments(event) { `).join(''); } -async function addComment(eventId, btn) { - const input = btn.parentElement.querySelector('.comment-input'); +async function addComment(eventId, el) { + const container = el.closest('.comment-input-group') || el.parentElement; + const input = container.querySelector('.comment-input'); const body = input.value.trim(); if (!body) return; const author = prompt('Your name:') || 'Anonymous'; @@ -174,7 +175,7 @@ async function saveEvent() { description: document.getElementById('eventDescription').value, severity: document.getElementById('eventSeverity').value, event_type: document.getElementById('eventType').value, - occurred_at: document.getElementById('eventTime').value || new Date().toISOString().slice(0, 16) + occurred_at: new Date().toISOString().slice(0, 16) }; if (!data.title) return alert('Title required'); await apiFetch('events', { method: 'POST', body: JSON.stringify(data) });