|
|
|
@ -8,6 +8,7 @@ |
|
|
|
[clojure.string :rename {replace sreplace} :only [split replace lower-case]] |
|
|
|
[clojure.string :rename {replace sreplace} :only [split replace lower-case]] |
|
|
|
[clojure.core.incubator :only [-?>]] |
|
|
|
[clojure.core.incubator :only [-?>]] |
|
|
|
[hiccup.form] |
|
|
|
[hiccup.form] |
|
|
|
|
|
|
|
[ring.util.codec :only [url-encode]] |
|
|
|
[hiccup.core] |
|
|
|
[hiccup.core] |
|
|
|
[hiccup.util :only [escape-html]] |
|
|
|
[hiccup.util :only [escape-html]] |
|
|
|
[noir.session :only [flash-put! flash-get]] |
|
|
|
[noir.session :only [flash-put! flash-get]] |
|
|
|
@ -52,7 +53,7 @@ |
|
|
|
; Routes |
|
|
|
; Routes |
|
|
|
; ====== |
|
|
|
; ====== |
|
|
|
|
|
|
|
|
|
|
|
; This function answers to an AJAX request: it gets a sesion key and a markdown text. |
|
|
|
; This function answers to an AJAX request: it gets a session key and a markdown text. |
|
|
|
; It returns the html code of the provided markdown and a new session key. |
|
|
|
; It returns the html code of the provided markdown and a new session key. |
|
|
|
(defremote get-preview-md [session-key md] |
|
|
|
(defremote get-preview-md [session-key md] |
|
|
|
(when (flash-get session-key) |
|
|
|
(when (flash-get session-key) |
|
|
|
@ -151,6 +152,5 @@ |
|
|
|
(map #(str proposed-title "-" (+ 2 %)) (range)))))] |
|
|
|
(map #(str proposed-title "-" (+ 2 %)) (range)))))] |
|
|
|
(do |
|
|
|
(do |
|
|
|
(set-note date title draft) |
|
|
|
(set-note date title draft) |
|
|
|
; TODO: the redirect is broken if title contains UTF chars |
|
|
|
(redirect (url year month day (url-encode title))))) |
|
|
|
(redirect (url year month day title)))) |
|
|
|
|
|
|
|
(response 400)))) |
|
|
|
(response 400)))) |
|
|
|
|