Reverse dependencies page for tickets

This commit is contained in:
fr33domlover 2016-07-27 08:35:50 +00:00
parent 350f8a9521
commit d1e1f3c0f7
4 changed files with 22 additions and 4 deletions

View file

@ -110,5 +110,6 @@
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/!reply TicketTopReplyR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int/reply TicketReplyR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/deps TicketDepsR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/rdeps TicketReverseDepsR GET
/s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET

View file

@ -495,5 +495,8 @@ instance YesodBreadcrumbs App where
TicketDepsR shr prj num -> ( "Dependencies"
, Just $ TicketR shr prj num
)
TicketReverseDepsR shr prj num -> ( "Dependants"
, Just $ TicketR shr prj num
)
WikiPageR shr prj _page -> ("Wiki", Just $ ProjectR shr prj)

View file

@ -41,6 +41,7 @@ module Vervis.Handler.Ticket
, getTicketTopReplyR
, getTicketReplyR
, getTicketDepsR
, getTicketReverseDepsR
)
where
@ -543,8 +544,12 @@ getTicketReplyR shar proj tnum cnum =
(selectDiscussionId shar proj tnum)
cnum
getTicketDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketDepsR shr prj num = do
getTicketDeps :: Bool -> ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketDeps forward shr prj num = do
let from' =
if forward then TicketDependencyParent else TicketDependencyChild
to' =
if forward then TicketDependencyChild else TicketDependencyParent
rows <- runDB $ do
Entity sid _ <- getBy404 $ UniqueSharer shr
Entity jid _ <- getBy404 $ UniqueProject prj sid
@ -557,8 +562,8 @@ getTicketDepsR shr prj num = do
) -> do
on $ person ^. PersonIdent E.==. sharer ^. SharerId
on $ ticket ^. TicketCreator E.==. person ^. PersonId
on $ td ^. TicketDependencyChild E.==. ticket ^. TicketId
where_ $ td ^. TicketDependencyParent E.==. val tid
on $ td ^. to' E.==. ticket ^. TicketId
where_ $ td ^. from' E.==. val tid
orderBy [asc $ ticket ^. TicketNumber]
return
( ticket ^. TicketNumber
@ -567,3 +572,9 @@ getTicketDepsR shr prj num = do
, ticket ^. TicketDone
)
defaultLayout $(widgetFile "ticket/dep/list")
getTicketDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketDepsR = getTicketDeps True
getTicketReverseDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketReverseDepsR = getTicketDeps False

View file

@ -77,6 +77,9 @@ $if not $ ticketDone ticket
<p>
<a href=@{TicketDepsR shar proj num}>Dependencies
<p>
<a href=@{TicketReverseDepsR shar proj num}>Dependants
<p>
Status: #
$if ticketDone ticket