diff options
-rw-r--r-- | .hgignore | 1 | ||||
-rw-r--r-- | forum/forum.ur | 22 | ||||
-rw-r--r-- | site.urp | 1 |
3 files changed, 21 insertions, 3 deletions
@@ -22,4 +22,5 @@ syntax: glob *~ # Generated by the Ur/Web compiler +setup.sql *.exe diff --git a/forum/forum.ur b/forum/forum.ur index 8cb11da..6579e56 100644 --- a/forum/forum.ur +++ b/forum/forum.ur @@ -22,15 +22,31 @@ end) = struct open Styles +table question : { Id : int, + Body : string + } PRIMARY KEY Id +sequence questionIdS + fun main () : transaction page = + newestQuestions <- queryX (SELECT * FROM question) (fn row => + <xml> + <p>{[row.Question.Body]}</p> + </xml>); return ( Template.generic (Some "Forum") <xml> <div class={content}> - <p> - Coming soon! - </p> + <p>All questions:</p> + {newestQuestions} + <p>Ask a new question:</p> + <form><textbox {#Body} /><submit action={ask} value="Ask" /></form> </div> </xml> ) +and ask submission = + id <- nextval questionIdS; + dml (INSERT INTO question (Id, Body) + VALUES ({[id]}, {[submission.Body]})); + main () + end @@ -16,6 +16,7 @@ rewrite url Main/main index rewrite url Main/* library meta library forum +sql setup.sql config styles |