From 9a38fec9b6552798bb341ce92f40d1ec92865a73 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Wed, 29 Feb 2012 23:03:56 +0100 Subject: Book Marx: Add feed link to bookmark list page. --- src/mulk/benki/book_marx.clj | 11 ++++++++++- src/mulk/benki/util.clj | 1 + src/mulk/benki/webutil.clj | 8 +++----- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mulk/benki/book_marx.clj b/src/mulk/benki/book_marx.clj index bbaa9f6..ef5da7e 100644 --- a/src/mulk/benki/book_marx.clj +++ b/src/mulk/benki/book_marx.clj @@ -103,7 +103,16 @@ (escape-html (format-date (:date mark)))] [:span {:class "bookmark-owner"} " by " (escape-html (:first_name mark))]] [:div {:class "bookmark-description"} - (htmlize-description (:description mark))]])]])))) + (htmlize-description (:description mark))]])]] + [:div {:id "bookmarx-feed-link"} + (let [feed-link (linkrel :marx :feed)] + [:span {:id "bookmarx-feed-link-text"} + [:a {:href (resolve-uri feed-link)} "Atom"] + (when *user* + (list + " [" + [:a {:href (resolve-uri (authlink feed-link))} "authlink"] + "]"))])])))) (defn marx-feed-for-user [user] (let [marks (bookmarks-visible-by user)] diff --git a/src/mulk/benki/util.clj b/src/mulk/benki/util.clj index 0c91b7d..fa5ca77 100644 --- a/src/mulk/benki/util.clj +++ b/src/mulk/benki/util.clj @@ -52,6 +52,7 @@ [[:login]] (fmt nil "/login") [[:marx]] (fmt nil "/marx") [[:marx :submit]] (fmt nil "/marx/submit") + [[:marx :feed]] (fmt nil "/marx/feed") [[:marx id]] (fmt nil "/marx/~a" id) [[:wiki title & xs]] (fmt nil "/wiki/~a~@[~a~]" title (first xs)) )) diff --git a/src/mulk/benki/webutil.clj b/src/mulk/benki/webutil.clj index 3a2cb1e..cf34724 100644 --- a/src/mulk/benki/webutil.clj +++ b/src/mulk/benki/webutil.clj @@ -13,11 +13,9 @@ -(defn authlink [] +(defn authlink [uri] (with-dbt - (let [req (request/ring-request) - user *user* - uri (:uri req) + (let [user *user* dkey (sql/with-query-results results ["SELECT * FROM page_keys WHERE \"user\" = ? AND page = ?" user uri] @@ -43,5 +41,5 @@ [:div {:class "logged-in-as"} (:first_name user) " " (:last_name user) " " - [:a {:href (authlink)} "[authlink]"]] + "[" [:a {:href (authlink (:uri (request/ring-request)))} "authlink"] "]"] [:div {:class "not-logged-in"} [:a {:href (link :login)} "Log in"]]))) -- cgit v1.2.3