From 3232f8e796a8be37bc60e04d247bd9142cdba2b4 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Thu, 25 Jun 2015 22:07:52 -0400 Subject: Add last modified time --- main.ur | 27 +++++++++++++++++++++------ urwiki.css | 8 +++++++- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/main.ur b/main.ur index 02ad98b..25ca417 100644 --- a/main.ur +++ b/main.ur @@ -45,9 +45,10 @@ fun current_revision title = WHERE commit.Title = {[title]} ORDER BY commit.Created ASC); return (case commits of - Nil => {Title = title, Body = "Not found."} + Nil => {Title = title, Body = "Not found.", Modified = None} | art :: _ => {Title = art.Title, - Body = show art.Content}) + Body = show art.Content, + Modified = Some art.Created}) fun create_commit title text : transaction unit = id <- nextval commit_id_next; @@ -55,16 +56,24 @@ fun create_commit title text : transaction unit = dml (INSERT INTO commit (Id, Created, Title, Content) VALUES ({[id]}, {[creation_time]}, {[title]}, {[text]})) -style article_text +fun report_last_modified date = + + This page was last modified at + {[timef "%l:%M:%S %P %Z on %A, %e %B %Y" date]}. + + +style content +style footer style button_group style top_bar fun wiki requested_article_title = (* Look up the article. *) article <- current_revision requested_article_title; - (* Stuff the article text in a source so we can live-update it as the user - edits. *) + (* Stuff article information into sources so we can live-update them as the + user edits. *) article_body_source <- source article.Body; + article_modified_source <- source article.Modified; (* Initially, we're in View mode, and we can switch to Edit mode on user request. *) page_mode <- source View; @@ -115,7 +124,7 @@ fun wiki requested_article_title = (* Article *) -
+
(* Editing window *)

@@ -123,6 +132,12 @@ fun wiki requested_article_title = (* Article text (or live preview) *) {[text]}} /> +
+ + | Some date => report_last_modified date)} /> +
diff --git a/urwiki.css b/urwiki.css index 574177e..f6a443d 100644 --- a/urwiki.css +++ b/urwiki.css @@ -90,7 +90,7 @@ div { height: 45px; } -.Main_article_text { +.Main_content { margin: 0 auto; padding: 0 15px; max-width: 62.5em; @@ -103,6 +103,12 @@ div { resize: vertical; } +.Main_footer { + margin-top: 3em; + font-size: 0.8em; + color: #888; +} + .Style_invisible { display: none; } -- cgit v1.2.3