From caaef2492e17b397bb2ee3d60edfaf830ead51e5 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 27 Feb 2012 20:18:20 +0100 Subject: Book Marx: Implement tag auto-completion. --- src/mulk/benki/book_marx.clj | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mulk/benki/book_marx.clj b/src/mulk/benki/book_marx.clj index b18a02f..1ac7b8d 100644 --- a/src/mulk/benki/book_marx.clj +++ b/src/mulk/benki/book_marx.clj @@ -13,6 +13,7 @@ [clojure.string :as string] [clojureql.core :as cq] [noir.request :as request] + [noir.response :as response] [noir.session :as session] hiccup.core) (:import [org.jsoup.Jsoup])) @@ -25,8 +26,22 @@ (def bookmarx-list-page {:head (list - [:link {:rel "stylesheet", "href" (resolve-uri "/style/hammer-and-sickle.css")}])}) -(def bookmarx-submission-page {}) + [:link {:rel "stylesheet" + :href (resolve-uri "/style/hammer-and-sickle.css") + :type "text/css"}])}) +(def bookmarx-submission-page + {:head (list + [:link {:rel "stylesheet" + :href (resolve-uri "/style/hammer-and-sickle.css") + :type "text/css"}] + [:link {:rel "stylesheet" + :href (resolve-uri "/3rdparty/jquery-ui/css/ui-lightness/jquery-ui-1.8.18.custom.css") + :type "text/css"}]) + :bottom (list + [:script {:type "text/javascript" + :src (resolve-uri "/3rdparty/jquery-ui/js/jquery-ui-1.8.18.custom.min.js")}] + [:script {:type "text/javascript" + :src (resolve-uri "/js/bookmarx-submit.js")}])}) (defn restrict-visibility [table user] (if user @@ -68,6 +83,12 @@ [:p {:class "bookmark-description"} (htmlize-description (:description mark))]])]])))) +(defpage "/marx/tags" {} + (with-auth + (with-dbt + (sql/with-query-results tags ["SELECT tag FROM bookmark_tags"] + (response/json (doall (map :tag tags))))))) + (defmacro ignore-errors [& body] `(try (do ~@body) (catch java.lang.Exception e# -- cgit v1.2.3