Commits

Luke Plant committed 0b8c0ec

Started using Ella.Forms.Widgets

Comments (0)

Files changed (2)

src/Blog/Forms.hs

+module Blog.Forms
+
+where
+
+import Ella.Forms.Widgets
+
+nameWidget = TextInput { defaultVal = ""
+                       , size = Just 20
+                       , maxlength = Just 50
+                       }
+
+emailWidget = TextInput { defaultVal = ""
+                        , size = Just 20
+                        , maxlength = Just 320
+                        }

src/Blog/Templates.hs

 module Blog.Templates
 where
 
+import Blog.Forms (emailWidget, nameWidget)
 import Blog.Links
 import Data.List (intersperse)
 import Text.XHtml
     )
 
 commentForm post =
-    form << (
-             (table <<
-              (
-               (tr <<
-                (td << "Name:"
-                 +++
-                 td << input ! [thetype "text", maxlength 30, size "15"]
-                )
-               )
-               +++
-               (tr <<
-                (td << "Email:"
-                 +++
-                 td << input ! [thetype "text", maxlength 30, size "15"]
-                )
-               )
-              )
-             )
-             +++
-             (textarea ! [rows "10", cols "50"] << "")
-             +++
-             br
-             +++
-             (submit "post" "Post")
-             +++
-             (submit "preview" "Preview")
-            )
+    form ! [method "post", action "#addcomment"]
+    << (
+        (table <<
+         (
+          (tr <<
+           (td << "Name:"
+            +++
+            td << nameWidget
+           ))
+          +++
+          (tr <<
+           (td << "Email:"
+            +++
+            td << emailWidget
+           ))))
+        +++
+        (textarea ! [rows "10", cols "50"] << "")
+        +++
+        br
+        +++
+        (submit "post" "Post")
+        +++
+        (submit "preview" "Preview")
+       )
 
 commentclass comment = "comment" ++
     if (Cm.name comment == Settings.blog_author_name)