diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/site.clj | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/site.clj b/src/site.clj index fcd2930..60f07d7 100755 --- a/src/site.clj +++ b/src/site.clj @@ -204,13 +204,17 @@ ;; Templates -(defn fetch-template [template-name session] - (let [st (.getInstanceOf template-group template-name)] - (if (and st (session :nick)) +;; TODO: avoid exception +(defn fetch-template [template session] + (let [st (.getInstanceOf template-group template)] + (if (session :nick) (do (.setAttribute st "user_nick" (session :nick)) (.setAttribute st "isadmin" (session :is_admin)))) st)) +(defn serve-template [template session] + (.toString (fetch-template template session))) + ;; Login code (defn session-map-from-db @@ -590,7 +594,7 @@ (defroutes pichat (GET "/" (no-cache (landing session))) (GET "/favicon.ico" (serve-static "static" "favicon.ico")) - (GET "/u/:nick" (profile session (params :nick) "0")) + (GET "/u/:nick" (profile session (params :nick) "0")) (GET "/u/:nick/" (profile session (params :nick) "0")) (GET "/u/:nick/:offset" (profile session (params :nick) @@ -615,6 +619,11 @@ (POST "/msg" (validated-msg session params)) (POST "/submit-registration" (register session params)) (POST "/update-profile" (update-profile session params)) + (GET "/about_us" (serve-template "about_us" session)) + (GET "/goodies" (serve-template "goodies" session)) + (GET "/help" (serve-template "help" session)) + (GET "/privacy" (serve-template "privacy" session)) + (GET "/terms" (serve-template "terms" session)) (ANY "*" (unknown-page params))) (defroutes multipart |
