Add submission sidebar post info template

This commit is contained in:
Aroy-Art 2024-10-23 22:09:42 +02:00
parent e56a804f4e
commit 46ac248b6b
Signed by: Aroy
GPG key ID: DB9689E9391DD156

View file

@ -0,0 +1,117 @@
{% load string_helper %}
<h1 class="text-center m-0">Post Info:</h1>
<hr class="m-1">
<div class="m-2 overflow-hidden">
<strong class="text-info">Tags: </strong>
{% if submission.content_object.tags.exists %}
{% for tag in submission.content_object.tags.all %}
<span>
<a class="badge bg-primary tag" href="{% url 'sites:tag' tag.tag_slug %}">{{ tag.tag|capfirst }}</a>
</span>
{% endfor %}
{% else %}
<span class="badge bg-secondary">This submission has no tags</span>
{% endif %}
</div>
<hr class="m-2">
<table class="table table-sm rounded-2 bg-secondary">
<tbody class="rounded-2">
<tr>
{% if submission.category.name == "furaffinity" %}
<th scope="row" class="text-info">FurAffinity ID</th>
{% elif submission.category.name == "twitter" %}
<th scope="row" class="text-info">Twitter ID</th>
{% elif submission.category.name == "instagram" %}
<th scope="row" class="text-info">Instagram ID</th>
{% else %}
<th scope="row" class="text-info">Submission ID</th>
{% endif %}
<td>{{ submission.content_object.submission_id }}</td>
</tr>
<tr>
{% if submission.category.name == "furaffinity" %}
<th scope="row" class="text-info">Views</th>
<td>{{ submission.content_object.views }}</td>
{% endif %}
</tr>
<tr>
<th scope="row" class="text-info">Gallery Type</th>
<td>{{ submission.content_object.gallery_type|capfirst }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Lang</th>
<td>{{ submission.content_object.lang }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Favorites</th>
<td>{{ submission.content_object.favorites_count }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Retweets</th>
<td>{{ submission.content_object.retweet_count }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Quotes</th>
<td>{{ submission.content_object.quote_count }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Replies</th>
<td>{{ submission.content_object.reply_count }}</td>
</tr>
</tbody>
</table>
<h1 class="text-center m-0">Media Info:</h1>
<hr class="m-1">
<table class="table table-sm">
<tbody>
{% if submission.content_object.files.all|length == 0 %}
<td>
<th scope="row" class="text-warning">No Media</th>
</tr>
{% elif submission.content_object.files.all|length <= 1 %}
<tr>
<th scope="row" class="text-info">Image Size</th>
<td>{{ submission.content_object.files.first.image_width }} x {{ submission.content_object.files.first.image_height }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Size</th>
<td>{{ submission.content_object.files.first.size|size_to_human_readable }}</td>
</tr>
{% else %}
{% for file in submission.content_object.files.all %}
<tr>
<th scope="row" class="text-info">Image Res {{ forloop.counter }}</th>
<td>{{ file.image_width }} x {{ file.image_height }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Size {{ forloop.counter }}</th>
<td>{{ file.size|size_to_human_readable }}</td>
</tr>
{% endfor %}
{% endif %}
<tr>
<th scope="row" class="text-info">Mature</th>
<td><span class="badge {% if submission.content_object.sensitive %}bg-danger{% else %}bg-success{% endif %} text-2xl">{{ submission.content_object.sensitive|default_if_none:False }}</span></td>
</tr>
<tr>
<th scope="row" class="text-info">Orginal Date</th>
<td>{{ submission.content_object.date |date:'Y-m-d H:i:s' }}</td>
</tr>
<tr>
<th scope="row" class="text-info">Archive Date</th>
<td>{{ submission.date_added |date:'Y-m-d H:i:s' }}</td>
</tr>
</tbody>
</table>