diff --git a/config/models b/config/models index b1f4c84..4051d5f 100644 --- a/config/models +++ b/config/models @@ -132,6 +132,12 @@ Ticket UniqueTicket project number +TicketDependency + parent TicketId + child TicketId + + UniqueTicketDependency parent child + TicketClaimRequest person PersonId ticket TicketId diff --git a/config/routes b/config/routes index f0b19af..23af488 100644 --- a/config/routes +++ b/config/routes @@ -108,5 +108,6 @@ /s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int TicketMessageR GET POST /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/w/+Texts WikiPageR GET diff --git a/src/Vervis/Foundation.hs b/src/Vervis/Foundation.hs index 95839cc..316b685 100644 --- a/src/Vervis/Foundation.hs +++ b/src/Vervis/Foundation.hs @@ -475,5 +475,8 @@ instance YesodBreadcrumbs App where , Just $ TicketMessageR shar proj num cnum ) + TicketDepsR shr prj num -> ( "Dependencies" + , Just $ TicketR shr prj num + ) WikiPageR shr prj _page -> ("Wiki", Just $ ProjectR shr prj) diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index 6c5d07e..c74b9c1 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -38,6 +38,7 @@ module Vervis.Handler.Ticket , postTicketMessageR , getTicketTopReplyR , getTicketReplyR + , getTicketDepsR ) where @@ -497,3 +498,28 @@ getTicketReplyR shar proj tnum cnum = (TicketMessageR shar proj tnum) (selectDiscussionId shar proj tnum) cnum + +getTicketDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html +getTicketDepsR shr prj num = do + rows <- runDB $ do + Entity sid _ <- getBy404 $ UniqueSharer shr + Entity jid _ <- getBy404 $ UniqueProject prj sid + Entity tid _ <- getBy404 $ UniqueTicket jid num + select $ from $ + \ ( td `InnerJoin` + ticket `InnerJoin` + person `InnerJoin` + sharer + ) -> 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 + orderBy [asc $ ticket ^. TicketNumber] + return + ( ticket ^. TicketNumber + , sharer + , ticket ^. TicketTitle + , ticket ^. TicketDone + ) + defaultLayout $(widgetFile "ticket/dep/list") diff --git a/templates/ticket/dep/list.hamlet b/templates/ticket/dep/list.hamlet new file mode 100644 index 0000000..2425466 --- /dev/null +++ b/templates/ticket/dep/list.hamlet @@ -0,0 +1,30 @@ +$# This file is part of Vervis. +$# +$# Written in 2016 by fr33domlover . +$# +$# ♡ Copying is an act of love. Please copy, reuse and share. +$# +$# The author(s) have dedicated all copyright and related and neighboring +$# rights to this software to the public domain worldwide. This software is +$# distributed without any warranty. +$# +$# You should have received a copy of the CC0 Public Domain Dedication along +$# with this software. If not, see +$# . + + + + +
Number + Author + Title + Done + $forall (Value number, Entity _ author, Value title, Value done) <- rows +
+ #{number} + + ^{personLinkW author} + + #{title} + + #{done} diff --git a/templates/ticket/one.hamlet b/templates/ticket/one.hamlet index 4a3f377..6c28d29 100644 --- a/templates/ticket/one.hamlet +++ b/templates/ticket/one.hamlet @@ -50,6 +50,9 @@ $if not $ ticketDone ticket

Claim requests +

+ Dependencies +

Status: # $if ticketDone ticket