summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-27 21:59:54 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-27 21:59:54 +0100
commit083b58e0a40858e2277f4bd101ffd54097f01da0 (patch)
tree2e72e346ee6bd26b59d1234ef9bf5141f6680721
parent7c0b0313d1ac80e2e10c4b20e7f6a291b1ad7a56 (diff)
Wiki: Format dates more readably.
-rw-r--r--src/mulk/benki/book_marx.clj8
-rw-r--r--src/mulk/benki/util.clj7
-rw-r--r--src/mulk/benki/wiki.clj5
3 files changed, 11 insertions, 9 deletions
diff --git a/src/mulk/benki/book_marx.clj b/src/mulk/benki/book_marx.clj
index 3fc7b32..1883f3f 100644
--- a/src/mulk/benki/book_marx.clj
+++ b/src/mulk/benki/book_marx.clj
@@ -16,8 +16,7 @@
[noir.response :as response]
[noir.session :as session]
hiccup.core)
- (:import [org.jsoup Jsoup]
- [java.text DateFormat]))
+ (:import [org.jsoup Jsoup]))
(def bookmark_tags (cq/table :bookmark_tags))
(def bookmarks (cq/table :bookmarks))
@@ -80,10 +79,7 @@
(escape-html (:title mark))]]
[:p {:class "bookmark-date-and-owner"}
[:span {:class "bookmark-date"}
- (escape-html
- (.format
- (DateFormat/getDateTimeInstance DateFormat/FULL DateFormat/FULL)
- (:date mark)))]
+ (escape-html (format-date (:date mark)))]
[:span {:class "bookmark-owner"} " by " (escape-html (:first_name mark))]]
[:p {:class "bookmark-description"}
(htmlize-description (:description mark))]])]]))))
diff --git a/src/mulk/benki/util.clj b/src/mulk/benki/util.clj
index d61eca4..18c3607 100644
--- a/src/mulk/benki/util.clj
+++ b/src/mulk/benki/util.clj
@@ -5,7 +5,8 @@
noir.core)
(:require [noir.session :as session]
[noir.request :as request]
- [noir.response :as response]))
+ [noir.response :as response])
+ (:import [java.text DateFormat]))
(def fmt clojure.pprint/cl-format)
@@ -57,3 +58,7 @@
(defn redirect [x]
{:status 302, :headers {"Location" x}, :body ""})
+
+(defn format-date [x]
+ (.format (DateFormat/getDateTimeInstance DateFormat/FULL DateFormat/FULL)
+ x))
diff --git a/src/mulk/benki/wiki.clj b/src/mulk/benki/wiki.clj
index 8501d83..f5e7f30 100644
--- a/src/mulk/benki/wiki.clj
+++ b/src/mulk/benki/wiki.clj
@@ -2,7 +2,8 @@
(:refer-clojure :exclude [distinct conj! case compile drop take sort disj!
resultset-seq])
(:use [clojure repl pprint]
- [hiccup core page-helpers]
+ [hiccup core page-helpers]
+ [hiccup.core :only [escape-html]]
[mulk.benki util db]
[clojure.core.match
:only [match]]
@@ -140,7 +141,7 @@
[:td [:a {:href (link :wiki
(:title rev)
(fmt nil "?revision=~a" (:id rev)))}
- (:date rev)]]
+ (escape-html (format-date (:date rev)))]]
[:td (:title rev)]
[:td (:first_name rev)]])]])))))