From 96850d88c3febef5107aea6f87fa40cd1b19c31b Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 28 Nov 2012 13:16:03 +0100 Subject: Display the number of unread articles in the browser tab (with templates). --- source/pyAggr3g470r.py | 6 ------ source/templates/base.html | 12 +++++++++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 5d9fc2f3..a399a23d 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -142,12 +142,6 @@ class pyAggr3g470r(object): nb_unread_articles = self.mongo.nb_unread_articles() nb_favorites = self.mongo.nb_favorites() nb_mail_notifications = self.mongo.nb_mail_notifications() - - # if there are unread articles, display the number in the tab of the browser - html = htmlheader((nb_unread_articles and \ - ['(' + str(nb_unread_articles) +')'] or \ - [""])[0]) - tmpl = lookup.get_template("index.html") return tmpl.render(feeds=feeds, nb_feeds=len(feeds), mongo=self.mongo, \ nb_favorites=nb_favorites, nb_unread_articles=nb_unread_articles, \ diff --git a/source/templates/base.html b/source/templates/base.html index 6b60703e..75776128 100644 --- a/source/templates/base.html +++ b/source/templates/base.html @@ -2,7 +2,13 @@ - pyAggr3g470r - News aggregator + %if nb_unread_articles is UNDEFINED: + pyAggr3g470r + %elif nb_unread_articles == 0: + pyAggr3g470r + %else: + ${nb_unread_articles} - pyAggr3g470r + %endif @@ -11,7 +17,7 @@ -

pyAggr3g470r - News aggregator

+

pyAggr3g470r

${self.body()} @@ -21,4 +27,4 @@ Source code of pyAggr3g470r.

- \ No newline at end of file + -- cgit