aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py32
-rw-r--r--source/templates/base.html5
-rw-r--r--source/templates/favorites.html37
-rw-r--r--source/templates/plain_text.html7
4 files changed, 48 insertions, 33 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index de436ff4..43023a1a 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -1054,34 +1054,12 @@ class pyAggr3g470r(object):
List of favorites articles
"""
feeds = self.mongo.get_all_feeds()
- html = htmlheader()
- html += htmlnav
- html += """<div class="left inner">"""
- html += "<h1>Your favorites articles</h1>"
+ articles = {}
for feed in feeds:
- new_feed_section = True
- for article in self.mongo.get_articles_from_collection(feed["feed_id"]):
- if article["article_like"] == True:
- 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)
- html += "<hr />\n"
- html += htmlfooter
- return html
+ articles[feed["feed_id"]] = self.mongo.get_articles_from_collection(feed["feed_id"])
+ tmpl = lookup.get_template("favorites.html")
+ return tmpl.render(feeds=feeds, \
+ articles=articles)
favorites.exposed = True
diff --git a/source/templates/base.html b/source/templates/base.html
index 54cfc524..899bbce3 100644
--- a/source/templates/base.html
+++ b/source/templates/base.html
@@ -11,5 +11,10 @@
${self.body()}
+<hr />
+<p>This software is under GPLv3 license. You are welcome to copy, modify or
+redistribute the source code according to the
+<a href="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</a> license.</p>
+</div>
</body>
</html> \ No newline at end of file
diff --git a/source/templates/favorites.html b/source/templates/favorites.html
new file mode 100644
index 00000000..6cdf34bc
--- /dev/null
+++ b/source/templates/favorites.html
@@ -0,0 +1,37 @@
+## favorites.html
+<%inherit file="base.html"/>
+<%page enable_loop="True"/>
+<%
+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="left inner">
+ <h1>Your favorites articles</h1>
+ %for feed in feeds:
+ <%
+ new_feed_section = True
+ %>
+ %for article in articles[feed["feed_id"]]:
+ %if article["article_like"]:
+ <%
+ if new_feed_section:
+ new_feed_section = False
+ title = """<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"])
+ else:
+ title = ""
+ article_content = utils.clear_string(article["article_content"])
+ if article_content:
+ description = " ".join(article_content[:500].split(' ')[:-1])
+ else:
+ description = "No description."
+ %>
+ ${title}
+
+
+ ${article["article_date"].strftime('%Y-%m-%d %H:%M')} - <a class="tooltip" href="/article/${feed['feed_id']}:${article['article_id']}" rel="noreferrer" target="_blank">${article["article_title"][:150]}<span class="classic">${description}</span></a><br />
+ %endif
+ %endfor
+ %endfor \ No newline at end of file
diff --git a/source/templates/plain_text.html b/source/templates/plain_text.html
index 3076e5bb..44b7da91 100644
--- a/source/templates/plain_text.html
+++ b/source/templates/plain_text.html
@@ -2,9 +2,4 @@
<%inherit file="base.html"/>
<div class="left inner">
<h1><i>${article_title}</i> from <a href="/articles/%s">${feed_title}</a></h1><br />
- ${description}
- <hr />
- <p>This software is under GPLv3 license. You are welcome to copy, modify or
- redistribute the source code according to the
- <a href="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</a> license.</p>
-</div> \ No newline at end of file
+ ${description} \ No newline at end of file
bgstack15