diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-25 16:22:15 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-25 16:22:15 +0100 |
commit | ce9e5e6988b5777d78d714d6ef695472d55c6099 (patch) | |
tree | 732df494ae83cd74bab1d366e59681030e3a4722 /source | |
parent | Template for the /management page. (diff) | |
download | newspipe-ce9e5e6988b5777d78d714d6ef695472d55c6099.tar.gz newspipe-ce9e5e6988b5777d78d714d6ef695472d55c6099.tar.bz2 newspipe-ce9e5e6988b5777d78d714d6ef695472d55c6099.zip |
Template for the /articles page.
Diffstat (limited to 'source')
-rwxr-xr-x | source/pyAggr3g470r.py | 43 | ||||
-rw-r--r-- | source/templates/articles.html | 43 |
2 files changed, 45 insertions, 41 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 9c4e6766..4cb304fe 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -606,47 +606,8 @@ class pyAggr3g470r(object): articles = self.mongo.get_articles_from_collection(feed_id) except KeyError: return self.error_page("This feed do not exists.") - html = htmlheader() - html += htmlnav - html += """<div class="right inner">\n""" - html += """<a href="/mark_as_read/Feed:%s">Mark all articles from this feed as read</a>""" % (feed_id,) - html += """<br />\n<form method=get action="/search/%s"><input type="search" name="query" value="" placeholder="Search this feed" maxlength=2048 autocomplete="on"></form>\n""" % ("Feed:"+feed_id,) - html += "<hr />\n" - html += self.create_list_of_feeds() - html += """</div> <div class="left inner">""" - html += """<h1>Articles of the feed <i><a href="/feed/%s">%s</a></i></h1><br />""" % (feed_id, feed["feed_title"]) - - for article in articles: - - 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 = "", "" - - if article["article_like"] == True: - like = """ <img src="/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[: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%s%s<span class="classic">%s</span></a>""" % \ - (feed_id, article["article_id"], not_read_begin, \ - article["article_title"][:150], not_read_end, description) + like + "<br />\n" - - html += """\n<h4><a href="/">All feeds</a></h4>""" - html += "<hr />\n" - html += htmlfooter - return html + tmpl = lookup.get_template("articles.html") + return tmpl.render(articles=articles, feed=feed) articles.exposed = True diff --git a/source/templates/articles.html b/source/templates/articles.html new file mode 100644 index 00000000..1c425c7e --- /dev/null +++ b/source/templates/articles.html @@ -0,0 +1,43 @@ +## articles.html +<%inherit file="base.html"/> +<% +import utils +%> +<h1><div class="right innerlogo"><a href="/"><img src="/img/tuxrss.png" title="What's new today?"/></a> +</div><a name="top"><a href="/">pyAggr3g470r - News aggregator</a></a></h1> +<a href="http://bitbucket.org/cedricbonhomme/pyaggr3g470r/" rel="noreferrer" target="_blank">pyAggr3g470r (source code)</a> + +<div class="right inner"> + <a href="/mark_as_read/Feed:${feed['feed_id']}">Mark all articles from this feed as read</a> + <br /> + <form method=get action="/search/Feed${feed['feed_id']}"> + <input type="search" name="query" value="" placeholder="Search this feed" maxlength=2048 autocomplete="on"> + </form> + <hr /> +</div> + +<div class="left inner"> + <h1>Articles of the feed <i><a href="/feed/${feed['feed_id']}">${feed['feed_title']}</a></i></h1> + <br /> + %for article in articles: + <% + if article["article_readed"] == False: + not_read_begin, not_read_end = "<b>", "</b>" + else: + not_read_begin, not_read_end = "", "" + + if article["article_like"] == True: + like = """ <img src="/img/heart.png" title="I like this article!" />""" + else: + like = "" + + article_content = utils.clear_string(article["article_content"]) + if article_content: + description = " ".join(article_content[:500].split(' ')[:-1]) + else: + description = "No description." + %> + ${article["article_date"].strftime('%Y-%m-%d %H:%M')} - <a class="tooltip" href="/article/${feed['feed_id']}:${article['article_id']}" rel="noreferrer" target="_blank">${not_read_begin}${article["article_title"][:150]}${not_read_end}<span class="classic">${description}</span></a> + <br /> + %endfor + <h4><a href="/">All feeds</a></h4>
\ No newline at end of file |