[Fencommits] fenserve: make saving a page redirect to that page
Benja Fallenstein
benja.fallenstein at gmail.com
Thu May 24 21:37:56 EEST 2007
Thu May 24 21:37:46 EEST 2007 Benja Fallenstein <benja.fallenstein at gmail.com>
* make saving a page redirect to that page
diff -rN -u old-fenserve/fendata/Main.hs new-fenserve/fendata/Main.hs
--- old-fenserve/fendata/Main.hs 2007-05-24 21:37:56.000000000 +0300
+++ new-fenserve/fendata/Main.hs 2007-05-24 21:37:56.000000000 +0300
@@ -317,7 +317,8 @@
( if expandable then makePage rendered expandLink body else
makePage "Custom page" "" $
tag "div" [("style", "border: 1px solid black; \
- \margin-bottom: 1em; padding: 1em; padding-bottom: 0")]
+ \margin-bottom: 1em; padding: 1em; \
+ \padding-bottom: 0; font-weight: bold")]
(rendered +++ saveLinks) +++ body
, s) where
body = if (isComplete exp)
@@ -326,7 +327,7 @@
rendered = let ?state=s; ?link=True; ?name=name in renderExp exp id string
env = Map.fromList $ zip [0..length args-1] args
expanded = expand s exp; expandable = isJust expanded
- expandLink = para $ bold $ link ("?exp="++show e++"&name="++n) "[edit page]"
+ expandLink = para $ bold $ link ("/potion?exp="++show e++"&name="++n) "[edit page]"
where Just (e,n) = expanded
saveLinks = formP "addpotion" $ (+++hidden "exp" (show exp)) $
(+++link ("makefun?exp="++show exp) "[Save as...]") $
@@ -392,7 +393,7 @@
f "" = [Just (Str "")]
addPotion :: Request -> MyState -> (String, MyState)
-addPotion msg s = ("/", s { statePotions = newPotions }) where
+addPotion msg s = ("/potion/"++name, s { statePotions = newPotions }) where
Just template = lookM msg "template"
Just exp = fmap read $ lookM msg "exp"
name = fromMaybe (getName template) $ lookM msg "name" where
More information about the Fencommits
mailing list