diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mulk/benki/util.clj | 12 | ||||
-rw-r--r-- | src/mulk/benki/wiki.clj | 22 |
2 files changed, 22 insertions, 12 deletions
diff --git a/src/mulk/benki/util.clj b/src/mulk/benki/util.clj index ba43581..4dac73b 100644 --- a/src/mulk/benki/util.clj +++ b/src/mulk/benki/util.clj @@ -23,22 +23,14 @@ ;; defpartial is just defn + html. -(defpartial layout [title & content] +(defpartial layout [kind title & content] (html5 {:xml? true} [:head [:title title] ;; jQuery [:script {:type "text/javascript" :src (resolve-uri "/3rdparty/jquery/jquery-1.7.min.js")}] - ;; Aloha Editor - [:link {:rel "stylesheet" - :href (resolve-uri "/3rdparty/alohaeditor/aloha/css/aloha.css")}] - [:script {:type "text/javascript" - :src (resolve-uri "/3rdparty/alohaeditor/aloha/lib/aloha.js") - :data-aloha-plugins "common/format,common/highlighteditables,common/list,common/link,common/undo,common/paste,common/block"}] - ;; JavaScript - [:script {:type "text/javascript" - :src (resolve-uri "/js/wiki.js")}]] + (:head kind)] [:body [:h1 title] content])) diff --git a/src/mulk/benki/wiki.clj b/src/mulk/benki/wiki.clj index 7a64001..b93467a 100644 --- a/src/mulk/benki/wiki.clj +++ b/src/mulk/benki/wiki.clj @@ -43,6 +43,22 @@ (doseq [node (-> doc (.select ".benkilink") (.unwrap))]) (-> doc (.select "body") (.html)))) +(def ^{:private true} wiki-page + {:head + ;; Aloha Editor + (list + [:link {:rel "stylesheet" + :href (resolve-uri "/3rdparty/alohaeditor/aloha/css/aloha.css")}] + [:script {:type "text/javascript" + :src (resolve-uri "/3rdparty/alohaeditor/aloha/lib/aloha.js") + :data-aloha-plugins "common/format,common/highlighteditables,common/list,common/link,common/undo,common/paste,common/block"}] + ;; Custom wiki page stuff + [:script {:type "text/javascript" + :src (resolve-uri "/js/wiki.js")}])}) + +(def ^{:private true} plain-page + {}) + (defpage "/wiki" [] ;; NB. response/redirect calls options/resolve-uri. @@ -57,7 +73,8 @@ (with-dbt (first @(select page_revisions (where (=* :id (Integer/parseInt revision-id)))))) (with-dbt (first @revisions-with-title)))] - (layout (fmt nil "~A — Benki~@[/~A~] " title revision-id) + (layout wiki-page + (fmt nil "~A — Benki~@[/~A~] " title revision-id) (if revision [:div#wiki-page-content (wikilinkify (:content revision))] [:div#wiki-page-content [:p "This page does not exist yet."]]) @@ -78,7 +95,8 @@ ORDER BY date DESC" "Home"))] (with-dbt - (layout (fmt nil "Revision list — ~A — Benki" title) + (layout plain-page + (fmt nil "Revision list — ~A — Benki" title) [:table {:style ""} [:thead [:th "Date"] |