diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-01 21:38:17 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-01 21:38:17 -0500 |
| commit | 7da1c7e717af3cadf927b5f6efb253f0d10423a8 (patch) | |
| tree | e6d52326215026a5cc1002a06f68cbd6281b1b6f /Omni/Jr/Web/Handlers.hs | |
| parent | 437a204017c7b357c3fc4dcc8c23151a288d1a8e (diff) | |
Make complexity badge editable on task detail page
- Add ComplexityForm and ComplexityBadgePartial types
- Add /tasks/:id/complexity POST endpoint
- Add complexityBadgeWithForm component with dropdown
- Add complexity dropdown JS for keyboard navigation
- Add CSS styles for complexity dropdown
- Always show complexity badge (Set Complexity if none)
Task-Id: t-219
Diffstat (limited to 'Omni/Jr/Web/Handlers.hs')
| -rw-r--r-- | Omni/Jr/Web/Handlers.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Omni/Jr/Web/Handlers.hs b/Omni/Jr/Web/Handlers.hs index 5b542dd..9dd5847 100644 --- a/Omni/Jr/Web/Handlers.hs +++ b/Omni/Jr/Web/Handlers.hs @@ -60,6 +60,7 @@ type API = :<|> "tasks" :> Capture "id" Text :> Get '[Lucid.HTML] TaskDetailPage :<|> "tasks" :> Capture "id" Text :> "status" :> ReqBody '[FormUrlEncoded] StatusForm :> Post '[Lucid.HTML] StatusBadgePartial :<|> "tasks" :> Capture "id" Text :> "priority" :> ReqBody '[FormUrlEncoded] PriorityForm :> Post '[Lucid.HTML] PriorityBadgePartial + :<|> "tasks" :> Capture "id" Text :> "complexity" :> ReqBody '[FormUrlEncoded] ComplexityForm :> Post '[Lucid.HTML] ComplexityBadgePartial :<|> "tasks" :> Capture "id" Text :> "description" :> "view" :> Get '[Lucid.HTML] DescriptionViewPartial :<|> "tasks" :> Capture "id" Text :> "description" :> "edit" :> Get '[Lucid.HTML] DescriptionEditPartial :<|> "tasks" :> Capture "id" Text :> "description" :> ReqBody '[FormUrlEncoded] DescriptionForm :> Post '[Lucid.HTML] DescriptionViewPartial @@ -106,6 +107,7 @@ server = :<|> taskDetailHandler :<|> taskStatusHandler :<|> taskPriorityHandler + :<|> taskComplexityHandler :<|> descriptionViewHandler :<|> descriptionEditHandler :<|> descriptionPostHandler @@ -298,6 +300,11 @@ server = _ <- liftIO <| TaskCore.editTask tid (\t -> t {TaskCore.taskPriority = newPriority}) pure (PriorityBadgePartial newPriority tid) + taskComplexityHandler :: Text -> ComplexityForm -> Servant.Handler ComplexityBadgePartial + taskComplexityHandler tid (ComplexityForm newComplexity) = do + _ <- liftIO <| TaskCore.editTask tid (\t -> t {TaskCore.taskComplexity = newComplexity}) + pure (ComplexityBadgePartial newComplexity tid) + descriptionViewHandler :: Text -> Servant.Handler DescriptionViewPartial descriptionViewHandler tid = do tasks <- liftIO TaskCore.loadTasks |
