diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2013-04-30 14:02:35 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2013-04-30 14:02:35 -0400 |
commit | 3f4e4e506afe8f30e5114327863eddb2cc512fc3 (patch) | |
tree | c6c7190f9c1cc46f320e60350fda3886850a96bc /forum | |
parent | b2dc3a9199369af04cf3ee9db0d1ebb5576a594b (diff) |
Forum: Rename "question" to "entry"
Diffstat (limited to 'forum')
-rw-r--r-- | forum/forum.css | 15 | ||||
-rw-r--r-- | forum/forum.ur | 46 |
2 files changed, 32 insertions, 29 deletions
diff --git a/forum/forum.css b/forum/forum.css index 56b0763..4f7b7f2 100644 --- a/forum/forum.css +++ b/forum/forum.css @@ -16,28 +16,31 @@ * 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 { +.Forum_entryList { list-style-type: none; margin-top: 0; padding-left: 0; } -.Forum_questionList li { +.Forum_entryList li { margin-bottom: 1em; } -.Forum_questionMetadata { - padding-left: 2em; +.Forum_entryMetadata { font-style: italic; color: hsl(0, 0%, 65%); } -.Forum_questionEntryTitle, .Forum_questionEntryBody { +li .Forum_entryMetadata { + padding-left: 2em; +} + +.Forum_entryTitle, .Forum_entryBody { font-family: sans-serif; font-size: 0.8em; width: 40em; } -.Forum_questionEntryBody { +.Forum_entryBody { height: 15em; } diff --git a/forum/forum.ur b/forum/forum.ur index e8a4be5..3c376ec 100644 --- a/forum/forum.ur +++ b/forum/forum.ur @@ -23,17 +23,17 @@ end) = struct open Styles open Author -style questionList -style questionMetadata -style questionEntryTitle -style questionEntryBody +style entryList +style entryMetadata +style entryTitle +style entryBody -table question : { Id : int, - Title : string, - Body : string, - Author : author - } PRIMARY KEY Id -sequence questionIdS +table entry : { Id : int, + Title : string, + Body : string, + Author : author + } PRIMARY KEY Id +sequence entryIdS (* Grabs real name out of MIT certificate. *) val getName : transaction (option string) = @@ -42,21 +42,21 @@ val getName : transaction (option string) = fun prettyPrintQuestion row : xbody = <xml> <li> - <h3>{[row.Question.Title]}</h3> - {[row.Question.Body]} - <span class={questionMetadata}>Asked by {[row.Question.Author]}</span> + <h3>{[row.Entry.Title]}</h3> + {[row.Entry.Body]} + <span class={entryMetadata}>Asked by {[row.Entry.Author]}</span> </li> </xml> val allQuestions : transaction page = - questionsList <- queryX (SELECT * FROM question - ORDER BY Question.Id DESC) + questionsList <- queryX (SELECT * FROM entry + ORDER BY Entry.Id DESC) prettyPrintQuestion; return ( Template.generic (Some "Forum – All questions") <xml> <div class={content}> <h2>All questions</h2> - <ul class={questionList}> + <ul class={entryList}> {questionsList} </ul> </div> @@ -64,8 +64,8 @@ val allQuestions : transaction page = ) fun main () : transaction page = - newestQuestions <- queryX (SELECT * FROM question - ORDER BY Question.Id DESC + newestQuestions <- queryX (SELECT * FROM entry + ORDER BY Entry.Id DESC LIMIT 5) prettyPrintQuestion; askerOpt <- getName; @@ -73,15 +73,15 @@ fun main () : transaction page = Template.generic (Some "Forum") <xml> <div class={content}> <h2>Latest questions</h2> - <ul class={questionList}> + <ul class={entryList}> {newestQuestions} </ul> <a link={allQuestions}>View all questions</a> <h2>Ask a new question</h2> <form> - <textbox {#Title} placeholder="Title" class={questionEntryTitle} /><br /> - <textarea {#Body} class={questionEntryBody} /><br /> + <textbox {#Title} placeholder="Title" class={entryTitle} /><br /> + <textarea {#Body} class={entryBody} /><br /> Asking as: <select {#Author}> {case askerOpt of @@ -96,8 +96,8 @@ fun main () : transaction page = ) and ask submission = - id <- nextval questionIdS; - dml (INSERT INTO question (Id, Title, Body, Author) + id <- nextval entryIdS; + dml (INSERT INTO entry (Id, Title, Body, Author) VALUES ({[id]}, {[submission.Title]}, {[submission.Body]}, {[readError submission.Author]})); main () |