about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <viam@humac.com>2012-03-05T23·50+0100
committerVincent Ambo <viam@humac.com>2012-03-05T23·50+0100
commit0418692f07e057e2aa847fb2f5f24e6021a6073e (patch)
tree11be04de3bfd67f38326548e7b7a4e480191846c
parentf113778e17be9124615ccc1ba684cb4a832f9408 (diff)
* finished comment field
-rw-r--r--res/blogstyle.css15
-rw-r--r--src/Blog.hs24
-rw-r--r--src/Locales.hs3
-rw-r--r--src/Main.hs6
4 files changed, 35 insertions, 13 deletions
diff --git a/res/blogstyle.css b/res/blogstyle.css
index 6315ffd06ff1..d8e878b0126a 100644
--- a/res/blogstyle.css
+++ b/res/blogstyle.css
@@ -63,6 +63,11 @@ body {
 	text-decoration:none;color:black;
 }
 
+.cHead {
+    font-size:large;
+    font-weight:bold;
+}
+
 .innerBoxTop {
 	height: 28px;
 	color: #000000;
@@ -112,3 +117,13 @@ body {
 .innerBoxComments {
 	padding-left: 20px
 }
+
+
+label span {
+    width: 6%;
+    float: left;
+}
+
+label input {
+    display: block;
+}
diff --git a/src/Blog.hs b/src/Blog.hs
index 62de9be0f442..9c35c1ec742f 100644
--- a/src/Blog.hs
+++ b/src/Blog.hs
@@ -100,22 +100,20 @@ renderEntry entry = H.div ! A.class_ "innerBox" $ do
             preEscapedString $ text entry
             preEscapedString $ mtext entry
         H.div ! A.class_ "innerBoxComments" $ do
-            H.div ! A.name "cHead" ! A.style "font-size:large;font-weight:bold;" $ toHtml $ cHead (lang entry)
+            H.div ! A.class_ "cHead" $ toHtml $ cHead (lang entry) -- ! A.style "font-size:large;font-weight:bold;"
             H.ul $ renderComments (comments entry) (lang entry)
-            renderCommentBox $ lang entry
+            renderCommentBox (lang entry) (_id entry)
 
-renderCommentBox :: BlogLang -> Html
-renderCommentBox lang = do
-    H.div ! A.name "cHead" $ toHtml $ cwHead lang
-    H.form $ do
+renderCommentBox :: BlogLang -> String -> Html
+renderCommentBox cLang cId = do
+    H.div ! A.class_ "cHead" $ toHtml $ cwHead cLang
+    H.form ! A.method "POST" ! A.action (toValue $ "/" ++ (show cLang) ++  "/postcomment/" ++ cId) $ do
         H.p $ H.label $ do
-            toHtml ("Name:" :: String)
-            H.input 
-{-
-<form>
- <p><label>Customer name: <input></label></p>
-</form>
--}
+            H.span $ "Name:" --toHtml ("Name:" :: String)
+            H.input ! A.name "cname"
+        H.p $ H.label $ do
+            H.span $ toHtml $ cSingle cLang -- toHtml (cSingle lang)
+            H.textarea ! A.name "ctext" ! A.cols "50" ! A.rows "13" $ mempty
 
 renderComments :: [Comment] -> BlogLang -> Html
 renderComments [] lang = H.li $ toHtml $ noComments lang
diff --git a/src/Locales.hs b/src/Locales.hs
index 01852cbdb0a9..20b4cb8476da 100644
--- a/src/Locales.hs
+++ b/src/Locales.hs
@@ -90,6 +90,9 @@ cHead EN = "Comments:"
 cwHead DE = "Kommentieren:"
 cwHead EN = "Comment:"
 
+cSingle DE = "Kommentar:" --input label
+cSingle EN = "Comment:" 
+
 cTimeFormat DE = "[Am %d.%m.%y um %H:%M Uhr]"
 cTimeFormat EN = "[On %D at %H:%M]"
 
diff --git a/src/Main.hs b/src/Main.hs
index 89f6179237f5..f3d3db32d048 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -46,6 +46,9 @@ blogHandler lang =
     msum [ path $ \(year :: Int) -> path $ \(month :: Int) -> path $ --single entry
                       \(day :: Int) -> path $ \(id_ :: String) -> showEntry year month day id_
          , path $ \(year :: Int ) -> path $ \(month :: Int) -> showMonth year month lang
+         , do
+            decodeBody tmpPolicy
+            dir "postcomment" $ path $ \(id_ :: String) -> addComment id_
          , do nullDir
               showIndex lang
          ]
@@ -84,6 +87,9 @@ showMonth y m lang = do
     startkey = JSArray [toJSON y, toJSON m]
     endkey = JSArray [toJSON y, toJSON m, JSObject (toJSObject [] )]
 
+addComment :: String -> ServerPart Response
+addComment id_ = undefined
+
 -- http://tazj.in/2012/02/10.155234
 
 -- CouchDB functions