diff --git a/config/models b/config/models
index c087a28..b1f4c84 100644
--- a/config/models
+++ b/config/models
@@ -135,7 +135,7 @@ Ticket
TicketClaimRequest
person PersonId
ticket TicketId
- message Text
+ message Text -- Assume this is Pandoc Markdown
created UTCTime
UniqueTicketClaimRequest person ticket
diff --git a/config/routes b/config/routes
index 7dc7011..f0b19af 100644
--- a/config/routes
+++ b/config/routes
@@ -32,80 +32,81 @@
-- People
-- ----------------------------------------------------------------------------
-/s SharersR GET
-/s/#ShrIdent SharerR GET
+/s SharersR GET
+/s/#ShrIdent SharerR GET
-/p PeopleR GET POST
-/p/!new PersonNewR GET
-/p/#ShrIdent PersonR GET
+/p PeopleR GET POST
+/p/!new PersonNewR GET
+/p/#ShrIdent PersonR GET
-/g GroupsR GET POST
-/g/!new GroupNewR GET
-/g/#ShrIdent GroupR GET
-/g/#ShrIdent/m GroupMembersR GET POST
-/g/#ShrIdent/m/!new GroupMemberNewR GET
-/g/#ShrIdent/m/#ShrIdent GroupMemberR GET DELETE POST
+/g GroupsR GET POST
+/g/!new GroupNewR GET
+/g/#ShrIdent GroupR GET
+/g/#ShrIdent/m GroupMembersR GET POST
+/g/#ShrIdent/m/!new GroupMemberNewR GET
+/g/#ShrIdent/m/#ShrIdent GroupMemberR GET DELETE POST
-/k KeysR GET POST
-/k/!new KeyNewR GET
-/k/#KyIdent KeyR GET DELETE POST
+/k KeysR GET POST
+/k/!new KeyNewR GET
+/k/#KyIdent KeyR GET DELETE POST
-/cr ClaimRequestsR GET
+/cr ClaimRequestsPersonR GET
-/s/#ShrIdent/rr RepoRolesR GET POST
-/s/#ShrIdent/rr/!new RepoRoleNewR GET
-/s/#ShrIdent/rr/#RlIdent RepoRoleR GET DELETE POST
-/s/#ShrIdent/rr/#RlIdent/a RepoRoleOpsR GET POST
-/s/#ShrIdent/rr/#RlIdent/a/!new RepoRoleOpNewR GET
+/s/#ShrIdent/rr RepoRolesR GET POST
+/s/#ShrIdent/rr/!new RepoRoleNewR GET
+/s/#ShrIdent/rr/#RlIdent RepoRoleR GET DELETE POST
+/s/#ShrIdent/rr/#RlIdent/a RepoRoleOpsR GET POST
+/s/#ShrIdent/rr/#RlIdent/a/!new RepoRoleOpNewR GET
-/s/#ShrIdent/pr ProjectRolesR GET POST
-/s/#ShrIdent/pr/!new ProjectRoleNewR GET
-/s/#ShrIdent/pr/#RlIdent ProjectRoleR GET DELETE POST
-/s/#ShrIdent/pr/#RlIdent/a ProjectRoleOpsR GET POST
-/s/#ShrIdent/pr/#RlIdent/a/!new ProjectRoleOpNewR GET
+/s/#ShrIdent/pr ProjectRolesR GET POST
+/s/#ShrIdent/pr/!new ProjectRoleNewR GET
+/s/#ShrIdent/pr/#RlIdent ProjectRoleR GET DELETE POST
+/s/#ShrIdent/pr/#RlIdent/a ProjectRoleOpsR GET POST
+/s/#ShrIdent/pr/#RlIdent/a/!new ProjectRoleOpNewR GET
-- ----------------------------------------------------------------------------
-- 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/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/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 ClaimRequestsProjectR GET
+/s/#ShrIdent/p/#PrjIdent/t/#Int/cr ClaimRequestsTicketR 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 eea1329..95839cc 100644
--- a/src/Vervis/Foundation.hs
+++ b/src/Vervis/Foundation.hs
@@ -130,7 +130,7 @@ instance Yesod App where
(KeyR _key , _ ) -> personAny
(KeyNewR , _ ) -> personAny
- (ClaimRequestsR , _ ) -> personAny
+ (ClaimRequestsPersonR , _ ) -> personAny
(RepoRolesR shr , _ ) -> personOrGroupAdmin shr
(RepoRoleNewR shr , _ ) -> personOrGroupAdmin shr
@@ -368,7 +368,7 @@ instance YesodBreadcrumbs App where
KeyNewR -> ("New", Just KeysR)
KeyR key -> (ky2text key, Just KeysR)
- ClaimRequestsR -> ( "Ticket Claim Requests"
+ ClaimRequestsPersonR -> ( "Ticket Claim Requests"
, Just HomeR
)
@@ -454,9 +454,12 @@ instance YesodBreadcrumbs App where
, Just $ TicketR shr prj num
)
TicketUnassignR _shr _prj _num -> ("", Nothing)
- TicketClaimRequestsR shr prj -> ( "Ticket Claim Requests"
+ ClaimRequestsProjectR shr prj -> ( "Ticket Claim Requests"
, Just $ ProjectR shr prj
)
+ ClaimRequestsTicketR shr prj num -> ( "Ticket Claim Requests"
+ , Just $ TicketR shr prj num
+ )
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 2cb9834..6c5d07e 100644
--- a/src/Vervis/Handler/Ticket.hs
+++ b/src/Vervis/Handler/Ticket.hs
@@ -29,8 +29,9 @@ module Vervis.Handler.Ticket
, getTicketAssignR
, postTicketAssignR
, postTicketUnassignR
- , getClaimRequestsR
- , getTicketClaimRequestsR
+ , getClaimRequestsPersonR
+ , getClaimRequestsProjectR
+ , getClaimRequestsTicketR
, getTicketDiscussionR
, postTicketDiscussionR
, getTicketMessageR
@@ -389,8 +390,8 @@ postTicketUnassignR shr prj num = do
-- | The logged-in user gets a list of the ticket claim requests they have
-- opened, in any project.
-getClaimRequestsR :: Handler Html
-getClaimRequestsR = do
+getClaimRequestsPersonR :: Handler Html
+getClaimRequestsPersonR = do
pid <- requireAuthId
rqs <- runDB $ select $ from $
\ (tcr `InnerJoin` ticket `InnerJoin` project `InnerJoin` sharer) -> do
@@ -409,8 +410,8 @@ 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
+getClaimRequestsProjectR :: ShrIdent -> PrjIdent -> Handler Html
+getClaimRequestsProjectR shr prj = do
rqs <- runDB $ do
Entity sid _ <- getBy404 $ UniqueSharer shr
Entity jid _ <- getBy404 $ UniqueProject prj sid
@@ -431,6 +432,21 @@ getTicketClaimRequestsR shr prj = do
, ticket ^. TicketTitle
, tcr ^. TicketClaimRequestCreated
)
+ defaultLayout $(widgetFile "project/claim-request/list")
+
+-- | Get a list of ticket claim requests for a given ticket.
+getClaimRequestsTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html
+getClaimRequestsTicketR shr prj num = do
+ rqs <- runDB $ do
+ Entity sid _ <- getBy404 $ UniqueSharer shr
+ Entity jid _ <- getBy404 $ UniqueProject prj sid
+ Entity tid _ <- getBy404 $ UniqueTicket jid num
+ select $ from $ \ (tcr `InnerJoin` person `InnerJoin` sharer) -> do
+ on $ person ^. PersonIdent E.==. sharer ^. SharerId
+ on $ tcr ^. TicketClaimRequestPerson E.==. person ^. PersonId
+ where_ $ tcr ^. TicketClaimRequestTicket E.==. val tid
+ orderBy [desc $ tcr ^. TicketClaimRequestCreated]
+ return (sharer, tcr)
defaultLayout $(widgetFile "ticket/claim-request/list")
selectDiscussionId :: ShrIdent -> PrjIdent -> Int -> AppDB DiscussionId
diff --git a/templates/personal-overview.hamlet b/templates/personal-overview.hamlet
index d9a7e32..df40c48 100644
--- a/templates/personal-overview.hamlet
+++ b/templates/personal-overview.hamlet
@@ -44,4 +44,4 @@ $#
- Ticket claim requests
+ Ticket claim requests
diff --git a/templates/project/claim-request/list.hamlet b/templates/project/claim-request/list.hamlet
new file mode 100644
index 0000000..0cf2a00
--- /dev/null
+++ b/templates/project/claim-request/list.hamlet
@@ -0,0 +1,30 @@
+$# This file is part of Vervis.
+$#
+$# Written in 2016 by fr33domlover