[Fencommits] fenserve: use style to remove decorations from edit links

Benja Fallenstein benja.fallenstein at gmail.com
Wed Jun 20 02:32:01 EEST 2007


Wed Jun 20 02:31:07 EEST 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * use style to remove decorations from edit links
diff -rN -u old-fenserve-1/fendata/Main.hs new-fenserve-1/fendata/Main.hs
--- old-fenserve-1/fendata/Main.hs	2007-06-20 02:32:00.000000000 +0300
+++ new-fenserve-1/fendata/Main.hs	2007-06-20 02:32:00.000000000 +0300
@@ -32,8 +32,10 @@
     (Control.Exception.evaluate (length (show x) `seq` Right x))
     (\e -> return $ Left $ "Internal server error: " ++ show e)
     
+header = HTML "<head><style>a.editLink { text-decoration: none; color: inherit}</style></head>"
+    
 page path _ content = h (path :: [String]) GET $ ok $ \() () -> respond $
-    either id id $ evaluate (html content)
+    either id id $ evaluate (html $ header & content)
         
 runPost path m = h (path :: [String]) POST $ seeOther $ \() () ->
     case evaluate (runState m ?state) of
@@ -99,7 +101,7 @@
                                , Exp "getField" ( f, Exp "var" $ I (0::Int) )))))
                                
   , h (Prefix ["potion"]) GET $ ok $ \[s] () -> respond $ 
-        either id id $ evaluate $ html $ let exp = readExp s in
+        either id id $ evaluate $ html $ header & let exp = readExp s in
           ( renderExp getPotion exp
           , hr
           , renderValues $ runExp [] exp )
diff -rN -u old-fenserve-1/fendata/Rendering.hs new-fenserve-1/fendata/Rendering.hs
--- old-fenserve-1/fendata/Rendering.hs	2007-06-20 02:32:00.000000000 +0300
+++ new-fenserve-1/fendata/Rendering.hs	2007-06-20 02:32:00.000000000 +0300
@@ -85,8 +85,9 @@
 renderExp :: (?db :: DB, ?time :: Int64) => (String -> Potion) -> Exp -> HTML
 renderExp getPotion exp = f $ execWriter $ flip runStateT 0 $ runReaderT (renderExp' getPotion exp) $ Env [] [] exp where
     f ((p,h):(q,i):xs) | p == q = f ((p,h&i):xs)
-    f ((p,h):xs) = link ("/path/" ++ (concat $ intersperse "." $ map show p)) h 
-                 & HTML "&nbsp;" & f xs
+    f ((p,h):xs) = (& f xs) $ flip (tag "a") h 
+      [ P "class" "editLink"
+      , P "href" $ "/path/" ++ concat (intersperse "." (map show p)) ]
     f [] = HTML ""
     
 renderExp' :: (?db :: DB, ?time :: Int64) => (String -> Potion) -> Exp -> RenderExp ()




More information about the Fencommits mailing list