New ticket form
This commit is contained in:
parent
5f909bd3b3
commit
db06aeff0e
2 changed files with 46 additions and 0 deletions
45
src/Vervis/Form/Ticket.hs
Normal file
45
src/Vervis/Form/Ticket.hs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{- 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.Form.Ticket
|
||||||
|
( newTicketForm
|
||||||
|
)
|
||||||
|
where
|
||||||
|
|
||||||
|
import Prelude
|
||||||
|
|
||||||
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Control.Monad.Trans.Class (lift)
|
||||||
|
import Data.Time.Clock (getCurrentTime)
|
||||||
|
import Yesod.Form
|
||||||
|
|
||||||
|
import Vervis.Foundation (Form, Handler)
|
||||||
|
import Vervis.Model
|
||||||
|
|
||||||
|
--TODO use custom fields to ensure uniqueness or other constraints?
|
||||||
|
--TODO stuff like number and created - do I generate them here using monadic
|
||||||
|
-- form or do I rely on handler to provide? which approach is better?
|
||||||
|
|
||||||
|
newTicketAForm :: ProjectId -> Int -> AForm Handler Ticket
|
||||||
|
newTicketAForm pid number = Ticket
|
||||||
|
<$> pure pid
|
||||||
|
<*> pure number
|
||||||
|
<*> lift (liftIO getCurrentTime)
|
||||||
|
<*> areq textField "Title*" Nothing
|
||||||
|
<*> (maybe "" unTextarea <$> aopt textareaField "Description (Markdown)" Nothing)
|
||||||
|
<*> pure False
|
||||||
|
|
||||||
|
newTicketForm :: ProjectId -> Int -> Form Ticket
|
||||||
|
newTicketForm pid number = renderDivs $ newTicketAForm pid number
|
|
@ -52,6 +52,7 @@ library
|
||||||
Vervis.Form.Person
|
Vervis.Form.Person
|
||||||
Vervis.Form.Project
|
Vervis.Form.Project
|
||||||
Vervis.Form.Repo
|
Vervis.Form.Repo
|
||||||
|
Vervis.Form.Ticket
|
||||||
Vervis.Foundation
|
Vervis.Foundation
|
||||||
Vervis.Git
|
Vervis.Git
|
||||||
Vervis.Import
|
Vervis.Import
|
||||||
|
|
Loading…
Reference in a new issue