diff options
Diffstat (limited to 'source/templates/feed.html')
-rw-r--r-- | source/templates/feed.html | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/source/templates/feed.html b/source/templates/feed.html new file mode 100644 index 00000000..5fc5d170 --- /dev/null +++ b/source/templates/feed.html @@ -0,0 +1,122 @@ +## feed.html +<%inherit file="base.html"/> +<% +import utils +%> +<div class="left inner"> +<p>The feed <b>${feed['feed_title']}</b> contains <b>${nb_articles_feed}</b> articles. +Representing ${(round(float(nb_articles_feed) / nb_articles_total, 4)) * 100} percent of the total (${nb_articles_total}).</p> + +%if articles: + <p>${(nb_unread_articles_feed == 0 and ["All articles are read"] or [str(nb_unread_articles_feed) + " unread article" + (nb_unread_articles_feed == 1 and [""] or ["s"])[0]])[0]}.</p> +%endif + +%if feed["mail"] == True: + <p>You are receiving articles from this feed to the address: <a href="mail:${mail_to}">${mail_to}</a>. + <a href="/mail_notification/0:${feed['feed_id']}">Stop</a> receiving articles from this feed.</p> +%endif + +%if articles != []: + <p>The last article was posted ${delta_today.days} day(s) ago.</p> + %if delta_today.days > 0: + <p>Daily average: ${average}, between the ${first_post_date} and the ${end_post_date}.</p> + %endif + + + <br /> + <h1>Recent articles</h1> + <% + html = "" + %> + %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 = "", "" + + # display a heart for faved articles + 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." + # 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" + %> + %endfor + ${html} + + <a href="/articles/${feed['feed_id']}">All articles</a> + <br /> + + %if nb_favorites != 0: + <br /></br /> + <h1>Your favorites articles for this feed</h1> + <% + html = "" + %> + %for article in favorites: + <% + #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) + %> + %endfor + ${html} + %endif +%endif + + + +<br /> +<h1>Edit this feed</h1> +<form method=post action="/change_feed_name/"> + <input type="text" name="new_feed_name" value="" placeholder="Enter a new name (then press Enter)." maxlength=2048 autocomplete="on" size="50" /> + <input type="hidden" name="feed_id" value="${feed['feed_id']}" /> +</form> + +<form method=post action="/change_feed_url/"> + <input type="url" name="new_feed_url" value="" placeholder="Enter a new URL in order to retrieve articles (then press Enter)." maxlength=2048 autocomplete="on" size="50" /> + <input type="hidden" name="feed_id" value="${feed['feed_id']}" /><input type="hidden" name="old_feed_url" value="${feed['feed_link']}" /> +</form> + +<form method=post action="/change_feed_logo/"> + <input type="text" name="new_feed_logo" value="" placeholder="Enter the URL of the logo (then press Enter)." maxlength=2048 autocomplete="on" size="50" /> + <input type="hidden" name="feed_id" value="${feed['feed_id']}" /> +</form> + + + +</br /> +<h1>Tag cloud</h1> +<form method=get action="/feed/${feed['feed_id']}"> + Minimum size of a word: + <input type="number" name="word_size" value="${word_size}" min="2" max="15" step="1" size="2"> +</form> +<div style="width: 35%; overflow:hidden; text-align: justify">${tag_cloud}</div>
\ No newline at end of file |