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/search.html | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 source/templates/search.html (limited to 'source/templates/search.html') diff --git a/source/templates/search.html b/source/templates/search.html new file mode 100644 index 00000000..435ef443 --- /dev/null +++ b/source/templates/search.html @@ -0,0 +1,57 @@ +## search.html +<%inherit file="base.html"/> +<% +import utils +%> +
+%if len(search_result) != 0: +

Articles containing the string ${query} (${sum([len(articles) for articles in search_result.values()])} results)

+%else: +

String ${query} not found.

+%endif +
+
+ +
+ +<% + html = "" + feed_id = None +%> + +%for feed_id in search_result.keys(): + <% + new_feed_section = True + feed = mongo.get_feed(feed_id) + for article in search_result[feed["feed_id"]]: + if new_feed_section is True: + new_feed_section = False + html += """

%s

\n""" % \ + (feed["feed_id"], feed["feed_title"], feed["feed_link"], feed["feed_image"]) + + 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"]) + description = " ".join(article_content[:500].split(' ')[:-1]) + + # 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["article_title"][:150], not_read_end, description) + like + "
\n" + %> +%endfor + +${html} \ No newline at end of file -- cgit