better formatting
This commit is contained in:
parent
e366d92950
commit
9760fc88e4
@ -327,6 +327,7 @@ class Database:
|
|||||||
data = {
|
data = {
|
||||||
'id': post[0],
|
'id': post[0],
|
||||||
'content': post[3],
|
'content': post[3],
|
||||||
|
'short_content': post[3][:40] + '...' if len(post[3]) > 40 else post[3],
|
||||||
'created_at': post[4],
|
'created_at': post[4],
|
||||||
'url': f"/post/{post[0]}",
|
'url': f"/post/{post[0]}",
|
||||||
}
|
}
|
||||||
@ -389,6 +390,7 @@ class Database:
|
|||||||
data['reference'] = {
|
data['reference'] = {
|
||||||
'id': reference_post[0],
|
'id': reference_post[0],
|
||||||
'content': reference_post[3],
|
'content': reference_post[3],
|
||||||
|
'short_content': reference_post[3][:20] + '...' if len(reference_post[3]) > 20 else reference_post[3],
|
||||||
'created_at': reference_post[4]
|
'created_at': reference_post[4]
|
||||||
}
|
}
|
||||||
logger.info(f"Reference post information found for post {post[0]}.")
|
logger.info(f"Reference post information found for post {post[0]}.")
|
||||||
@ -538,7 +540,7 @@ class Database:
|
|||||||
if boards:
|
if boards:
|
||||||
logger.info(f"Boards found.")
|
logger.info(f"Boards found.")
|
||||||
# Convert boards to dictionary
|
# Convert boards to dictionary
|
||||||
boards = [{"id": board[0], "name": board[1]} for board in boards]
|
boards = [{"id": board[0], "name": board[1]} for board in boards].sort(key=lambda x: x['name'])
|
||||||
return boards
|
return boards
|
||||||
logger.warning(f"No boards found.")
|
logger.warning(f"No boards found.")
|
||||||
return None
|
return None
|
@ -12,10 +12,17 @@
|
|||||||
<h3>From {{ post.user.name }}</h3>
|
<h3>From {{ post.user.name }}</h3>
|
||||||
<h6>posted at {{ post.created_at }}</h6>
|
<h6>posted at {{ post.created_at }}</h6>
|
||||||
{% if post.reference %}
|
{% if post.reference %}
|
||||||
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.content }}</a></h6>
|
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.short_content }}</a></h6>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>{{ post.content }}</p>
|
<p>{{ post.short_content }}</p>
|
||||||
<h6><a href="/posts/{{ post.id }}">View Post</a></h6>
|
<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>
|
||||||
|
{% endif %}
|
||||||
|
</h6>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if board.posts|length == 0 %}
|
{% if board.posts|length == 0 %}
|
||||||
|
@ -11,10 +11,17 @@
|
|||||||
<h3>From {{ post.user.name }} in /{{ post.board.name }}/</h3>
|
<h3>From {{ post.user.name }} in /{{ post.board.name }}/</h3>
|
||||||
<h6>posted at {{ post.created_at }}</h6>
|
<h6>posted at {{ post.created_at }}</h6>
|
||||||
{% if post.reference %}
|
{% if post.reference %}
|
||||||
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.content }}</a></h6>
|
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.short_content }}</a></h6>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>{{ post.content }}</p>
|
<p>{{ post.short_content }}</p>
|
||||||
<h6><a href="/posts/{{ post.id }}">View Post</a></h6>
|
<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>
|
||||||
|
{% endif %}
|
||||||
|
</h6>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if posts|length == 0 %}
|
{% if posts|length == 0 %}
|
||||||
|
@ -14,8 +14,15 @@
|
|||||||
<li>
|
<li>
|
||||||
<h3>From {{ reply.user.name }} in /{{ reply.board.name }}/</h3>
|
<h3>From {{ reply.user.name }} in /{{ reply.board.name }}/</h3>
|
||||||
<h6>posted at {{ reply.created_at }}</h6>
|
<h6>posted at {{ reply.created_at }}</h6>
|
||||||
<p>{{ reply.content }}</p>
|
<p>{{ reply.short_content }}</p>
|
||||||
<h6><a href="/posts/{{ reply.id }}">View Reply</a></h6>
|
<h6><a href="/posts/{{ reply.id }}">View Reply</a>
|
||||||
|
{% if post.replies|length > 0 %}
|
||||||
|
| ({{ post.replies|length }} replies)
|
||||||
|
{% endif %}
|
||||||
|
{% if session.name == "SYSTEM" %}
|
||||||
|
| <a href="/delete/post/{{ post.id }}">Delete</a>
|
||||||
|
{% endif %}
|
||||||
|
</h6>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if post.replies|length == 0 %}
|
{% if post.replies|length == 0 %}
|
||||||
|
@ -10,10 +10,17 @@
|
|||||||
<h3>From {{ post.user.name }} in /{{ post.board.name }}/</h3>
|
<h3>From {{ post.user.name }} in /{{ post.board.name }}/</h3>
|
||||||
<h6>posted at {{ post.created_at }}</h6>
|
<h6>posted at {{ post.created_at }}</h6>
|
||||||
{% if post.reference %}
|
{% if post.reference %}
|
||||||
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.content }}</a></h6>
|
<h6><b>ref post:</b> <a href="/posts/{{ post.reference.id }}">{{ post.reference.short_content }}</a></h6>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>{{ post.content }}</p>
|
<p>{{ post.short_content }}</p>
|
||||||
<h6><a href="/posts/{{ post.id }}">View post</a></h6>
|
<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>
|
||||||
|
{% endif %}
|
||||||
|
</h6>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if posts|length == 0 %}
|
{% if posts|length == 0 %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user