diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2009-03-01 18:05:56 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2009-03-01 18:05:56 +0100 |
commit | 8b81e09d72f6c2c1a54e84a42dfae85422209088 (patch) | |
tree | 7a7c79505e42ea6cc505bc3b4a7297a7a0463e0e /cljssss-g.clj | |
parent | f11c7a49e3b87ea00c84e408bf7c69ab7fbd30c1 (diff) |
Don't raise an exception when there is no content to display for a given entry.
Diffstat (limited to 'cljssss-g.clj')
-rw-r--r-- | cljssss-g.clj | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/cljssss-g.clj b/cljssss-g.clj index d919abc..05b7d18 100644 --- a/cljssss-g.clj +++ b/cljssss-g.clj @@ -257,17 +257,20 @@ to merely being replaced with a div element)?" (defn show-subscriptions [user feed active-entry-id] (with-db - (.toString (doto (.getInstanceOf templates "index") - (.setAttributes {"feeds" (select-feeds user feed) - "entries" (when feed (select-entries user - feed - active-entry-id)) - "active_feed_id" feed - "active_feed_title" (and feed - (select-feed-name user feed)) - "title" "Subscriptions" - "xhtml_content" (and active-entry-id - (entry-xhtml-content active-entry-id))}))))) + (.toString + (let [xhtml-content (and active-entry-id + (entry-xhtml-content active-entry-id))] + (doto (.getInstanceOf templates "index") + (.setAttributes {"feeds" (select-feeds user feed) + "entries" (when feed (select-entries user + feed + active-entry-id)) + "active_feed_id" feed + "active_feed_title" (and feed + (select-feed-name user feed)) + "title" "Subscriptions" + "xhtml_content_p" (not (nil? xhtml-content)) + "xhtml_content" xhtml-content})))))) (defmacro with-session "Rebind Compojure's magic lexical variables as vars." |