[clarify no IO in view thomashartman1@gmail.com**20080929094651] hunk ./src/ControllerMisc.hs 8 +import Text.StringTemplate hunk ./src/ControllerMisc.hs 40 +-- IO action: templates are loaded from templates dir for every handle. +-- Alternative is to read templates once at application start time, +-- but then if you make changes in the templates dir they won't be reflected unless you stop/start the server +-- Option b might be appropriate for situations where there is high traffic and changes to templates rarely happen +-- and it's ok to stop/start server if necessary. +getTemplates :: IO (STGroup String) +getTemplates = directoryGroupSafer "templates" + hunk ./src/View.hs 11 -import Network.HTTP (urlEncode) +-- import Network.HTTP (urlEncode) hunk ./src/View.hs 19 --- Try to keep functions as type --- Pure -> .. -> Pure -> IO String --- or Pure -> Pure -> String - --- 1 second reload time/IO for templates. --- tmplkvs: key/value pairs used for filling in a template ---tutlayout, tutlayoutSafe :: [(String, String)] -> String -> String -> IO String ---tutlayout tmplkvs basedomain tmpl = tutlayout' (unsafeVolatileDirectoryGroup "templates" 1) tmplkvs basedomain tmpl - --- how much stress does this put on the server? --- how could I even find this out? --- I could try setting a higher reload time, run top, and see if the happs process uses less memory --- withTemplateDir :: String -> (STGroup String -> String) -> IO String --- Could also see if it's practical to try working with the safe version --- Probably it's fine for "production", where not making template changes all the time --- and it's fine to stop/restart server when I do. ---tutlayoutSafe tmplkvs basedomain tmpl = tutlayout' (directoryGroup "templates") tmplkvs basedomain tmpl - -getTemplates :: IO (STGroup String) -getTemplates = directoryGroupSafer "templates" +-- Try to keep functions pure: > :browse View in ghci should reveal there's no IO for any of these function sigs. hunk ./templates/footer.st 4 + | browse templates + | browse hs files hunk ./todo 3 - v4 - possiblyExistingProfileStuffIsStupid - announcement: "In Version 4 of the ongoing self-demoing HAppS Tutorial, we implement a HAppS job board using HAppS." - hunk ./todo 5 + debugging. suggest looking into ghci debugger, and demo trace functions. + good to do this before forms. + maybe should just keep withDebug on. + + jobs should definitely be a set, not a list + + browse templtaes, browse hs files. + + Edit job for non ascii characters breaks because of url encoding. + hunk ./todo 39 - redirect rippledeals to the right page. I hate that url. + redirect rippledeals to the right page. I hate that url. damn google. hunk ./todo 60 -********** - hunk ./todo 65 - Add functionality that when all ConsultantProfile fields are blank fields, the record changes to nothing. - And add back in the text in http://localhost:5001/tutorial/editconsultantprofile - that explains this is a way of removing yourself from searches for consultants.