[Fencommits] fenserve: twiddle appearance of item editor, add 'cancel' link

Benja Fallenstein benja.fallenstein at gmail.com
Wed May 23 17:47:35 EEST 2007


Wed May 23 17:47:29 EEST 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * twiddle appearance of item editor, add 'cancel' link
diff -rN -u old-fenserve/fendata/Main.hs new-fenserve/fendata/Main.hs
--- old-fenserve/fendata/Main.hs	2007-05-23 17:47:35.000000000 +0300
+++ new-fenserve/fendata/Main.hs	2007-05-23 17:47:35.000000000 +0300
@@ -15,7 +15,8 @@
 import qualified System.IO.Unsafe
 import qualified Control.Exception
 
-header = "<head><style>a { text-decoration: none; color: inherit; }</style></head>"
+header = "<head><style>a { text-decoration: none; color: inherit; }\
+         \button {cursor: pointer; background: none; border: none; font: inherit; margin: 0; padding: 0}</style></head>"
 
 type Id = Int
 
@@ -425,18 +426,21 @@
     
 showItem :: String -> Request -> MyState -> (String, MyState)
 showItem item req s = let Item fields cats = stateItems s Map.! read item in (
-    (("<form method=post>"++returnTo)++) . (++"<p><input type=submit></form>") .
+    (("<form method=post>"++returnTo++buttons++"<hr>")++) .
+    (++"<hr>"++buttons) .
     concatFor (Set.toList cats) $ \cat -> let cfs = stateSchema s Map.! cat in
-        (("<p>"++cat++":<br>")++) 
+        (("<h3>"++capitalize cat++"</h3><p>")++) 
         . (++ "<p><a href='../addField?item="++item++"&category="++cat
            ++ "&returnTo=item/"++item++quote (escape ("?returnTo="++escape uri))
-           ++ "'>[Add field to category "++capitalize cat++"]</a><br>") 
+           ++ "'>[Add a field to the "++capitalize cat++" category]</a><br>") 
         . concatFor cfs $ \field ->
-            field ++ ": <input name='" ++ quote field ++ "' "
+            capitalize field ++ ": <input name='" ++ quote field ++ "' "
          ++ "value='" ++ quote (fields Map.! field) ++ "'><br>",
     s) where uri = fromMaybe "" (lookM req "returnTo")
              returnTo = flip (maybe "") (lookM req "returnTo") $ \uri ->
                  "<input type=hidden name=returnTo value='"++quote(escape uri)++"'>"
+             buttons = "<p><button>[Save]</button> "++mdot++" "++
+                 "<a href='../"++quote uri++"'>[Cancel]</a></form>"
     
     
 updateItem :: String -> Request -> MyState -> (String, MyState)




More information about the Fencommits mailing list