Browse Source

statistics page made pretier

master
Christian Mueller 12 years ago
parent
commit
928f951955
  1. 9
      src/notehub/handler.clj

9
src/notehub/handler.clj

@ -122,13 +122,16 @@
(return-content-type "text/plain; charset=utf-8" md-text))) (return-content-type "text/plain; charset=utf-8" md-text)))
(GET "/:year/:month/:day/:title/stats" [year month day title] (GET "/:year/:month/:day/:title/stats" [year month day title]
(when-let [stats (:statistics (api/get-note {:noteID (api/build-key year month day title)}))] (when-let [resp (api/get-note {:noteID (api/build-key year month day title)})]
(layout (get-message :statistics) (let [stats (:statistics resp)
statistics (get-message :statistics)]
(layout statistics
[:h2.central-element statistics ": " (api/derive-title (:note resp))]
[:table#stats.helvetica.central-element [:table#stats.helvetica.central-element
(map (map
#(when (% stats) #(when (% stats)
[:tr [:td (str (get-message %) ":")] [:td (% stats)]]) [:tr [:td (str (get-message %) ":")] [:td (% stats)]])
[:published :edited :publisher :views])]))) [:published :edited :publisher :views])]))))
(GET "/:year/:month/:day/:title/edit" [year month day title] (GET "/:year/:month/:day/:title/edit" [year month day title]
(let [noteID (api/build-key year month day title)] (let [noteID (api/build-key year month day title)]

Loading…
Cancel
Save