[Fencommits] fenserve: preserve nick when changing view

Benja Fallenstein benja.fallenstein at gmail.com
Fri Apr 27 18:50:37 EEST 2007


Fri Apr 27 18:50:29 EEST 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * preserve nick when changing view
diff -rN -u old-fenserve/notetaker/Main.hs new-fenserve/notetaker/Main.hs
--- old-fenserve/notetaker/Main.hs	2007-04-27 18:50:37.000000000 +0300
+++ new-fenserve/notetaker/Main.hs	2007-04-27 18:50:37.000000000 +0300
@@ -29,7 +29,8 @@
 page nick = do 
     (lines :: [Line]) <- get
     let notes = foldl (flip execute) [] lines
-    respond $ form nick ++ "Views: <b>main</b> | <a href='/log'>log</a><p>"
+    respond $ form nick 
+           ++ "Views: <b>main</b> | <a href='/log?nick="++nick++"'>log</a><p>"
            ++ renderNotes notes
                     
 renderNotes notes = "<ol>" ++ concatMap renderNote notes ++ "</ol>" where
@@ -64,7 +65,8 @@
     
 renderLog nick = do 
     lines <- get
-    respond $ form nick ++ "Views: <a href='/'>main</a> | <b>log</b><p>"
+    respond $ form nick 
+           ++ "Views: <a href='/?nick="++nick++"'>main</a> | <b>log</b><p>"
            ++ flip concatMap lines 
                   (\(Line t n l) -> printf "&lt;%s&gt; %s<br>" n l :: String)
     
@@ -73,7 +75,7 @@
                , h () GET $ ok $ \() nick -> page nick
                , h () POST $ ok $ \() (nick,line) -> do 
                      time <- getTime
-                     modify (++[Line time nick line]); page nick
+                     modify (++[Line time nick line]); renderLog nick
                , h () POST $ ok $ \() () -> respond "Huh."
                ]
 




More information about the Fencommits mailing list