aboutsummaryrefslogtreecommitdiff
path: root/views/index.tpl
blob: 1851531adcbd95e5b9f92b9eef82df5a377ae3df (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
% import time
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>View Feed Entries | TagRSS</title>
    <link href="/static/styles/main.css" rel="stylesheet">
    <style>
        table {
            table-layout: fixed;
        }
        th#th-num {
            width: 2.5%;
        }
        th#th-title {
            width: 45%;
        }
        th#th-datetime {
            width: 12.5%;
        }
        th#th-tag {
            width: 20%;
        }
        td.td-tags > div {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: auto;
            white-space: nowrap;
        }
        th#th-feed {
            width: 20%;
        }
        td.td-feed > div {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: auto;
            white-space: nowrap;
        }

        label#refresh_checkbox_label {
            float: right;
        }
    </style>
    <script src="/static/scripts/auto_refresh.js" defer></script>
</head>
<body>
    <h1>TagRSS</h1>
    <nav>
        <p>
            <a href="/add_feed" class="no-visited-indication">Add feed</a>&nbsp;|
            <a href="/list_feeds" class="no-visited-indication">List feeds</a>
        </p>
    </nav>
    <label id="refresh_checkbox_label" style="display: none;">Refresh entries periodically
        <input type="checkbox" checked>
    </label>
    <details {{"open" if (included_feeds or included_tags) else ""}}>
        <summary>Filter</summary>
        <form>
            <div class="side-by-side-help-container">
                <label>Included feeds:
                    <input type="text" name="included_feeds" value="{{' '.join([str(feed_id) for feed_id in included_feeds]) if included_feeds else ''}}">
                </label>
                % include("hover_help.tpl", text="Space-separated feed IDs.")
            </div>
            % include(
            %     "tag_input.tpl",
            %     label="Included tags:",
            %     input_name="included_tags",
            %     input_value=included_tags_str if included_tags_str else ""
            % )
            <input type="submit" value="Filter">
            <input type="hidden" value="{{page_num}}" min="1" max="{{total_pages}}" name="page_num">
            <input type="hidden" value="{{per_page}}" min="1" max="{{max_per_page}}" name="per_page">
        </form>
        <form>
            <input type="hidden" name="included_feeds" value="">
            <input type="hidden" name="included_tags" value="">
            <input type="submit" value="Clear filters">
            <input type="hidden" value="{{page_num}}" min="1" max="{{total_pages}}" name="page_num">
            <input type="hidden" value="{{per_page}}" min="1" max="{{max_per_page}}" name="per_page">
        </form>
    </details>
    <table>
        <thead>
            <tr>
                <th id="th-num">#</th>
                <th id="th-title">Title</th>
                <th id="th-datetime">Date & Time ({{time.tzname[time.localtime().tm_isdst]}})</th>
                <th id="th-tags">Tags</th>
                <th id="th-feed">Feed</th>
            </tr>
        </thead>
        <tbody>
            % for i, entry in enumerate(entries):
                <tr>
                    <td>{{i + 1 + offset}}</td>
                    <td><a href="{{entry.link}}">{{entry.title}}</a></td>
                    <%
                        local_date = ""
                        utc_date = ""
                        epoch = entry.epoch_updated
                        if not epoch:
                            epoch = entry.epoch_published
                        end
                        if epoch:
                            local_date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(epoch))
                            utc_date = time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime(epoch))
                        end
                    %>
                    <td>
                        <time datetime="{{utc_date}}">{{local_date}}</time>
                    </td>
                    <td class="td-tags">
                        <div>
                            % tags = referenced_feeds[entry.feed_id].tags
                            % for i, tag in enumerate(tags):
                                % if i > 0:
                                    {{", "}}
                                % end
                                <span class="tag">{{tag}}</span>
                            % end
                        </div>
                    </td>
                    <td class="td-feed">
                        <div>
                            <a href="/manage_feed?feed={{entry.feed_id}}" class="no-visited-indication"></a>
                            {{referenced_feeds[entry.feed_id].title}}
                            <small>(</small>{{entry.feed_id}}<small>)</small>
                        </div>
                    </td>
                </tr>
            % end
        </tbody>
    </table>
    <form>
        <label>Page
            <input type="number" value="{{page_num}}" min="1" max="{{total_pages}}" name="page_num">
        </label> of {{total_pages}}.
        <label>Per page:
            <input type="number" value="{{per_page}}" min="1" max="{{max_per_page}}" name="per_page">
        </label>
        <input type="submit" value="Go">
        % if included_feeds:
            <input type="hidden" name="included_feeds" value="{{included_feeds_str}}">
        % end
        % if included_tags:
            <input type="hidden" name="included_tags" value="{{included_tags_str}}">
        % end
    </form>
    % include("footer.tpl")
</body>
</html>