about summary refs log tree commit diff
path: root/src/Blog.hs
diff options
context:
space:
mode:
authorVincent Ambo <v.ambo@me.com>2012-03-15T17·32+0100
committerVincent Ambo <v.ambo@me.com>2012-03-15T17·32+0100
commitdf9a17b695c82d46eeaddb1cb1feb9fed4c81d3a (patch)
tree9ce7d8852d2acd59230dcbcd69a67afbd76df6fc /src/Blog.hs
parent47e1be1f7852c141f604c36199dd767d3a5c3d86 (diff)
* updating entries and entrylist
* entryEscape ("\n" -> "<br>")
Diffstat (limited to 'src/Blog.hs')
-rw-r--r--src/Blog.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Blog.hs b/src/Blog.hs
index 8e53046edddf..f7e5f5f3b727 100644
--- a/src/Blog.hs
+++ b/src/Blog.hs
@@ -193,6 +193,39 @@ adminIndex sUser = adminTemplate "Index" $
                   H.td $ H.textarea ! A.name "mtext" ! A.cols "100" ! A.rows "15" $ mempty
       H.input ! A.type_ "hidden" ! A.name "author" ! A.value (toValue sUser)
       H.input ! A.style "margin-left: 20px" ! A.type_ "submit" ! A.value "Absenden"
+      adminFooter
+
+adminFooter :: Html
+adminFooter =  H.p $ do 
+    preEscapedText "<a href=/>Startseite</a> -- Entrylist: <a href=/admin/entrylist/de>DE</a>"
+    preEscapedText " & <a href=/admin/entrylist/en>EN</a> -- <a href=#>Backup</a> (NYI)"
+
+adminEntryList :: [Entry] -> Html
+adminEntryList entries = adminTemplate "Entrylist" $
+  H.div ! A.style "float: center;" $ do
+    H.table $ do
+        sequence_ $ map showEntryItem entries
+    adminFooter
+  where
+    showEntryItem :: Entry -> Html
+    showEntryItem (Entry{..}) = H.tr $ do
+        H.td $ H.a ! A.href (toValue $ "/admin/edit/" ++ show entryId) $ toHtml title
+        H.td $ toHtml $ formatTime defaultTimeLocale "[On %D at %H:%M]" edate
+
+
+editPage :: Entry -> Html
+editPage (Entry{..}) = adminTemplate "Index" $
+  H.div ! A.style "float: center;" $
+    H.form ! A.action "/admin/updateentry" ! A.method "POST" $ do
+      H.table $ do
+        H.tr $ do H.td $ "Titel:"
+                  H.td $ H.input ! A.type_ "text" ! A.name "title" ! A.value (toValue title)
+        H.tr $ do H.td ! A.style "vertical-align: top;" $ "Text:"
+                  H.td $ H.textarea ! A.name "btext" ! A.cols "100" ! A.rows "15" $ toHtml btext
+        H.tr $ do H.td ! A.style "vertical-align: top;" $ "Mehr Text:"
+                  H.td $ H.textarea ! A.name "mtext" ! A.cols "100" ! A.rows "15" $ toHtml mtext
+      H.input ! A.type_ "hidden" ! A.name "eid" ! A.value (toValue $ unEntryId entryId)
+      H.input ! A.style "margin-left: 20px" ! A.type_ "submit" ! A.value "Absenden"
       H.p $ do preEscapedText "<a href=/>Startseite</a> -- Entrylist: <a href=/admin/entrylist/de>DE</a>"
                preEscapedText " & <a href=/admin/entrylist/en>EN</a> -- <a href=#>Backup</a> (NYI)"