[Fencommits] fenserve: put 'new' button at the top as well as the bottom of 'table'

Benja Fallenstein benja.fallenstein at gmail.com
Wed May 23 15:07:57 EEST 2007


Wed May 23 15:07:40 EEST 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * put 'new' button at the top as well as the bottom of 'table'
diff -rN -u old-fenserve/fendata/Main.hs new-fenserve/fendata/Main.hs
--- old-fenserve/fendata/Main.hs	2007-05-23 15:07:57.000000000 +0300
+++ new-fenserve/fendata/Main.hs	2007-05-23 15:07:57.000000000 +0300
@@ -388,17 +388,17 @@
     
 showTable :: () -> MyState -> (String, MyState)
 showTable () s = (
-    (concatFor (Map.toList $ stateItems s) $ \(id, Item fields _) ->
+    (new++) . ("<hr>"++) . (++new) .
+    concatFor (Map.toList $ stateItems s) $ \(id, Item fields _) ->
         (("<p><a href='item/"++show id++"'>[edit]</a><br>")++) 
         . (++"<form action='delItem' method=post>\
              \<input type=hidden name=item value='"++show id++"'>\
              \<input type=submit value='Delete item'></form><hr>")
         . concatFor (Map.toList fields) $ \(f:fs,v) ->
-            "<b>" ++ (toUpper f : fs) ++ ":</b> " ++ v ++ "<br>")
- ++ (concatFor (Map.keys $ stateSchema s) $ \cat ->
-        "<form action='newItem' method=post>\
-        \<input type=submit name=action value='New "++cat++"'></form>"),
-    s)
+            "<b>" ++ (toUpper f : fs) ++ ":</b> " ++ v ++ "<br>",
+    s) where new = concatFor (Map.keys $ stateSchema s) $ \cat ->
+                 "<form action='newItem' method=post>\
+                 \<input type=submit name=action value='New "++cat++"'></form>"
     
 showItem :: String -> () -> MyState -> (String, MyState)
 showItem item () s = let Item fields cats = stateItems s Map.! read item in (




More information about the Fencommits mailing list