diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-28 04:14:50 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-28 04:14:50 -0500 |
| commit | d5f0c5a209d6d792771cd25d8bd6c81b95a0e1a2 (patch) | |
| tree | 8e5140a38f40737e59843c5e6a184713eacbb21a /Omni/Jr/Web.hs | |
| parent | b616e753da03d234c7e4e0a0ea50c9e192644cf9 (diff) | |
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
Diffstat (limited to 'Omni/Jr/Web.hs')
| -rw-r--r-- | Omni/Jr/Web.hs | 28 |
1 files changed, 23 insertions, 5 deletions
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 |
