diff --git a/config/routes b/config/routes index ba2dd48..7dc7011 100644 --- a/config/routes +++ b/config/routes @@ -68,43 +68,44 @@ -- Projects -- ---------------------------------------------------------------------------- -/s/#ShrIdent/r ReposR GET POST -/s/#ShrIdent/r/!new RepoNewR GET -/s/#ShrIdent/r/#RpIdent RepoR GET PUT DELETE POST -/s/#ShrIdent/r/#RpIdent/edit RepoEditR GET -/s/#ShrIdent/r/#RpIdent/s/+Texts RepoSourceR GET -/s/#ShrIdent/r/#RpIdent/c RepoHeadChangesR GET -/s/#ShrIdent/r/#RpIdent/c/#Text RepoChangesR GET -/s/#ShrIdent/r/#RpIdent/d RepoDevsR GET POST -/s/#ShrIdent/r/#RpIdent/d/!new RepoDevNewR GET -/s/#ShrIdent/r/#RpIdent/d/#ShrIdent RepoDevR GET DELETE POST +/s/#ShrIdent/r ReposR GET POST +/s/#ShrIdent/r/!new RepoNewR GET +/s/#ShrIdent/r/#RpIdent RepoR GET PUT DELETE POST +/s/#ShrIdent/r/#RpIdent/edit RepoEditR GET +/s/#ShrIdent/r/#RpIdent/s/+Texts RepoSourceR GET +/s/#ShrIdent/r/#RpIdent/c RepoHeadChangesR GET +/s/#ShrIdent/r/#RpIdent/c/#Text RepoChangesR GET +/s/#ShrIdent/r/#RpIdent/d RepoDevsR GET POST +/s/#ShrIdent/r/#RpIdent/d/!new RepoDevNewR GET +/s/#ShrIdent/r/#RpIdent/d/#ShrIdent RepoDevR GET DELETE POST -/s/#ShrIdent/r/#RpIdent/_darcs/+Texts DarcsDownloadR GET +/s/#ShrIdent/r/#RpIdent/_darcs/+Texts DarcsDownloadR GET -/s/#ShrIdent/r/#RpIdent/git/info/refs GitRefDiscoverR GET +/s/#ShrIdent/r/#RpIdent/git/info/refs GitRefDiscoverR GET --/s/#ShrIdent/r/#RpIdent/git/git-upload-pack GitUploadRequestR POST -/s/#ShrIdent/p ProjectsR GET POST -/s/#ShrIdent/p/!new ProjectNewR GET -/s/#ShrIdent/p/#PrjIdent ProjectR GET PUT POST -/s/#ShrIdent/p/#PrjIdent/edit ProjectEditR GET -/s/#ShrIdent/p/#PrjIdent/d ProjectDevsR GET POST -/s/#ShrIdent/p/#PrjIdent/d/!new ProjectDevNewR GET -/s/#ShrIdent/p/#PrjIdent/d/#ShrIdent ProjectDevR GET DELETE POST +/s/#ShrIdent/p ProjectsR GET POST +/s/#ShrIdent/p/!new ProjectNewR GET +/s/#ShrIdent/p/#PrjIdent ProjectR GET PUT POST +/s/#ShrIdent/p/#PrjIdent/edit ProjectEditR GET +/s/#ShrIdent/p/#PrjIdent/d ProjectDevsR GET POST +/s/#ShrIdent/p/#PrjIdent/d/!new ProjectDevNewR GET +/s/#ShrIdent/p/#PrjIdent/d/#ShrIdent ProjectDevR GET DELETE POST -/s/#ShrIdent/p/#PrjIdent/t TicketsR GET POST -/s/#ShrIdent/p/#PrjIdent/t/!new TicketNewR GET -/s/#ShrIdent/p/#PrjIdent/t/#Int TicketR GET PUT DELETE POST -/s/#ShrIdent/p/#PrjIdent/t/#Int/edit TicketEditR GET -/s/#ShrIdent/p/#PrjIdent/t/#Int/close TicketCloseR POST -/s/#ShrIdent/p/#PrjIdent/t/#Int/open TicketOpenR POST -/s/#ShrIdent/p/#PrjIdent/t/#Int/claim TicketClaimR POST -/s/#ShrIdent/p/#PrjIdent/t/#Int/unclaim TicketUnclaimR POST -/s/#ShrIdent/p/#PrjIdent/t/#Int/assign TicketAssignR GET POST -/s/#ShrIdent/p/#PrjIdent/t/#Int/unassign TicketUnassignR POST -/s/#ShrIdent/p/#PrjIdent/t/#Int/d TicketDiscussionR GET POST -/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 TicketsR GET POST +/s/#ShrIdent/p/#PrjIdent/t/!new TicketNewR GET +/s/#ShrIdent/p/#PrjIdent/t/#Int TicketR GET PUT DELETE POST +/s/#ShrIdent/p/#PrjIdent/t/#Int/edit TicketEditR GET +/s/#ShrIdent/p/#PrjIdent/t/#Int/close TicketCloseR POST +/s/#ShrIdent/p/#PrjIdent/t/#Int/open TicketOpenR POST +/s/#ShrIdent/p/#PrjIdent/t/#Int/claim TicketClaimR POST +/s/#ShrIdent/p/#PrjIdent/t/#Int/unclaim TicketUnclaimR POST +/s/#ShrIdent/p/#PrjIdent/t/#Int/assign TicketAssignR GET POST +/s/#ShrIdent/p/#PrjIdent/t/#Int/unassign TicketUnassignR POST +/s/#ShrIdent/p/#PrjIdent/tcr TicketClaimRequestsR GET +/s/#ShrIdent/p/#PrjIdent/t/#Int/d TicketDiscussionR GET POST +/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/w/+Texts WikiPageR GET +/s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET diff --git a/src/Vervis/Foundation.hs b/src/Vervis/Foundation.hs index afe531a..eea1329 100644 --- a/src/Vervis/Foundation.hs +++ b/src/Vervis/Foundation.hs @@ -454,6 +454,9 @@ instance YesodBreadcrumbs App where , Just $ TicketR shr prj num ) TicketUnassignR _shr _prj _num -> ("", Nothing) + TicketClaimRequestsR shr prj -> ( "Ticket Claim Requests" + , Just $ ProjectR shr prj + ) TicketDiscussionR shar proj num -> ( "Discussion" , Just $ TicketR shar proj num ) diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index a2bb85b..2cb9834 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -30,6 +30,7 @@ module Vervis.Handler.Ticket , postTicketAssignR , postTicketUnassignR , getClaimRequestsR + , getTicketClaimRequestsR , getTicketDiscussionR , postTicketDiscussionR , getTicketMessageR @@ -386,6 +387,8 @@ postTicketUnassignR shr prj num = do setMessage $ fromMaybe "The ticket is now unassigned." mmsg redirect $ TicketR shr prj num +-- | The logged-in user gets a list of the ticket claim requests they have +-- opened, in any project. getClaimRequestsR :: Handler Html getClaimRequestsR = do pid <- requireAuthId @@ -405,6 +408,31 @@ getClaimRequestsR = do ) defaultLayout $(widgetFile "person/claim-requests") +-- | Get a list of ticket claim requests for a given project. +getTicketClaimRequestsR :: ShrIdent -> PrjIdent -> Handler Html +getTicketClaimRequestsR shr prj = do + rqs <- runDB $ do + Entity sid _ <- getBy404 $ UniqueSharer shr + Entity jid _ <- getBy404 $ UniqueProject prj sid + select $ from $ + \ ( tcr `InnerJoin` + ticket `InnerJoin` + person `InnerJoin` + sharer + ) -> do + on $ person ^. PersonIdent E.==. sharer ^. SharerId + on $ tcr ^. TicketClaimRequestPerson E.==. person ^. PersonId + on $ tcr ^. TicketClaimRequestTicket E.==. ticket ^. TicketId + where_ $ ticket ^. TicketProject E.==. val jid + orderBy [desc $ tcr ^. TicketClaimRequestCreated] + return + ( sharer + , ticket ^. TicketNumber + , ticket ^. TicketTitle + , tcr ^. TicketClaimRequestCreated + ) + defaultLayout $(widgetFile "ticket/claim-request/list") + selectDiscussionId :: ShrIdent -> PrjIdent -> Int -> AppDB DiscussionId selectDiscussionId shar proj tnum = do Entity sid _sharer <- getBy404 $ UniqueSharer shar diff --git a/templates/project/one.hamlet b/templates/project/one.hamlet index cdbafbe..ea2ea68 100644 --- a/templates/project/one.hamlet +++ b/templates/project/one.hamlet @@ -26,6 +26,8 @@ $# . Description: #{fromMaybe "(none)" $ projectDesc project}
  • Tickets +
  • + Ticket claim requests

    Collaborators diff --git a/templates/ticket/claim-request/list.hamlet b/templates/ticket/claim-request/list.hamlet new file mode 100644 index 0000000..0cf2a00 --- /dev/null +++ b/templates/ticket/claim-request/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 +$# . + + + + +
    Opened on + Opened by + # + Title + $forall (Entity _ sharer, Value num, Value title, Value time) <- rqs +
    + #{showDate time} + + ^{personLinkW sharer} + + #{num} + + #{title}