Skip to content

Commit f566caa

Browse files
committed
add submitter and admin badges to workshop comments
1 parent 2a2ad14 commit f566caa

1 file changed

Lines changed: 31 additions & 8 deletions

File tree

‎views/workshop/item.workshop.html.twig‎

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,37 @@
360360

361361
<div class="" style="width: 100%; margin-left: 7px; padding: 0;">
362362
<div class="d-flex justify-content-between" style="width: 100%;">
363-
<a
364-
href="/workshop/browse?user={{ comment.user.username }}"
365-
title="Browse {{ comment.user.username }}'s Workshop Items"
366-
class="user-link d-inline-block">
367-
<span class="user-username">{{ comment.user.username }}</span>
368-
</a>
369-
<span class="text-muted" style="display:inline;">
370-
{{ comment.createdTimestamp|date('Y/m/d - H:i') }}
363+
364+
{# Left side #}
365+
<span>
366+
367+
{# Username #}
368+
<a
369+
href="/workshop/browse?user={{ comment.user.username }}"
370+
title="Browse {{ comment.user.username }}'s Workshop Items"
371+
class="user-link d-inline-block me-2">
372+
<span class="user-username">{{ comment.user.username }}</span>
373+
</a>
374+
375+
{# Badge: If user is submitter #}
376+
{% if item.submitter is not null and comment.user == item.submitter %}
377+
<span class="badge bg-primary text-uppercase" style="font-size: 10px; position: relative; top: -2px; padding: 3px 4px;">Submitter</span>
378+
{% endif %}
379+
380+
{# Badge: If user is admin #}
381+
{% if comment.user.role.value == roles.admin %}
382+
<span class="badge bg-danger text-uppercase" style="font-size: 10px; position: relative; top: -2px; padding: 3px 4px;">Admin</span>
383+
{% endif %}
384+
385+
</span>
386+
387+
{# Right side #}
388+
<span>
389+
390+
{# Date #}
391+
<span class="text-muted" style="display:inline;">
392+
{{ comment.createdTimestamp|date('Y/m/d - H:i') }}
393+
</span>
371394
</span>
372395
</div>
373396

0 commit comments

Comments
 (0)