2016-05-29 22:17:55 +09:00
|
|
|
{- 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.Role
|
2016-06-01 16:35:22 +09:00
|
|
|
( NewRepoRole (..)
|
|
|
|
, newRepoRoleForm
|
|
|
|
, newRepoRoleOpForm
|
2016-06-01 17:52:14 +09:00
|
|
|
, NewProjectRole (..)
|
|
|
|
, newProjectRoleForm
|
|
|
|
, newProjectRoleOpForm
|
2016-05-29 22:17:55 +09:00
|
|
|
)
|
|
|
|
where
|
|
|
|
|
|
|
|
import Prelude
|
|
|
|
|
|
|
|
import Data.Text (Text)
|
|
|
|
import Yesod.Form.Fields (textField)
|
|
|
|
import Yesod.Form.Functions (areq, renderDivs)
|
|
|
|
import Yesod.Form.Types (AForm)
|
|
|
|
|
|
|
|
import Vervis.Field.Role
|
|
|
|
import Vervis.Foundation (Handler, Form, AppDB)
|
|
|
|
import Vervis.Model
|
|
|
|
import Vervis.Model.Ident (RlIdent)
|
|
|
|
import Vervis.Model.Role
|
|
|
|
|
2016-06-01 16:35:22 +09:00
|
|
|
data NewRepoRole = NewRepoRole
|
|
|
|
{ nrrIdent :: RlIdent
|
|
|
|
, nrrDesc :: Text
|
2016-05-29 22:17:55 +09:00
|
|
|
}
|
|
|
|
|
2016-06-01 16:35:22 +09:00
|
|
|
newRepoRoleAForm :: PersonId -> AForm Handler NewRepoRole
|
|
|
|
newRepoRoleAForm pid = NewRepoRole
|
|
|
|
<$> areq (newRepoRoleIdentField pid) "Name*" Nothing
|
|
|
|
<*> areq textField "Description" Nothing
|
2016-05-29 22:17:55 +09:00
|
|
|
|
2016-06-01 16:35:22 +09:00
|
|
|
newRepoRoleForm :: PersonId -> Form NewRepoRole
|
|
|
|
newRepoRoleForm pid = renderDivs $ newRepoRoleAForm pid
|
2016-05-29 22:17:55 +09:00
|
|
|
|
2016-06-01 16:35:22 +09:00
|
|
|
newRepoRoleOpAForm :: AppDB RepoRoleId -> AForm Handler RepoOperation
|
|
|
|
newRepoRoleOpAForm getrid = areq (newRepoOpField getrid) "Operation*" Nothing
|
2016-05-29 22:17:55 +09:00
|
|
|
|
2016-06-01 16:35:22 +09:00
|
|
|
newRepoRoleOpForm :: AppDB RepoRoleId -> Form RepoOperation
|
|
|
|
newRepoRoleOpForm getrid = renderDivs $ newRepoRoleOpAForm getrid
|
2016-06-01 17:52:14 +09:00
|
|
|
|
|
|
|
data NewProjectRole = NewProjectRole
|
|
|
|
{ nprIdent :: RlIdent
|
|
|
|
, nprDesc :: Text
|
|
|
|
}
|
|
|
|
|
|
|
|
newProjectRoleAForm :: PersonId -> AForm Handler NewProjectRole
|
|
|
|
newProjectRoleAForm pid = NewProjectRole
|
|
|
|
<$> areq (newProjectRoleIdentField pid) "Name*" Nothing
|
|
|
|
<*> areq textField "Description" Nothing
|
|
|
|
|
|
|
|
newProjectRoleForm :: PersonId -> Form NewProjectRole
|
|
|
|
newProjectRoleForm pid = renderDivs $ newProjectRoleAForm pid
|
|
|
|
|
|
|
|
newProjectRoleOpAForm :: AppDB ProjectRoleId -> AForm Handler ProjectOperation
|
|
|
|
newProjectRoleOpAForm getrid =
|
|
|
|
areq (newProjectOpField getrid) "Operation*" Nothing
|
|
|
|
|
|
|
|
newProjectRoleOpForm :: AppDB ProjectRoleId -> Form ProjectOperation
|
|
|
|
newProjectRoleOpForm getrid = renderDivs $ newProjectRoleOpAForm getrid
|