From b0bf0ee8516716730b68c63cfe9a816d5c1a8bdc Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Wed, 26 Mar 2014 22:24:29 +0100 Subject: [PATCH] views moved to a separate directory --- src/notehub/handler.clj | 129 +++++----------------------------------- 1 file changed, 14 insertions(+), 115 deletions(-) diff --git a/src/notehub/handler.clj b/src/notehub/handler.clj index 09a3a31..192e33e 100644 --- a/src/notehub/handler.clj +++ b/src/notehub/handler.clj @@ -1,70 +1,16 @@ (ns notehub.handler (:use compojure.core + [notehub.views] [notehub.settings] [clojure.string :rename {replace sreplace} :only [replace]] - [clojure.core.incubator :only [-?>]] - [hiccup.form] - [hiccup.core] - [hiccup.element] - [hiccup.util :only [escape-html]] - [hiccup.page :only [include-js html5]]) - (:require [compojure.handler :as handler] - [compojure.route :as route] - [hiccup.util :as util] - [notehub.api :as api] - [notehub.storage :as storage] - [cheshire.core :refer :all])) - -; Creates the main html layout -(defn layout - [title & content] - (html5 - [:head - [:title (print-str (get-message :name) "—" title)] - [:meta {:charset "UTF-8"}] - [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}] - [:link {:rel "stylesheet/less" :type "text/css" :href "/styles/main.less"}] - (html - (include-js "/js/less.js") - (include-js "/js/themes.js") - (include-js "/js/md5.js") - (include-js "/js/marked.js") - (include-js "/js/main.js")) - ; google analytics code should appear in prod mode only - (if-not (get-setting :dev-mode) (include-js "/js/google-analytics.js"))] - [:body {:onload "onLoad()"} content])) - -(defn md-node - "Returns an HTML element with a textarea inside - containing the markdown text (to keep all chars unescaped)" - ([cls input] (md-node cls {} input)) - ([cls opts input] - [(keyword (str (name cls) ".markdown")) opts - [:textarea input]])) - -(defn sanitize - "Breakes all usages of