Add group member related dummy routes

This commit is contained in:
fr33domlover 2016-05-25 17:48:17 +00:00
parent 3687687457
commit 16d33da4de
2 changed files with 28 additions and 2 deletions

View file

@ -42,7 +42,9 @@
/g GroupsR GET POST
/g/!new GroupNewR GET
/g/#ShrIdent GroupR GET
/g/#ShrIdent/m GroupMembersR 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

View file

@ -19,6 +19,11 @@ module Vervis.Handler.Group
, getGroupNewR
, getGroupR
, getGroupMembersR
, postGroupMembersR
, getGroupMemberNewR
, getGroupMemberR
, deleteGroupMemberR
, postGroupMemberR
)
where
@ -31,7 +36,7 @@ import Database.Esqueleto
import Text.Blaze.Html (Html)
import Yesod.Auth (requireAuthId)
import Yesod.Core (defaultLayout, setMessage)
import Yesod.Core.Handler (redirect)
import Yesod.Core.Handler (redirect, lookupPostParam, notFound)
import Yesod.Form.Functions (runFormPost)
import Yesod.Form.Types (FormResult (..))
import Yesod.Persist.Core (runDB, getBy404)
@ -115,3 +120,22 @@ getGroupMembersR shar = do
return sharer
return (s, ms)
defaultLayout $(widgetFile "group/members")
postGroupMembersR :: ShrIdent -> Handler Html
postGroupMembersR shar = error "Not implemented"
getGroupMemberNewR :: ShrIdent -> Handler Html
getGroupMemberNewR shar = error "Not implemented"
getGroupMemberR :: ShrIdent -> ShrIdent -> Handler Html
getGroupMemberR grp memb = error "Not implemented"
deleteGroupMemberR :: ShrIdent -> ShrIdent -> Handler Html
deleteGroupMemberR grp memb = error "Not implemented"
postGroupMemberR :: ShrIdent -> ShrIdent -> Handler Html
postGroupMemberR grp memb = do
mmethod <- lookupPostParam "_method"
case mmethod of
Just "DELETE" -> deleteGroupMemberR grp memb
_ -> notFound