summaryrefslogtreecommitdiff
path: root/Omni/Jr/Web.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Jr/Web.hs')
-rw-r--r--Omni/Jr/Web.hs29
1 files changed, 13 insertions, 16 deletions
diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs
index fbb56a7..a861944 100644
--- a/Omni/Jr/Web.hs
+++ b/Omni/Jr/Web.hs
@@ -879,10 +879,8 @@ renderEpicCardWithStats allTasks t =
Lucid.span_ [Lucid.class_ "priority"] (Lucid.toHtml (tshow (TaskCore.taskPriority t)))
Lucid.p_ [Lucid.class_ "task-title"] (Lucid.toHtml (TaskCore.taskTitle t))
when (totalCount > 0) <| epicProgressBar doneCount inProgressCount openAndReview totalCount
- case TaskCore.taskDescription t of
- Nothing -> pure ()
- Just desc ->
- Lucid.p_ [Lucid.class_ "kb-preview"] (Lucid.toHtml (Text.take 200 desc <> "..."))
+ unless (Text.null (TaskCore.taskDescription t))
+ <| Lucid.p_ [Lucid.class_ "kb-preview"] (Lucid.toHtml (Text.take 200 (TaskCore.taskDescription t) <> "..."))
getDescendants :: [TaskCore.Task] -> Text -> [TaskCore.Task]
getDescendants allTasks parentId =
@@ -1045,9 +1043,9 @@ instance Lucid.ToHtml TaskDetailPage where
for_ maybeAggMetrics (renderAggregatedMetrics allTasks task)
Lucid.div_ [Lucid.class_ "detail-section"] <| do
Lucid.h3_ "Design"
- case TaskCore.taskDescription task of
- Nothing -> Lucid.p_ [Lucid.class_ "empty-msg"] "No design document yet."
- Just desc -> Lucid.div_ [Lucid.class_ "markdown-content"] (renderMarkdown desc)
+ if Text.null (TaskCore.taskDescription task)
+ then Lucid.p_ [Lucid.class_ "empty-msg"] "No design document yet."
+ else Lucid.div_ [Lucid.class_ "markdown-content"] (renderMarkdown (TaskCore.taskDescription task))
Lucid.details_ [Lucid.class_ "edit-description"] <| do
Lucid.summary_ "Edit Design"
Lucid.form_ [Lucid.method_ "POST", Lucid.action_ ("/tasks/" <> TaskCore.taskId task <> "/description")] <| do
@@ -1057,16 +1055,15 @@ instance Lucid.ToHtml TaskDetailPage where
Lucid.rows_ "15",
Lucid.placeholder_ "Enter design in Markdown format..."
]
- (Lucid.toHtml (fromMaybe "" (TaskCore.taskDescription task)))
+ (Lucid.toHtml (TaskCore.taskDescription task))
Lucid.div_ [Lucid.class_ "form-actions"] <| do
Lucid.button_ [Lucid.type_ "submit", Lucid.class_ "submit-btn"] "Save Design"
_ ->
- case TaskCore.taskDescription task of
- Nothing -> pure ()
- Just desc ->
- Lucid.div_ [Lucid.class_ "detail-section"] <| do
- Lucid.h3_ "Description"
- Lucid.pre_ [Lucid.class_ "description"] (Lucid.toHtml desc)
+ 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))
let children = filter (maybe False (TaskCore.matchesId (TaskCore.taskId task)) <. TaskCore.taskParent) allTasks
unless (null children) <| do
@@ -2027,8 +2024,8 @@ server =
taskDescriptionHandler :: Text -> DescriptionForm -> Servant.Handler (Headers '[Header "Location" Text] NoContent)
taskDescriptionHandler tid (DescriptionForm desc) = do
- let descMaybe = if Text.null (Text.strip desc) then Nothing else Just desc
- _ <- liftIO <| TaskCore.editTask tid (\t -> t {TaskCore.taskDescription = descMaybe})
+ let descText = Text.strip desc
+ _ <- liftIO <| TaskCore.editTask tid (\t -> t {TaskCore.taskDescription = descText})
pure <| addHeader ("/tasks/" <> tid) NoContent
taskNotesHandler :: Text -> NotesForm -> Servant.Handler (Headers '[Header "Location" Text] NoContent)