summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2013-04-27 18:08:53 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2013-04-27 18:08:53 -0400
commitc79391db1737fa663904191e8cb41ef832f216f4 (patch)
treedd0d91788a97e55f3ce740219add0cc4dbc01bdf
parente2e9fc3d1885f882df487aec0e01ee543fae3bf6 (diff)
Forum: Add "All questions" page
-rw-r--r--forum/forum.ur17
1 files changed, 17 insertions, 0 deletions
diff --git a/forum/forum.ur b/forum/forum.ur
index 6e62b83..db33f8d 100644
--- a/forum/forum.ur
+++ b/forum/forum.ur
@@ -48,6 +48,21 @@ fun prettyPrintQuestion row : xbody =
</li>
</xml>
+val allQuestions : transaction page =
+ questionsList <- queryX (SELECT * FROM question
+ ORDER BY Question.Id DESC)
+ prettyPrintQuestion;
+ return (
+ Template.generic (Some "Forum – All questions") <xml>
+ <div class={content}>
+ <h2>All questions</h2>
+ <ul class={questionList}>
+ {questionsList}
+ </ul>
+ </div>
+ </xml>
+ )
+
fun main () : transaction page =
newestQuestions <- queryX (SELECT * FROM question
ORDER BY Question.Id DESC
@@ -61,6 +76,8 @@ fun main () : transaction page =
<ul class={questionList}>
{newestQuestions}
</ul>
+ <a link={allQuestions}>View all questions</a>
+
<h2>Ask a new question</h2>
<form>
<textbox {#Title} placeholder="Title" class={questionEntryTitle} /><br />