From 16d33da4de492f940fd66e9c50589aa7916b76f1 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Wed, 25 May 2016 17:48:17 +0000 Subject: [PATCH] Add group member related dummy routes --- config/routes | 4 +++- src/Vervis/Handler/Group.hs | 26 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/config/routes b/config/routes index bdd7fed..8e244a2 100644 --- a/config/routes +++ b/config/routes @@ -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 diff --git a/src/Vervis/Handler/Group.hs b/src/Vervis/Handler/Group.hs index 92bec28..74623fd 100644 --- a/src/Vervis/Handler/Group.hs +++ b/src/Vervis/Handler/Group.hs @@ -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