v2 overhaul

This commit is contained in:
2025-04-25 00:33:14 +01:00
parent e9dc5e5056
commit ea2e8b75cc
27 changed files with 1513 additions and 1202 deletions

View File

@@ -1,44 +1,42 @@
{% extends "base.html" %}
{% extends "templates/base.html" %}
{% block content %}
<h1>{{ board.name }}</h1>
<h6>Created at: {{ board.created_at }}</h6>
{% block head %}
<link rel="stylesheet" href="../static/css/form.css">
{% endblock %}
{% block main_content %}
<h1 class="board-name">/{{ board.name }}/</h1>
<p>{{ board.description }}</p>
{% if board.owner_id == session.user_id %}
<h6><a href="/boards/delete/{{ board.id }}">Delete Board</a></h6>
{% endif %}
{% if session.user_id %}
<br>
<h3>Post to this board</h3>
<form action="/post" method="POST" enctype="multipart/form-data">
<input type="hidden" name="board_id" value="{{ board.id }}">
<textarea name="content" placeholder="Content" required></textarea>
<input type="file" name="attachments" multiple>
<button type="submit">Post</button>
</form>
{% endif %}
<br>
<h1>Posts:</h1>
<ul class="posts">
{% for post in board.posts %}
<ul class="post-list">
{% for post in posts %}
<li>
<h3>From {{ post.user.name }}</h3>
<h6>posted at {{ post.created_at }}</h6>
{% if post.reference %}
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.short_content }}</a></h6>
{% endif %}
<p>{{ post.short_content }}</p>
<h6><a href="/posts/{{ post.id }}">View Post</a>
{% if post.replies|length > 0 %}
({{ post.replies|length }} replies)
{% endif %}
{% if session.name == "SYSTEM" %}
| <a href="/delete/post/{{ post.id }}">Delete</a>
{% elif session.name == post.user.name %}
| <a href="/delete/post/{{ post.id }}">Delete</a>
{% endif %}
</h6>
{% include "templates/short_post.html" %}
</li>
{% endfor %}
{% if board.posts|length == 0 %}
<li>No posts found.</li>
{% endif %}
</ul>
<div id="nav">
<h5>Page {{ page }}</h5>
{% if page > 1 %}
<h5><a href="/boards/{{ board.name }}?page={{ page - 1 }}">Previous Page</a></h5>
{% endif %}
{% if board.posts|length == 10 %}
<h5><a href="/boards/{{ board.name }}?page={{ page + 1 }}">Next Page</a></h5>
{% endif %}
</div>
{% if total_pages > 0 %}
<div id="nav">
<h5>Page {{ page }} of {{ total_pages }}</h5>
{% if page > 1 %}
<h5><a href="/boards/{{ board.name }}?page={{ page - 1 }}">Previous Page</a></h5>
{% endif %}
{% if posts|length == 10 %}
<h5><a href="/boards/{{ board.name }}?page={{ page + 1 }}">Next Page</a></h5>
{% endif %}
</div>
{% endif %}
{% endblock %}