seria/templates/macros.twig

33 lines
2.1 KiB
Twig

{% macro torrent_listing_entry(torrent, class_name) %}
{% set torrent_info = torrent.info %}
{% set submitter_info = torrent.user|default(null) %}
<div class="tdl {{ class_name }}" id="tdl{{ torrent_info.id }}">
<div class="tdl-details">
<div class="tdl-details-name"><a href="/info/{{ torrent_info.id }}">{{ torrent_info.name }}</a></div>
{% if submitter_info is not null %}
<div class="tdl-user" style="--user-colour: {{ submitter_info.colour }}">
<div class="avatar tdl-user-avatar"><a href="/profile/{{ submitter_info.name }}"><img src="{{ globals.site_info.avatarUrl(submitter_info, 40) }}" alt="" width="20" height="20"></a></div>
<div class="tdl-user-name"><a href="/profile/{{ submitter_info.name }}">{{ submitter_info.name }}</a></div>
</div>
{% endif %}
</div>
<div class="tdl-stats">
<div class="tdl-stats-uploading" title="Uploading"><div class="arrow">&#8593;</div><div class="number">{{ torrent.complete_peers|number_format }}</div></div>
<div class="tdl-stats-downloading" title="Downloading"><div class="arrow">&#8595;</div><div class="number">{{ torrent.incomplete_peers|number_format }}</div></div>
</div>
{% if globals.auth_info.isLoggedIn %}
<div class="tdl-actions">
{% if not torrent_info.isApproved and globals.auth_info.userInfo.canApproveTorrents %}
<a href="javascript:;" title="Approve" class="js-listing-approve" data-dlid="{{ torrent_info.id }}"><img src="//static.flash.moe/images/silk/tick.png" alt="Approve"></a>
<a href="javascript:;" title="Deny" class="js-listing-deny" data-dlid="{{ torrent_info.id }}"><img src="//static.flash.moe/images/silk/cross.png" alt="Deny"></a>
{% endif %}
<a href="/download/{{ torrent_info.id }}" title="Download"><img src="//static.flash.moe/images/silk/link.png" alt="Download"></a>
</div>
{% endif %}
</div>
{% endmacro %}