Browse Source

publisher removed from the statistics node of the API response

master
Christian Müller 11 years ago
parent
commit
0a099649fb
  1. 3
      src/notehub/handler.clj
  2. 3
      src/notehub/storage.clj
  3. 7
      src/notehub/views.clj

3
src/notehub/handler.clj

@ -66,7 +66,8 @@
(GET "/:year/:month/:day/:title/stats" [year month day title] (GET "/:year/:month/:day/:title/stats" [year month day title]
(let [note-id (api/build-key year month day title)] (let [note-id (api/build-key year month day title)]
(statistics-page (api/derive-title (storage/get-note note-id)) (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] (GET "/:year/:month/:day/:title/edit" [year month day title]
(let [note-id (api/build-key year month day title)] (let [note-id (api/build-key year month day title)]

3
src/notehub/storage.clj

@ -72,8 +72,7 @@
(defn get-note-statistics [noteID] (defn get-note-statistics [noteID]
{:views (get-note-views noteID) {:views (get-note-views noteID)
:published (redis :hget :published noteID) :published (redis :hget :published noteID)
:edited (redis :hget :edited noteID) :edited (redis :hget :edited noteID)})
:publisher (get-publisher noteID)})
(defn note-exists? [noteID] (defn note-exists? [noteID]
(= 1 (redis :hexists :note noteID))) (= 1 (redis :hexists :note noteID)))

7
src/notehub/views.clj

@ -73,14 +73,15 @@
[:div#footer (md-to-html (get-message :footer))])) [:div#footer (md-to-html (get-message :footer))]))
(defn statistics-page [note-title stats] (defn statistics-page [note-title stats publisher]
(let [page-title (get-message :statistics)] (let [page-title (get-message :statistics)
info (assoc stats :publisher publisher)]
(layout :no-js page-title (layout :no-js page-title
[:h2.central-element note-title] [:h2.central-element note-title]
[:h3.central-element.helvetica page-title] [:h3.central-element.helvetica page-title]
[:table#stats.helvetica.central-element [:table#stats.helvetica.central-element
(map (map
#(when-let [v (% stats)] #(when-let [v (% info)]
[:tr [:tr
[:td (str (get-message %) ":")] [:td (str (get-message %) ":")]
[:td (if (or (= % :published) (= % :edited)) [:td (if (or (= % :published) (= % :edited))

Loading…
Cancel
Save