summaryrefslogtreecommitdiff
path: root/forum
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2013-04-27 17:49:45 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2013-04-27 17:49:45 -0400
commit5d3a14ec537289416c77cff6b8610991ec463f60 (patch)
treee9c1da8dde86ae65545bd8d0c1944e3d4d078ecc /forum
parent5d72e64529dbbaac8d5fef531c9720e506380791 (diff)
Forum: More nicely format the list of questions
Diffstat (limited to 'forum')
-rw-r--r--forum/forum.css37
-rw-r--r--forum/forum.ur13
-rw-r--r--forum/lib.urp3
3 files changed, 51 insertions, 2 deletions
diff --git a/forum/forum.css b/forum/forum.css
new file mode 100644
index 0000000..1250be2
--- /dev/null
+++ b/forum/forum.css
@@ -0,0 +1,37 @@
+ /* forum.css -- 6.947 forum CSS rules
+ * Copyright (C) 2013 Benjamin Barenblat <bbaren@mit.edu>
+ *
+ * This file is a part of 6.947.
+ *
+ * 6.947 is is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Affero General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * 6.947 is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with 6.947. If not, see <http://www.gnu.org/licenses/>. */
+
+.Forum_questionList {
+ list-style-type: none;
+ padding-left: 0;
+}
+
+.Forum_questionList li {
+ margin-bottom: 1em;
+}
+
+.Forum_questionList h3 {
+ font-size: 1.15em;
+ margin: 0;
+}
+
+.Forum_questionMetadata {
+ padding-left: 2em;
+ font-style: italic;
+ color: hsl(0, 0%, 65%);
+}
diff --git a/forum/forum.ur b/forum/forum.ur
index e742ef9..d017900 100644
--- a/forum/forum.ur
+++ b/forum/forum.ur
@@ -23,6 +23,9 @@ end) = struct
open Styles
open Asker
+style questionList
+style questionMetadata
+
table question : { Id : int,
Title : string,
Body : string,
@@ -36,7 +39,11 @@ val getName : transaction (option string) =
fun prettyPrintQuestion row : xbody =
<xml>
- <p>{[row.Question.Title]}: {[row.Question.Body]} (asked by {[row.Question.Asker]})</p>
+ <li>
+ <h3>{[row.Question.Title]}</h3>
+ {[row.Question.Body]}
+ <span class={questionMetadata}>Asked by {[row.Question.Asker]}</span>
+ </li>
</xml>
fun main () : transaction page =
@@ -46,7 +53,9 @@ fun main () : transaction page =
Template.generic (Some "Forum") <xml>
<div class={content}>
<p>All questions:</p>
- {newestQuestions}
+ <ul class={questionList}>
+ {newestQuestions}
+ </ul>
<p>Ask a new question:</p>
<form>
<textbox {#Title} size=80 /><br />
diff --git a/forum/lib.urp b/forum/lib.urp
index dd3456d..505af96 100644
--- a/forum/lib.urp
+++ b/forum/lib.urp
@@ -1,4 +1,7 @@
+allow url //bbaren.scripts.mit.edu/urweb/6.947-static/forum/forum.css
allow env SSL_CLIENT_S_DN_CN
+rewrite style Main/Forum/questionList Forum/questionList
+rewrite style Main/Forum/questionMetadata Forum/questionMetadata
$/option
../styles