nekrochan/templates/macros/post.html
2024-07-24 13:08:08 +02:00

83 řádky
3.9 KiB
HTML

{% macro post(board, post, boxed) %}
<div id="{{ post.id }}" class="post{% if boxed %} box{% endif %}" data-board="{{ board.id }}">
<div class="post-header">
<input name="posts[]" type="checkbox" value="{{ post.board }}/{{ post.id }}">&#32;
{% if tcx.perms.owner() || tcx.perms.view_ips() %}
<b><a title="Více příspěvků od uživatele [{{ post.ip }}]" href="/ip-posts/{{ post.ip }}">[+]</a></b>&#32;
{% endif %}
{% if let Some(email) = post.email %}
<a class="name" rel="nofollow" href="mailto:{{ email }}">{{ post.name }}</a>&#32;
{% else %}
<span class="name">{{ post.name }}</span>&#32;
{% endif %}
{% if let Some(tripcode) = post.tripcode %}
<span class="tripcode">{{ tripcode }}</span>&#32;
{% endif %}
{% if let Some(capcode) = post.capcode %}
<span title="Tento uživatel to dělá ZDARMA!" class="capcode">## {{ capcode }} <img class="icon" src="/favicon.ico"></span>&#32;
{% endif %}
{% if tcx.ip == post.ip %}
{# Technically not a tripcode or something but same styling #}
<i class="tripcode">(Ty)</i>&#32;
{% endif %}
{% if board.config.0.flags %}
<img title="Země: {{ post.country }}" class="icon" src="/static/flags/{{ post.country }}.png">&#32;
{% endif %}
{% if board.config.0.flags_reg %}
{% if let Some(region) = post.region %}
<img title="Region: {{ region }}" class="icon" src="/static/flags/reg/{{ region }}.png">&#32;
{% endif %}
{% endif %}
<time datetime="{{ post.created }}">{{ post.created|czech_datetime }}</time>&#32;
{% if board.config.0.user_ids %}
<span class="user-id" style="background-color: #{{ post.user_id }};">{{ post.user_id }}</span>&#32;
{% endif %}
<span class="post-number">
<a href="{{ post.post_url() }}">Č.</a>
<a class="quote-link" href="{{ post.thread_url() }}#post-form" data-thread-url="{{ post.thread_url() }}">{{ post.id }}</a>&#32;
</span>
{% if post.sticky %}
<img title="Připnuto" class="icon" src="/static/icons/sticky.png">&#32;
{% endif %}
{% if post.locked %}
<img title="Uzamčeno" class="icon" src="/static/icons/locked.png">&#32;
{% endif %}
{% if !boxed %}
<a href="{{ post.post_url_notarget() }}">[Otevřít]</a>&#32;
{% endif %}
</div>
{% if !post.files.0.is_empty() %}
<div class="post-files{% if post.files.0.len() > 1 %} float-none-a{% endif %}">
{% for file in post.files.0 %}
<div class="post-file">
<a title="Stáhnout {{ file.original_name }}" download="{{ file.original_name }}" href="{{ file.file_url() }}">
{% if file.spoiler %}
[Spoiler]
{% else %}
{{ file.original_name|truncate(20) }}
{% endif %}
</a>
<br>
({{ file.size|filesizeformat }}, {{ file.width }}x{{ file.height }})
<br>
<a class="expandable" target="_blank" href="{{ file.file_url() }}">
<img class="thumb" src="{{ file.thumb_url() }}">
</a>
</div>
{% endfor %}
</div>
{% endif %}
<div class="post-content">{{ post.content|add_yous(post.board, tcx.yous)|safe }}</div>
<div class="clearfix"></div>
{% if !post.quotes.is_empty() %}
<div class="small">
Odpovědi:&#32;
{% for quote in post.quotes %}
<a class="quote" href="{{ post.thread_url() }}#{{ quote }}">&gt;&gt;{{ quote }}</a>&#32;
{% endfor %}
</div>
{% endif %}
</div>
{% endmacro %}