Author: Manos Pitsidianakis [manos@pitsidianak.is]
Hash: 7d36ec045e739746330dd113da832fd1599765de
Timestamp: Thu, 09 Nov 2023 06:27:48 +0000 (10 months ago)

+64 -44 +/-3 browse
web: add link anchors to posts
web: add link anchors to posts

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
1diff --git a/web/src/templates/css.html b/web/src/templates/css.html
2index aa47ff3..f644210 100644
3--- a/web/src/templates/css.html
4+++ b/web/src/templates/css.html
5 @@ -686,7 +686,7 @@
6 hyphens: auto;
7 word-wrap: anywhere;
8 word-break: break-all;
9- width: 50ch;
10+ width: auto;
11 }
12
13 div.post-body>pre {
14 @@ -694,7 +694,7 @@
15 overflow-wrap: break-word;
16 white-space: pre-line;
17 hyphens: auto;
18- background-color: var(--background-secondary);
19+ /* background-color: var(--background-secondary); */
20 line-height: 1.1;
21 padding: 1rem;
22 }
23 @@ -1077,4 +1077,16 @@
24 font-family: var(--grotesque-system-stack);
25 font-variant-numeric: tabular-nums slashed-zero;
26 }
27+
28+ a[href^="#"].anchor::before {
29+ color: var(--text-inactive);
30+ content: "#";
31+ display: inline-block;
32+ font-size: .7em;
33+ line-height: 1;
34+ margin-left: -.8em;
35+ text-decoration: none;
36+ visibility: hidden;
37+ width: .8em;
38+ }
39 </style>
40 diff --git a/web/src/templates/lists/entry.html b/web/src/templates/lists/entry.html
41index a1abb02..7aa07a7 100644
42--- a/web/src/templates/lists/entry.html
43+++ b/web/src/templates/lists/entry.html
44 @@ -1,7 +1,11 @@
45- <div class="post">
46+ <div class="post" id="{{ strip_carets(post.message_id)|safe }}">
47 <table class="headers" title="E-mail headers">
48 <caption class="screen-reader-only">E-mail headers</caption>
49 <tr>
50+ <th scope="row"></th>
51+ <td><a href="#{{ strip_carets(post.message_id) }}"></a></td>
52+ </tr>
53+ <tr>
54 <th scope="row">From:</th>
55 <td>{{ post.address }}</td>
56 </tr>
57 diff --git a/web/src/templates/lists/list.html b/web/src/templates/lists/list.html
58index e6aef5c..7eb868e 100644
59--- a/web/src/templates/lists/list.html
60+++ b/web/src/templates/lists/list.html
61 @@ -10,7 +10,7 @@
62 <p title="mailing list description">No list description.</p>
63 {% endif %}
64 <br aria-hidden="true">
65- {% if current_user and not post_policy.no_subscriptions and subscription_policy.open %}
66+ {% if current_user and subscription_policy and subscription_policy.open %}
67 {% if user_context %}
68 <form method="post" action="{{ settings_path() }}" class="settings-form">
69 <input type="hidden" name="type", value="unsubscribe">
70 @@ -32,53 +32,57 @@
71 {% if preamble.custom %}
72 {{ preamble.custom|safe }}
73 {% else %}
74- {% if not post_policy.no_subscriptions %}
75- {{ heading(3, "Subscribe") }}
76- {% set subscription_mailto=list.subscription_mailto() %}
77- {% if subscription_mailto %}
78- {% if subscription_mailto.subject %}
79- <p>
80- <a href="mailto:{{ subscription_mailto.address|safe }}?subject={{ subscription_mailto.subject|safe }}"><code>{{ subscription_mailto.address }}</code></a> with the following subject: <code>{{ subscription_mailto.subject}}</code>
81- </p>
82+ {% if subscription_policy %}
83+ {% if subscription_policy.open or subscription_policy.request %}
84+ {{ heading(3, "Subscribe") }}
85+ {% set subscription_mailto=list.subscription_mailto() %}
86+ {% if subscription_mailto %}
87+ {% if subscription_mailto.subject %}
88+ <p>
89+ <a href="mailto:{{ subscription_mailto.address|safe }}?subject={{ subscription_mailto.subject|safe }}"><code>{{ subscription_mailto.address }}</code></a> with the following subject: <code>{{ subscription_mailto.subject}}</code>
90+ </p>
91+ {% else %}
92+ <p>
93+ <a href="mailto:{{ subscription_mailto.address|safe }}"><code>{{ subscription_mailto.address }}</code></a>
94+ </p>
95+ {% endif %}
96 {% else %}
97- <p>
98- <a href="mailto:{{ subscription_mailto.address|safe }}"><code>{{ subscription_mailto.address }}</code></a>
99- </p>
100+ <p>List is not open for subscriptions.</p>
101 {% endif %}
102- {% else %}
103- <p>List is not open for subscriptions.</p>
104- {% endif %}
105
106- {% set unsubscription_mailto=list.unsubscription_mailto() %}
107- {% if unsubscription_mailto %}
108- {{ heading(3, "Unsubscribe") }}
109- {% if unsubscription_mailto.subject %}
110- <p>
111- <a href="mailto:{{ unsubscription_mailto.address|safe }}?subject={{ unsubscription_mailto.subject|safe }}"><code>{{ unsubscription_mailto.address }}</code></a> with the following subject: <code>{{unsubscription_mailto.subject}}</code>
112- </p>
113- {% else %}
114- <p>
115- <a href="mailto:{{ unsubscription_mailto.address|safe }}"><code>{{ unsubscription_mailto.address }}</code></a>
116- </p>
117+ {% set unsubscription_mailto=list.unsubscription_mailto() %}
118+ {% if unsubscription_mailto %}
119+ {{ heading(3, "Unsubscribe") }}
120+ {% if unsubscription_mailto.subject %}
121+ <p>
122+ <a href="mailto:{{ unsubscription_mailto.address|safe }}?subject={{ unsubscription_mailto.subject|safe }}"><code>{{ unsubscription_mailto.address }}</code></a> with the following subject: <code>{{unsubscription_mailto.subject}}</code>
123+ </p>
124+ {% else %}
125+ <p>
126+ <a href="mailto:{{ unsubscription_mailto.address|safe }}"><code>{{ unsubscription_mailto.address }}</code></a>
127+ </p>
128+ {% endif %}
129 {% endif %}
130 {% endif %}
131 {% endif %}
132
133- {{ heading(3, "Post") }}
134- {% if post_policy.announce_only %}
135- <p>List is <em>announce-only</em>, i.e. you can only subscribe to receive announcements.</p>
136- {% elif post_policy.subscription_only %}
137- <p>List is <em>subscription-only</em>, i.e. you can only post if you are subscribed.</p>
138- <p>If you are subscribed, you can send new posts to:
139- <a href="mailto:{{ list.address| safe }}"><code>{{ list.address }}</code></a>
140- </p>
141- {% elif post_policy.approval_needed or post_policy.no_subscriptions %}
142- <p>List is open to all posts <em>after approval</em> by the list owners.</p>
143- <p>You can send new posts to:
144- <a href="mailto:{{ list.address| safe }}"><code>{{ list.address }}</code></a>
145- </p>
146- {% else %}
147- <p>List is not open for submissions.</p>
148+ {% if post_policy %}
149+ {{ heading(3, "Post") }}
150+ {% if post_policy.announce_only %}
151+ <p>List is <em>announce-only</em>, i.e. you can only subscribe to receive announcements.</p>
152+ {% elif post_policy.subscription_only %}
153+ <p>List is <em>subscription-only</em>, i.e. you can only post if you are subscribed.</p>
154+ <p>If you are subscribed, you can send new posts to:
155+ <a href="mailto:{{ list.address| safe }}"><code>{{ list.address }}</code></a>
156+ </p>
157+ {% elif post_policy.approval_needed or post_policy.no_subscriptions %}
158+ <p>List is open to all posts <em>after approval</em> by the list owners.</p>
159+ <p>You can send new posts to:
160+ <a href="mailto:{{ list.address| safe }}"><code>{{ list.address }}</code></a>
161+ </p>
162+ {% else %}
163+ <p>List is not open for submissions.</p>
164+ {% endif %}
165 {% endif %}
166 {% endif %}
167 </section>