← Back to task

Commit d5f0c5a2

commit d5f0c5a209d6d792771cd25d8bd6c81b95a0e1a2
Author: Ben Sima <ben@bensima.com>
Date:   Fri Nov 28 04:14:50 2025

    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 `<details>` 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

diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs
index a8619440..4a37c6f1 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