From 79dfa104623d51b7e0bdb411eadceda1747d0a20 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 14 Sep 2013 10:44:59 +0200 Subject: Templates has been removed to the upper folder. --- source/templates/index.html | 108 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 source/templates/index.html (limited to 'source/templates/index.html') diff --git a/source/templates/index.html b/source/templates/index.html new file mode 100644 index 00000000..88ca7a87 --- /dev/null +++ b/source/templates/index.html @@ -0,0 +1,108 @@ +## index.html +<%inherit file="base.html"/> +<% +import utils +%> +
+
+ +
+ +
+ +
+
+ <% + html = "" + %> + <% + for feed in feeds: + html += """\n

%s + + + +

\n
""" % \ + (feed["feed_id"], feed["site_link"], feed["feed_title"], \ + feed["feed_link"], feed["feed_image"]) + + # The main page display only 10 articles by feeds. + for article in mongo.get_articles(feed["feed_id"], limit=10): + if article["article_readed"] == False: + # not readed articles are in bold + not_read_begin, not_read_end = "", "" + else: + not_read_begin, not_read_end = "", "" + + # display a heart for faved articles + if article["article_like"] == True: + like = """ """ + else: + like = "" + + # Descrition for the CSS ToolTips + article_content = utils.clear_string(article["article_content"]) + if article_content: + description = " ".join(article_content.split(' ')[:55]) + else: + description = "No description." + # Title of the article + article_title = article["article_title"] + if len(article_title) >= 80: + article_title = article_title[:80] + " ..." + + # 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') + " - " + \ + """%s%s%s%s""" % \ + (feed["feed_id"], article["article_id"], not_read_begin, \ + article_title, not_read_end, description) + like + "
\n" + html += "
\n" + + # some options for the current feed + html += """All articles   """ % (feed["feed_id"],) + html += """Feed summary   """ % (feed["feed_id"],) + html += """

\n""" % (feed["feed_id"],) + if mongo.nb_unread_articles(feed["feed_id"]) != 0: + html += """  Mark all as read""" + html += """     %s unread article(s)""" % (feed["feed_id"], mongo.nb_unread_articles(feed["feed_id"])) + if feed["mail"] == False: + html += """
\nEnable email notifications""" % (feed["feed_id"],) + else: + html += """
\nDisable email notifications""" % (feed["feed_id"],) + html += """

Top

\n""" + %> + ${html} -- cgit