aboutsummaryrefslogtreecommitdiff
path: root/source/templates/feed.html
blob: c5ca831c179de4cc83069efd7ad14cf784b67462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
## 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>&nbsp;&nbsp;&nbsp;
    <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
%else:
    <p>No articles yet.</p>
%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>


%if articles != []:
    </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>
%endif
bgstack15