publisher removed from the statistics node of the API response

This commit is contained in:
Christian Müller
2014-10-05 15:31:53 +02:00
parent a0e84c0df9
commit 0a099649fb
3 changed files with 107 additions and 106 deletions
+2 -1
View File
@@ -66,7 +66,8 @@
(GET "/:year/:month/:day/:title/stats" [year month day title]
(let [note-id (api/build-key year month day title)]
(statistics-page (api/derive-title (storage/get-note note-id))
(storage/get-note-statistics note-id))))
(storage/get-note-statistics note-id)
(storage/get-publisher note-id))))
(GET "/:year/:month/:day/:title/edit" [year month day title]
(let [note-id (api/build-key year month day title)]
+1 -2
View File
@@ -72,8 +72,7 @@
(defn get-note-statistics [noteID]
{:views (get-note-views noteID)
:published (redis :hget :published noteID)
:edited (redis :hget :edited noteID)
:publisher (get-publisher noteID)})
:edited (redis :hget :edited noteID)})
(defn note-exists? [noteID]
(= 1 (redis :hexists :note noteID)))
+4 -3
View File
@@ -73,14 +73,15 @@
[:div#footer (md-to-html (get-message :footer))]))
(defn statistics-page [note-title stats]
(let [page-title (get-message :statistics)]
(defn statistics-page [note-title stats publisher]
(let [page-title (get-message :statistics)
info (assoc stats :publisher publisher)]
(layout :no-js page-title
[:h2.central-element note-title]
[:h3.central-element.helvetica page-title]
[:table#stats.helvetica.central-element
(map
#(when-let [v (% stats)]
#(when-let [v (% info)]
[:tr
[:td (str (get-message %) ":")]
[:td (if (or (= % :published) (= % :edited))