diff --git a/config/routes b/config/routes index 08bb851..f636db2 100644 --- a/config/routes +++ b/config/routes @@ -54,8 +54,8 @@ /u/#Text/p/#Text ProjectR GET /u/#Text/p/#Text/t TicketsR GET POST -/u/#Text/p/#Text/t/new TicketNewR GET --- /u/#Text/p/#Text/t/#Int TicketR GET +/u/#Text/p/#Text/t/!new TicketNewR GET +/u/#Text/p/#Text/t/#Int TicketR GET -- /u/#Text/p/#Text/w WikiR GET -- /u/#Text/p/#Text/w/+Texts WikiPageR GET diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index 372183f..edd0a4e 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -17,13 +17,14 @@ module Vervis.Handler.Ticket ( getTicketsR , postTicketsR , getTicketNewR + , getTicketR ) where import Prelude import Data.Text (Text) -import Database.Persist.Types (Entity (..)) +import Database.Persist import Text.Blaze.Html (Html, toHtml) import Yesod.Core (defaultLayout) import Yesod.Core.Handler (notFound) @@ -39,7 +40,14 @@ import Vervis.Model import Vervis.Settings (widgetFile) getTicketsR :: Text -> Text -> Handler Html -getTicketsR shar proj = notFound +getTicketsR shar proj = do + tickets <- runDB $ do + Entity sid _sharer <- getBy404 $ UniqueSharerIdent shar + Entity pid _project <- getBy404 $ UniqueProject proj sid + selectList [TicketProject ==. pid] [Asc TicketNumber] + defaultLayout $ do + setTitle $ toHtml $ T.intercalate " :: " [shar, proj, "Tickes"] + $(widgetFile "ticket/list") postTicketsR :: Text -> Text -> Handler Html postTicketsR shar proj = notFound @@ -54,3 +62,6 @@ getTicketNewR shar proj = do defaultLayout $ do setTitle $ toHtml $ T.intercalate " :: " [shar, proj, "New ticket"] $(widgetFile "ticket/new") + +getTicketR :: Text -> Text -> Int -> Handler Html +getTicketR shar proj num = notFound diff --git a/templates/ticket/list.hamlet b/templates/ticket/list.hamlet new file mode 100644 index 0000000..d0ba703 --- /dev/null +++ b/templates/ticket/list.hamlet @@ -0,0 +1,34 @@ +$# 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 +$# . + +

#{shar} :: #{proj} :: Tickets + +

+ Create new… + + + + +
Number + Title + Done + $forall Entity _tid ticket <- tickets +
+ + #{ticketNumber ticket} + + + #{ticketTitle ticket} + + #{ticketDone ticket}