1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2025-03-20 04:46:22 +09:00

Add "new topic" link to discussion widget

This commit is contained in:
fr33domlover 2016-05-21 21:27:12 +00:00
parent 9368e68ab5
commit 66cf702203
5 changed files with 35 additions and 7 deletions

View file

@ -42,8 +42,10 @@ import Vervis.Model
import Vervis.Settings (widgetFile)
import Vervis.Widget.Discussion
getDiscussion :: (Int -> Route App) -> AppDB DiscussionId -> Handler Html
getDiscussion reply getdid = defaultLayout $ discussionW getdid reply
getDiscussion
:: (Int -> Route App) -> Route App -> AppDB DiscussionId -> Handler Html
getDiscussion reply topic getdid =
defaultLayout $ discussionW getdid topic reply
getMessage :: (Int -> Route App) -> AppDB DiscussionId -> Int -> Handler Html
getMessage reply getdid num = do

View file

@ -139,6 +139,11 @@ getTicketR shar proj num = do
else return author
return (author, closer, ticket)
let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket
discuss =
discussionW
(return $ ticketDiscuss ticket)
(TicketTopReplyR shar proj num)
(TicketReplyR shar proj num)
defaultLayout $(widgetFile "ticket/one")
putTicketR :: Text -> Text -> Int -> Handler Html
@ -196,6 +201,7 @@ getTicketDiscussionR :: Text -> Text -> Int -> Handler Html
getTicketDiscussionR shar proj num =
getDiscussion
(TicketReplyR shar proj num)
(TicketTopReplyR shar proj num)
(selectDiscussionId shar proj num)
postTicketDiscussionR :: Text -> Text -> Int -> Handler Html

View file

@ -69,10 +69,10 @@ messageTreeW reply cReplies now t = go t
^{go tree}
|]
discussionW :: AppDB DiscussionId -> (Int -> Route App) -> Widget
discussionW getdid reply = do
discussionW :: AppDB DiscussionId -> Route App -> (Int -> Route App) -> Widget
discussionW getdid topic reply = do
forest <- handlerToWidget $ getDiscussionTree getdid
cReplies <- newIdent
now <- liftIO getCurrentTime
toWidget $(cassiusFile "templates/discussion/widget/tree.cassius")
traverse_ (messageTreeW reply cReplies now) forest
let msgTree = messageTreeW reply cReplies now
$(widgetFile "discussion/widget/tree")