1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 16:54:53 +09:00

List ticket deps and reverse deps in ticket page

This commit is contained in:
fr33domlover 2016-07-04 09:58:25 +00:00
parent 54bbf1907a
commit fcb68ceea7
6 changed files with 111 additions and 7 deletions

View file

@ -81,6 +81,7 @@ import Vervis.TicketFilter (filterTickets)
import Vervis.Time (showDate)
import Vervis.Widget.Discussion (discussionW)
import Vervis.Widget.Sharer (personLinkW)
import Vervis.Widget.Ticket
getTicketsR :: ShrIdent -> PrjIdent -> Handler Html
getTicketsR shar proj = do
@ -154,12 +155,11 @@ getTicketNewR shar proj = do
getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketR shar proj num = do
mpid <- maybeAuthId
(author, massignee, closer, ticket) <- runDB $ do
ticket <- do
(author, massignee, closer, ticket, deps, rdeps) <- runDB $ do
Entity tid ticket <- do
Entity s _ <- getBy404 $ UniqueSharer shar
Entity p _ <- getBy404 $ UniqueProject proj s
Entity _ t <- getBy404 $ UniqueTicket p num
return t
getBy404 $ UniqueTicket p num
author <- do
person <- get404 $ ticketCreator ticket
get404 $ personIdent person
@ -173,7 +173,15 @@ getTicketR shar proj num = do
person <- get404 $ ticketCloser ticket
get404 $ personIdent person
else return author
return (author, massignee, closer, ticket)
deps <- select $ from $ \ (dep `InnerJoin` t) -> do
on $ dep ^. TicketDependencyChild E.==. t ^. TicketId
where_ $ dep ^. TicketDependencyParent E.==. val tid
return t
rdeps <- select $ from $ \ (dep `InnerJoin` t) -> do
on $ dep ^. TicketDependencyParent E.==. t ^. TicketId
where_ $ dep ^. TicketDependencyChild E.==. val tid
return t
return (author, massignee, closer, ticket, deps, rdeps)
let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket
discuss =
discussionW

View file

@ -0,0 +1,39 @@
{- This file is part of Vervis.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
-
- 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
- <http://creativecommons.org/publicdomain/zero/1.0/>.
-}
module Vervis.Widget.Ticket
( ticketDepW
)
where
import Prelude
import Yesod.Core (Route)
import Yesod.Core.Handler (getUrlRender)
import Yesod.Core (newIdent)
import qualified Data.Text as T (unpack)
import Vervis.Foundation
import Vervis.Model
import Vervis.Model.Ident
import Vervis.Settings (widgetFile)
import Vervis.Style
ticketDepW :: ShrIdent -> PrjIdent -> Ticket -> Widget
ticketDepW shr prj ticket = do
todoC <- newIdent
doneC <- newIdent
$(widgetFile "ticket/widget/dep")

View file

@ -20,10 +20,24 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<input type=submit value="Delete this ticket">
<p>
Depended by: TODO
Depended by:
<ul>
$if null rdeps
<li>(none)
$else
$forall Entity _ t <- rdeps
^{ticketDepW shar proj t}
<p>
Depends on: TODO
Depends on:
<ul>
$if null deps
<li>(none)
$else
$forall Entity _ t <- deps
^{ticketDepW shar proj t}
<p>
Created on #{showDate $ ticketCreated ticket} by

View file

@ -0,0 +1,20 @@
/* This file is part of Vervis.
*
* Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
*
* ♡ 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
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
.#{todoC}
color: #{dark red}
.#{doneC}
color: #{dark green}

View file

@ -0,0 +1,22 @@
$# This file is part of Vervis.
$#
$# Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ 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
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
$if ticketDone ticket
<span .#{doneC}>
$else
<span .#{todoC}>
<a href=@{TicketR shr prj $ ticketNumber ticket}>
#{ticketTitle ticket}

View file

@ -151,6 +151,7 @@ library
Vervis.Widget.Repo
Vervis.Widget.Role
Vervis.Widget.Sharer
Vervis.Widget.Ticket
Vervis.Wiki
-- other-modules:
default-extensions: TemplateHaskell