fileinfo.html: do not generate file related html if there are no files

This commit is contained in:
Zankaria 2025-10-10 23:46:38 +02:00
parent 16451374ab
commit 58b6478e47

View file

@ -1,37 +1,37 @@
{% if post.embed %} {% if post.embed %}
{{ post.embed }} {{ post.embed }}
{% else %} {% elseif post.num_files > 0 %}
<div class="files {% if post.num_files > 1 %} multifile{% endif %}"> <div class="files {% if post.num_files > 1 %} multifile{% endif %}">
{% for file in post.files %} {% for file in post.files %}
<div class="file{% if post.num_files > 1 %} multifile" style="width:{{ file.thumbwidth + 40 }}px"{% else %}"{% endif %}> <div class="file{% if post.num_files > 1 %} multifile" style="width:{{ file.thumbwidth + 40 }}px"{% else %}"{% endif %}>
{% if file.file == 'deleted' %} {% if file.file == 'deleted' %}
<img class="post-image deleted" src="{{ config.root }}{{ config.image_deleted }}" alt="" /> <img class="post-image deleted" src="{{ config.root }}{{ config.image_deleted }}" alt="" />
{% else %} {% else %}
<p class="fileinfo">File: <a href="{{ config.uri_img }}{{ file.file }}" target="_blank">{{ file.file }}</a> <span class="details"> <p class="fileinfo">File: <a href="{{ config.uri_img }}{{ file.file }}" target="_blank">{{ file.file }}</a> <span class="details">
( (
{% if file.thumb == 'spoiler' %} {% if file.thumb == 'spoiler' %}
{% trans %}Spoiler Image{% endtrans %}, {% trans %}Spoiler Image{% endtrans %},
{% endif %}
{{ file.size|filesize }}
{% if file.width and file.height %}
, {{ file.width}}x{{ file.height }}
{% if config.show_ratio %}
, {{ ratio(file.width, file.height) }}
{% endif %} {% endif %}
{% endif %} {{ file.size|filesize }}
{% if config.show_filename and file.filename %} {% if file.width and file.height %}
, {% if file.filename|length > config.max_filename_display %} , {{ file.width}}x{{ file.height }}
<a href="{{ config.uri_img }}{{ file.file|e|bidi_cleanup }}" download="{{ file.filename|e|bidi_cleanup }}" title="Save as original filename: {{ file.filename|e|bidi_cleanup }}">{{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }}</a> {% if config.show_ratio %}
{% else %} , {{ ratio(file.width, file.height) }}
<a href="{{ config.uri_img }}{{ file.file|e|bidi_cleanup }}" download="{{ file.filename|e|bidi_cleanup }}" title="Save as original filename">{{ file.filename|e|bidi_cleanup }}</a> {% endif %}
{% endif %} {% endif %}
{% endif %} {% if config.show_filename and file.filename %}
) , {% if file.filename|length > config.max_filename_display %}
{% include "post/image_identification.html" %} <a href="{{ config.uri_img }}{{ file.file|e|bidi_cleanup }}" download="{{ file.filename|e|bidi_cleanup }}" title="Save as original filename: {{ file.filename|e|bidi_cleanup }}">{{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }}</a>
{% include "post/file_controls.html" %}</span></p> {% else %}
{% include "post/image.html" with {'post':file} %} <a href="{{ config.uri_img }}{{ file.file|e|bidi_cleanup }}" download="{{ file.filename|e|bidi_cleanup }}" title="Save as original filename">{{ file.filename|e|bidi_cleanup }}</a>
{% endif %} {% endif %}
</div> {% endif %}
)
{% include "post/image_identification.html" %}
{% include "post/file_controls.html" %}</span></p>
{% include "post/image.html" with {'post':file} %}
{% endif %}
</div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}