[move actions to ...5001:/tutorial/actions/action type urls thomashartman1@gmail.com**20080904213703] hunk ./src/Controller.hs 33 + ++ [ msgToSp "Quoth this server... 404." ] hunk ./src/Controller.hs 45 -templateservedir d = dir d [ templateserve ] -templateserve = ServerPartT $ \rq -> case rqPaths rq of - [tmpl] -> do - ( ioMsgToWeb . tutlayout [] ) (traceMsg "tmpl: " tmpl) - _ -> noHandle +-- templateservedir d = dir d [ templateserve ] +templateserve = ServerPartT $ + \rq -> case rqPaths rq of + [tmpl] -> ( ioMsgToWeb . tutlayout [] ) (traceMsg "tmpl: " tmpl) + _ -> noHandle hunk ./src/Controller.hs 53 - , exactdir "/tutorial/view-all-users" - [do users <- anyRequest $ query ListUsers - ioMsgToSp $ tutlayout [("userList", (show users))] "view-all-users" ] - , dir "tutorial" [ templateserve ] - , dir "newuser" [methodSP POST $ withData newUserPage] - , dir "view" [ spLoginstatus ] - , dir "login" [ methodSP POST loginaction ] - ] + , dir "tutorial" [ + exactdir "/view-all-users" [ viewAllUsers ] + , exactdir "/view" [ spLoginstatus ] + , templateserve + , dir "actions" [ + dir "login" [ methodSP POST loginaction ] + , dir "newuser" [methodSP POST $ withData newUserPage] + ] + ] + ] + +viewAllUsers = do + users <- anyRequest $ query ListUsers + ioMsgToSp $ tutlayout [("userList", (show users))] "view-all-users" hunk ./src/ControllerUsingTemplates.hs 16 - [ ioMsgToSp ( withTemplateDir "templates" $ renderDef [("favoriteAnimal", "giraffe")] "myhomepage" ) ] + [ ioMsgToSp ( renderTemplateDir "templates" [("favoriteAnimal", "giraffe")] "myhomepage" ) ] hunk ./templates/login.st 3 -