Browse Source

bugfix: noir doesn't respect the routes order

master
Christian Mueller 14 years ago
parent
commit
abc04e122f
  1. 4
      README.md
  2. 7
      src/NoteHub/views/pages.clj

4
README.md

@ -33,11 +33,11 @@ and for the text itself:
notehub.org/.../title?header-font=FONT-NAME&text-font=FONT-NAME2 notehub.org/.../title?header-font=FONT-NAME&text-font=FONT-NAME2
See an example of the font formatting ([here](http://notehub.org/2012/6/16/how-notehub-is-built?header-font=Berkshire+Swash&text-font=Swanky+and+Moo+Moo)). See an example of the font formatting [here](http://notehub.org/2012/6/16/how-notehub-is-built?header-font=Berkshire+Swash&text-font=Swanky+and+Moo+Moo).
After you've specified this in the url, you can copy the corresponding short url of the article and share it. After you've specified this in the url, you can copy the corresponding short url of the article and share it.
## Exporting & Statistics ## Export & Statistics
By appending of `/stat` to any note url, everyone can see a rudimentary statistics (currently, the number of note views only). By appending of `/stat` to any note url, everyone can see a rudimentary statistics (currently, the number of note views only).
By appending of `/export`, the original markdown content will be displayed in plain text format. By appending of `/export`, the original markdown content will be displayed in plain text format.

7
src/NoteHub/views/pages.clj

@ -13,7 +13,7 @@
[hiccup.core] [hiccup.core]
[hiccup.element] [hiccup.element]
[noir.response :only [redirect status content-type]] [noir.response :only [redirect status content-type]]
[noir.core :only [defpage render]] [noir.core :only [defpage pre-route]]
[cheshire.core] [cheshire.core]
[noir.statuses]) [noir.statuses])
(:import (:import
@ -87,7 +87,7 @@
[:div.centered.helvetica-neue (md-to-html (get-message :created-by))])) [:div.centered.helvetica-neue (md-to-html (get-message :created-by))]))
; New Note Page ; New Note Page
(defpage "/new" {} (pre-route "/new" {}
(layout {:js true} (get-message :new-note) (layout {:js true} (get-message :new-note)
[:div.central-element [:div.central-element
(form-to [:post "/post-note"] (form-to [:post "/post-note"]
@ -115,9 +115,6 @@
(let [md-text (get-note [year month day] title)] (let [md-text (get-note [year month day] title)]
(if md-text (content-type "text/plain; charset=utf-8" md-text) (response 404)))) (if md-text (content-type "text/plain; charset=utf-8" md-text) (response 404))))
(defpage "/:year/:month/:day/:title/short-url" params
(layout (get-message :short-url) (url (create-short-url params))))
; Provides the number of views of the specified note ; Provides the number of views of the specified note
(defpage "/:year/:month/:day/:title/stats" {:keys [year month day title]} (defpage "/:year/:month/:day/:title/stats" {:keys [year month day title]}
(let [views (get-note-views [year month day] title)] (let [views (get-note-views [year month day] title)]

Loading…
Cancel
Save