This commit is contained in:
2025-04-21 16:36:33 +01:00
commit c109930ae0
18 changed files with 1382 additions and 0 deletions

48
src/html/post.html Normal file
View File

@@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block content %}
<h2>From {{ post.user.name }} in /{{ post.board.name }}/</h2>
<h6>posted at {{ post.created_at }}</h6>
{% if post.reference %}
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.content }}</a></h6>
{% endif %}
<p>{{ post.content }}</p>
<br>
<h3>Replies:</h3>
<ul class="posts">
{% for reply in post.replies %}
<li>
<h3>From {{ reply.user.name }} in /{{ reply.board.name }}/</h3>
<h6>posted at {{ reply.created_at }}</h6>
<p>{{ reply.content }}</p>
<h6><a href="/posts/{{ reply.id }}">View Reply</a></h6>
</li>
{% endfor %}
{% if post.replies|length == 0 %}
<li>No replies found.</li>
{% endif %}
</ul>
<div id="nav">
<h5>Page {{ page }}</h5>
{% if page > 1 %}
<h5><a href="/posts/{{ post.id }}?page={{ page - 1 }}">Previous Page</a></h5>
{% endif %}
{% if post.replies|length == 10 %}
<h5><a href="/posts/{{ post.id }}?page={{ page + 1 }}">Next Page</a></h5>
{% endif %}
</div>
<br>
<form method="POST" action="/post">
<input type="hidden" name="ref" value="{{ post.id }}">
<input type="hidden" name="board" value="{{ post.board.id }}">
<input type="hidden" name="redirect" value="/posts/{{ post.id }}">
<label for="content">Reply:</label>
<textarea id="content" name="content" rows="4" cols="50" required></textarea>
<br>
<button type="submit">Post</button>
</form>
{% if error %}
<p style="color: red;">{{ error }}</p>
{% endif %}
{% endblock %}