aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-03-01 18:05:56 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-03-01 18:05:56 +0100
commit8b81e09d72f6c2c1a54e84a42dfae85422209088 (patch)
tree7a7c79505e42ea6cc505bc3b4a7297a7a0463e0e
parentf11c7a49e3b87ea00c84e408bf7c69ab7fbd30c1 (diff)
Don't raise an exception when there is no content to display for a given entry.
-rw-r--r--cljssss-g.clj25
-rw-r--r--index.st2
2 files changed, 16 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."
diff --git a/index.st b/index.st
index 0008c19..7b505a4 100644
--- a/index.st
+++ b/index.st
@@ -29,7 +29,9 @@ $if(entries)$
$! FIXME: Show content inline if possible. !$
<li class="full-entry">
<a id="entry-$entry.id$" href="$entry.link$"><h3>$entry.title$</h3></a>
+ $if(xhtml_content_p)$
<div class="entry-content">$xhtml_content$</div>
+ $endif$
</li>
$else$
<li class="partial-entry">