From d5f0c5a209d6d792771cd25d8bd6c81b95a0e1a2 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 28 Nov 2025 04:14:50 -0500 Subject: Add description edit form to task detail page in web UI The build and tests pass. The implementation adds a description edit for 1. An expandable `
` section similar to the existing Epic design 2. A textarea for editing the description 3. HTMX `hx-post` for seamless update (with `hx-swap="none"` since the e 4. Also shows "No description yet." message when description is empty (p Task-Id: t-168 --- Omni/Jr/Web.hs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'Omni/Jr/Web.hs') diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs index a861944..4a37c6f 100644 --- a/Omni/Jr/Web.hs +++ b/Omni/Jr/Web.hs @@ -1059,11 +1059,29 @@ instance Lucid.ToHtml TaskDetailPage where Lucid.div_ [Lucid.class_ "form-actions"] <| do Lucid.button_ [Lucid.type_ "submit", Lucid.class_ "submit-btn"] "Save Design" _ -> - unless (Text.null (TaskCore.taskDescription task)) - <| Lucid.div_ [Lucid.class_ "detail-section"] - <| do - Lucid.h3_ "Description" - Lucid.pre_ [Lucid.class_ "description"] (Lucid.toHtml (TaskCore.taskDescription task)) + Lucid.div_ [Lucid.class_ "detail-section"] <| do + Lucid.h3_ "Description" + if Text.null (TaskCore.taskDescription task) + then Lucid.p_ [Lucid.class_ "empty-msg"] "No description yet." + else Lucid.pre_ [Lucid.class_ "description"] (Lucid.toHtml (TaskCore.taskDescription task)) + Lucid.details_ [Lucid.class_ "edit-description"] <| do + Lucid.summary_ "Edit Description" + Lucid.form_ + [ Lucid.method_ "POST", + Lucid.action_ ("/tasks/" <> TaskCore.taskId task <> "/description"), + Lucid.makeAttribute "hx-post" ("/tasks/" <> TaskCore.taskId task <> "/description"), + Lucid.makeAttribute "hx-swap" "none" + ] + <| do + Lucid.textarea_ + [ Lucid.name_ "description", + Lucid.class_ "description-textarea", + Lucid.rows_ "10", + Lucid.placeholder_ "Enter description..." + ] + (Lucid.toHtml (TaskCore.taskDescription task)) + Lucid.div_ [Lucid.class_ "form-actions"] <| do + Lucid.button_ [Lucid.type_ "submit", Lucid.class_ "submit-btn"] "Save Description" let children = filter (maybe False (TaskCore.matchesId (TaskCore.taskId task)) <. TaskCore.taskParent) allTasks unless (null children) <| do -- cgit v1.2.3