aboutsummaryrefslogtreecommitdiff
path: root/source/templates/unread.html
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-09-14 10:44:59 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-09-14 10:44:59 +0200
commit79dfa104623d51b7e0bdb411eadceda1747d0a20 (patch)
tree1542f86ee36a5606af0e9df70fea4e9f44b2060f /source/templates/unread.html
parentThe logo of the feed has been added to the feed management page (/feed). (diff)
downloadnewspipe-79dfa104623d51b7e0bdb411eadceda1747d0a20.tar.gz
newspipe-79dfa104623d51b7e0bdb411eadceda1747d0a20.tar.bz2
newspipe-79dfa104623d51b7e0bdb411eadceda1747d0a20.zip
Templates has been removed to the upper folder.
Diffstat (limited to 'source/templates/unread.html')
-rw-r--r--source/templates/unread.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/source/templates/unread.html b/source/templates/unread.html
new file mode 100644
index 00000000..93df53e7
--- /dev/null
+++ b/source/templates/unread.html
@@ -0,0 +1,76 @@
+## unread.html
+<%inherit file="base.html"/>
+<%
+import utils
+%>
+<div class="left inner">
+ <%
+ html = ""
+ if mongo.nb_unread_articles() != 0:
+
+ # List unread articles of all the database
+ if feed_id == "":
+ html += "<h1>Unread article(s)</h1>"
+ html += """\n<br />\n<a href="/mark_as_read/">Mark all articles as read</a>\n<hr />\n"""
+ for feed in feeds:
+ new_feed_section = True
+ nb_unread = 0
+
+ # For all unread article of the current feed.
+ for article in mongo.get_articles(feed["feed_id"], condition=("article_readed", False)):
+ nb_unread += 1
+ if new_feed_section is True:
+ new_feed_section = False
+ html += """<h2><a name="%s"><a href="%s" rel="noreferrer" target="_blank">%s</a></a><a href="%s" rel="noreferrer" target="_blank"><img src="%s" width="28" height="28" /></a></h2>\n""" % \
+ (feed["feed_id"], feed["site_link"], feed["feed_title"], feed["feed_link"], feed["feed_image"])
+
+ # descrition for the CSS ToolTips
+ article_content = utils.clear_string(article["article_content"])
+ if article_content:
+ description = " ".join(article_content[:500].split(' ')[:-1])
+ else:
+ description = "No description."
+
+ # a description line per article (date, title of the article and
+ # CSS description tooltips on mouse over)
+ html += article["article_date"].strftime('%Y-%m-%d %H:%M') + " - " + \
+ """<a class="tooltip" href="/article/%s:%s" rel="noreferrer" target="_blank">%s<span class="classic">%s</span></a><br />\n""" % \
+ (feed["feed_id"], article["article_id"], article["article_title"][:150], description)
+
+ if nb_unread == mongo.nb_unread_articles(feed["feed_id"]):
+ html += """<br />\n<a href="/mark_as_read/Feed:%s">Mark all as read</a>\n""" % \
+ (feed["feed_id"],)
+ html += """<hr />\n<a href="/mark_as_read/">Mark articles as read</a>\n"""
+
+
+ # List unread articles of a feed
+ else:
+ try:
+ feed = mongo.get_feed(feed_id)
+ except:
+ return "<p>This feed do not exists.</p>"
+ html += """<h1>Unread article(s) of the feed <a href="/articles/%s">%s</a></h1>
+ <br />""" % (feed_id, feed["feed_title"])
+
+ # For all unread article of the feed.
+ for article in mongo.get_articles(feed_id, condition=("article_readed", False)):
+ # descrition for the CSS ToolTips
+ article_content = utils.clear_string(article["article_content"])
+ if article_content:
+ description = " ".join(article_content[:500].split(' ')[:-1])
+ else:
+ description = "No description."
+
+ # a description line per article (date, title of the article and
+ # CSS description tooltips on mouse over)
+ html += article["article_date"].strftime('%Y-%m-%d %H:%M') + " - " + \
+ """<a class="tooltip" href="/article/%s:%s" rel="noreferrer" target="_blank">%s<span class="classic">%s</span></a><br />\n""" % \
+ (feed_id, article["article_id"], article["article_title"][:150], description)
+
+ html += """<hr />\n<a href="/mark_as_read/Feed:%s">Mark all as read</a>""" % (feed_id,)
+ # No unread article
+ else:
+ html += '<h1>No unread article(s)</h1>\n<br />\n<a href="/fetch/">Why not check for news?</a>'
+ html += """\n<h4><a href="/">All feeds</a></h4>"""
+ %>
+ ${html}
bgstack15