Better display of the original author and author of the new main post

This commit is contained in:
Eragon 2024-03-09 18:21:08 +01:00
parent f9c4d05121
commit 2685ffcbc7
Signed by: Eragon
GPG Key ID: 087126EBFC725006
6 changed files with 32 additions and 9 deletions

View File

@ -3,6 +3,13 @@
align-items: center;
width: 265px;
}
.profile.minimal {
width: 176px;
}
.profile.minimal .profile-avatar {
width: 64px;
height: 64px;
}
.profile-avatar {
width: 128px;
height: 128px;

View File

@ -8,6 +8,15 @@
width: 265px;
}
.profile.minimal {
width: 176px;
.profile-avatar {
width: 64px;
height: 64px;
}
}
.profile-avatar {
width: 128px;
height: 128px;

View File

@ -20,13 +20,10 @@
{% endif %}
{% if t.thread.top_comment %}
{% call widget_thread.thread_leader(t.thread.top_comment) %}
{% call widget_thread.thread_leader(t.thread.top_comment, t) %}
<div class="info">
<div>
Créé le {{ t.date_created | dyndate }}
{% if t.author_id != t.thread.top_comment.author.id %}
par <a href="{{ url_for('user', username=t.author.name) }}">{{ t.author.name }}</a>
{% endif %}
<!-- We check if the formatted date is not the same, because the date might differ slightly between the two even if it's the same -->
{% if t.thread.top_comment.date_created | dyndate != t.date_created | dyndate %}
(Posté le {{ t.thread.top_comment.date_created | dyndate }})

View File

@ -17,7 +17,7 @@
<section>
{% if p.thread.top_comment %}
{% call widget_thread.thread_leader(p.thread.top_comment) %}
{% call widget_thread.thread_leader(p.thread.top_comment, p) %}
<div class="info">
{{ widget_thread.post_actions(p) }}
</div>

View File

@ -98,12 +98,20 @@
leader: Posts's top comment (actual rendering is delegated to caller) #}
{% macro thread_leader(leader) %}
{% macro thread_leader(leader, thread) %}
<table class="thread topcomment">
{# Empty line to get normal background (instead of alternate one) #}
<tr></tr>
<tr id="{{ leader.id }}">
<td class="author">{{ widget_user.profile(leader.author) }}</td>
<td class="author">
{% if thread.author_id != leader.author_id %}
<em>Auteur de la page:</em>
{{ widget_user.profile(thread.author, minimal = True) }}
<hr/>
<em>Auteur du post principal:</em>
{% endif %}
{{ widget_user.profile(leader.author) }}
</td>
<td class="message">{{ caller() }}</td>
</tr>
</table>

View File

@ -1,9 +1,10 @@
{% macro profile(user) %}
{% macro profile(user, minimal = False) %}
{% if user.type == "member" %}
<div class="profile">
<div class="profile{% if minimal %} minimal {% endif %}">
<img class="profile-avatar" src="{{ user.avatar_url }}" alt="Avatar de {{ user.name }}">
<div>
<div class="profile-name"><a href="{{ url_for('user', username=user.name) }}">{{ user.name }}</a></div>
{% if minimal == False %}
{% if user.title %}
<div class="profile-title" style="{{ user.title.css }}">{{ user.title.name }}</div>
{% else %}
@ -16,6 +17,7 @@
{% else %}
<div class="profile-xp profile-xp-100"><div style='width: {{ user.level[0] - 100 }}%;'></div></div>
{% endif %}
{% endif %}
</div>
</div>
{% else %}