diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-09-14 10:44:59 +0200 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-09-14 10:44:59 +0200 |
commit | 79dfa104623d51b7e0bdb411eadceda1747d0a20 (patch) | |
tree | 1542f86ee36a5606af0e9df70fea4e9f44b2060f /source/templates/index.html | |
parent | The logo of the feed has been added to the feed management page (/feed). (diff) | |
download | newspipe-79dfa104623d51b7e0bdb411eadceda1747d0a20.tar.gz newspipe-79dfa104623d51b7e0bdb411eadceda1747d0a20.tar.bz2 newspipe-79dfa104623d51b7e0bdb411eadceda1747d0a20.zip |
Templates has been removed to the upper folder.
Diffstat (limited to 'source/templates/index.html')
-rw-r--r-- | source/templates/index.html | 108 |
1 files changed, 108 insertions, 0 deletions
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 +%> +<div class="right inner"> + <form method=get action="/search/"> + <input type="search" name="query" value="" placeholder="Search articles" maxlength=2048 autocomplete="on" /> + </form> + <div class="nav_container"><div align="center"><i><a href="/subscriptions/">Subscriptions</a></i> (${nb_feeds})<br /></div> + <% + html = "" + %> + %for feed in feeds: + <% + if mongo.nb_unread_articles(feed["feed_id"]) != 0: + not_read_begin, not_read_end = "<b>", "</b>" + else: + not_read_begin, not_read_end = "", "" + html += """<div style='float:left'><a href="/#%s">%s</a></div> + <div style='float:right'> (<a href="/unread/%s" title="Unread article(s)">%s%s%s</a> / %s)</div> + <div style="clear:both"></div>\n""" % \ + (feed["feed_id"], feed["feed_title"], feed["feed_id"], not_read_begin, \ + format(mongo.nb_unread_articles(feed["feed_id"]), ',d'), not_read_end, format(mongo.nb_articles(feed["feed_id"]), ',d')) + %> + %endfor + ${html} + </div> +</div> + +<div class="left inner"> + <div class="menu_container"> + %if feeds: + <a href="/management/"><img src="/static/img/management.png" title="Management" /></a> + <a href="/history/"><img src="/static/img/history.png" title="History" /></a> + + <a href="/favorites/"><img src="/static/img/heart-32x32.png" title="Your favorites (${nb_favorites})" /></a> + <a href="/notifications/"><img src="/static/img/email-follow.png" title="Active e-mail notifications (${nb_mail_notifications})" /></a> + + %if nb_unread_articles != 0: + <a href="/mark_as_read/"><img src="/static/img/mark-as-read.png" title="Mark articles as read" /></a> + <a href="/unread/"><img src="/static/img/unread.png" title="Unread article(s): ${nb_unread_articles}" /></a> + %endif + %endif + <a href="/fetch/"><img src="/static/img/check-news.png" title="Check for news" /></a> + + <a href="/logout/"><img src="/static/img/logout.png" title="Logout" /></a> + </div><br/> + <% + html = "" + %> + <% + for feed in feeds: + html += """\n<h2 id="%s"><a href="%s" rel="noreferrer" target="_blank">%s</a> + <a href="%s" rel="noreferrer" target="_blank"> + <img src="%s" width="28" height="28" /> + </a> + </h2>\n<br />""" % \ + (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 = "<b>", "</b>" + else: + not_read_begin, not_read_end = "", "" + + # display a heart for faved articles + if article["article_like"] == True: + like = """ <img src="/static/img/heart.png" title="I like this article!" />""" + 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') + " - " + \ + """<a class="tooltip" href="/article/%s:%s" rel="noreferrer" target="_blank">%s%s%s<span class="classic">%s</span></a>""" % \ + (feed["feed_id"], article["article_id"], not_read_begin, \ + article_title, not_read_end, description) + like + "<br />\n" + html += "<br />\n" + + # some options for the current feed + html += """<a href="/articles/%s">All articles</a> """ % (feed["feed_id"],) + html += """<a href="/feed/%s">Feed summary</a> """ % (feed["feed_id"],) + html += """<div class="right"><h2><a href="/fetch/%s"><img src="/static/img/check-news.png" title="Check this feed for news" /></a></h2></div>\n""" % (feed["feed_id"],) + if mongo.nb_unread_articles(feed["feed_id"]) != 0: + html += """ <a href="/mark_as_read/">Mark all as read</a>""" + html += """ <a href="/unread/%s">%s unread article(s)</a>""" % (feed["feed_id"], mongo.nb_unread_articles(feed["feed_id"])) + if feed["mail"] == False: + html += """<br />\n<a href="/mail_notification/1:%s" title="By e-mail">Enable email notifications</a>""" % (feed["feed_id"],) + else: + html += """<br />\n<a href="/mail_notification/0:%s" title="By e-mail">Disable email notifications</a>""" % (feed["feed_id"],) + html += """<h4><a href="/#top">Top</a></h4>\n""" + %> + ${html} |