Author: Manos Pitsidianakis [manos@pitsidianak.is]
Hash: c209db8ebcd4235b34b28efcc662519218e73180
Timestamp: Fri, 28 Apr 2023 17:36:49 +0000 (1 year ago)

+60 -60 +/-2 browse
web: add entry.html template
1diff --git a/web/src/templates/lists/entry.html b/web/src/templates/lists/entry.html
2new file mode 100644
3index 0000000..acaef71
4--- /dev/null
5+++ b/web/src/templates/lists/entry.html
6 @@ -0,0 +1,53 @@
7+ <table class="headers" title="E-mail headers">
8+ <caption class="screen-reader-only">E-mail headers</caption>
9+ {% if is_root %}
10+ <tr>
11+ <th scope="row">List:</th>
12+ <td class="faded">{{ list.id }}</td>
13+ </tr>
14+ {% endif %}
15+ <tr>
16+ <th scope="row">From:</th>
17+ <td>{{ post.address }}</td>
18+ </tr>
19+ <tr>
20+ {% if is_root %}
21+ <tr>
22+ <th scope="row">To:</th>
23+ <td class="faded">{{ post.to }}</td>
24+ </tr>
25+ <tr>
26+ <th scope="row">Subject:</th>
27+ <td>{{ trimmed_subject }}</td>
28+ </tr>
29+ {% endif %}
30+ <th scope="row">Date:</th>
31+ <td class="faded">{{ post.datetime }}</td>
32+ </tr>
33+ <tr>
34+ {% if is_root %}
35+ {% if in_reply_to %}
36+ <tr>
37+ <th scope="row">In-Reply-To:</th>
38+ <td class="faded message-id"><a href="{{ root_url_prefix }}{{ list_post_path(list.id, in_reply_to) }}">{{ in_reply_to }}</a></td>
39+ </tr>
40+ {% endif %}
41+ {% if references %}
42+ <tr>
43+ <th scope="row">References:</th>
44+ <td>{% for r in references %}<span class="faded message-id"><a href="{{ root_url_prefix }}{{ list_post_path(list.id, r) }}">{{ r }}</a></span>{% endfor %}</td>
45+ </tr>
46+ {% endif %}
47+ {% else %}
48+ <th scope="row">Message-ID:</th>
49+ <td class="faded message-id"><a href="{{ root_url_prefix }}{{ list_post_path(list.id, post.message_id) }}">{{ strip_carets(post.message_id) }}</a></td>
50+ </tr>
51+ {% endif %}
52+ <tr>
53+ <td colspan="2"><details class="reply-details"><summary>more …</summary><a href="{{ root_url_prefix }}{{ post_raw_path(list.id, post.message_id) }}">View raw</a> <a href="{{ root_url_prefix }}{{ post_eml_path(list.id, post.message_id) }}">Download as <code>eml</code> (RFC 5322 format)</a></details></td>
54+ </tr>
55+ </table>
56+ <div class="post-body">
57+ <pre {% if odd %}style="--background-secondary: var(--background-critical);" {% endif %}title="E-mail text content">{{ body }}</pre>
58+ </div>
59+
60 diff --git a/web/src/templates/lists/post.html b/web/src/templates/lists/post.html
61index 3b9324f..a0d07e5 100644
62--- a/web/src/templates/lists/post.html
63+++ b/web/src/templates/lists/post.html
64 @@ -1,66 +1,13 @@
65 {% include "header.html" %}
66 <div class="body">
67- <table class="headers" title="E-mail headers">
68- <caption class="screen-reader-only">E-mail headers</caption>
69- <tr>
70- <th scope="row">List:</th>
71- <td class="faded">{{ list.id }}</td>
72- </tr>
73- <tr>
74- <th scope="row">From:</th>
75- <td>{{ from }}</td>
76- </tr>
77- <tr>
78- <th scope="row">To:</th>
79- <td class="faded">{{ to }}</td>
80- </tr>
81- <tr>
82- <th scope="row">Subject:</th>
83- <td>{{ trimmed_subject }}</td>
84- </tr>
85- <tr>
86- <th scope="row">Date:</th>
87- <td class="faded">{{ date }}</td>
88- </tr>
89- {% if in_reply_to %}
90- <tr>
91- <th scope="row">In-Reply-To:</th>
92- <td class="faded message-id"><a href="{{ root_url_prefix }}{{ list_post_path(list.id, in_reply_to) }}">{{ in_reply_to }}</a></td>
93- </tr>
94- {% endif %}
95- {% if references %}
96- <tr>
97- <th scope="row">References:</th>
98- <td>{% for r in references %}<span class="faded message-id"><a href="{{ root_url_prefix }}{{ list_post_path(list.id, r) }}">{{ r }}</a></span>{% endfor %}</td>
99- </tr>
100- {% endif %}
101- </table>
102- <div class="post-body">
103- <pre title="E-mail text content">{{ body }}</pre>
104- </div>
105+ {% set is_root = true %}
106+ {% with post = { 'address': from, 'to': to, 'datetime': date, 'message_id': message_id } %}
107+ {% include 'lists/entry.html' %}
108+ {% endwith %}
109+ {% set is_root = false %}
110 {% for (depth, post, body, date) in thread %}
111- <table class="headers" title="E-mail headers">
112- <caption class="screen-reader-only">E-mail headers</caption>
113- <tr>
114- <th scope="row">From:</th>
115- <td>{{ post.address }}</td>
116- </tr>
117- <tr>
118- <th scope="row">Date:</th>
119- <td class="faded">{{ date }}</td>
120- </tr>
121- <tr>
122- <th scope="row">Message-ID:</th>
123- <td class="faded message-id"><a href="{{ root_url_prefix }}{{ list_post_path(list.id, post.message_id) }}">{{ strip_carets(post.message_id) }}</a></td>
124- </tr>
125- <tr>
126- <td colspan="2"><details class="reply-details"><summary>more …</summary><a href="{{ root_url_prefix }}{{ post_raw_path(list.id, post.message_id) }}">View raw</a> <a href="{{ root_url_prefix }}{{ post_eml_path(list.id, post.message_id) }}">Download as <code>eml</code> (RFC 5322 format)</a></details></td>
127- </tr>
128- </table>
129- <div class="post-body">
130- <pre title="E-mail text content">{{ body }}</pre>
131- </div>
132-
133+ {% set odd = loop.index % 2 == 1 %}
134+ {% include 'lists/entry.html' %}
135 {% endfor %}
136 </div>
137 {% include "footer.html" %}