lib.itmens/journal/templates/_list_item.html
2025-01-01 18:42:11 -05:00

101 lines
3.9 KiB
HTML

{# parameters: item, mark, collection_member, collection_edit + parameters passing down: show_tags, hide_category #}
{% load thumb %}
{% load i18n %}
{% load l10n %}
{% load user_actions %}
{% load duration %}
{% if not mark %}
{% get_mark_for_item item as mark %}
{% endif %}
<article class="entity-sort item-card"
{% if collection_edit %}data-member-id="{{ collection_member.id }}"{% endif %}>
<span class="action">
{% if collection_edit %}
<span>
<a title="{% trans "Remove from collection" %}"
hx-target="#collection_items"
hx-post="{% url 'journal:collection_remove_item' collection.uuid item.uuid %}">
<i class="fa-solid fa-square-minus"></i>
</a>
</span>
{% elif request.user.is_authenticated and item.class_name != 'collection' %}
<span>
{% if not mark.shelf_type %}
<a title="{% trans "add mark" %}"
hx-get="{% url 'journal:mark' item.uuid %}?shelf_type=wishlist"
hx-target="body"
hx-swap="beforeend">
<i class="fa-regular fa-bookmark"></i>
</a>
{% else %}
<a class="activated"
title="{% trans "update mark" %}"
hx-get="{% url 'journal:mark' item.uuid %}"
hx-target="body"
hx-swap="beforeend">
<i class="fa-solid fa-bookmark"></i>
</a>
{% endif %}
</span>
{% endif %}
</span>
{% include "_item_card.html" with item=item %}
{% if mark or collection_edit or collection_member.note %}
<footer>
{% if mark %}
{% if mark.shelf %}
<section>
<div class="action">
{% include "action_open_post.html" with post=mark.shelfmember.latest_post %}
<span class="timestamp">{{ mark.created_time|date }}</span>
</div>
<div>
{% comment %} <a href="{{mark.owner.url }}" title="@{{ mark.owner.handle }}">{{ mark.owner.display_name }}</a> {% endcomment %}
<span>{{ mark.status_label }}</span>
{% if mark.rating_grade %}{{ mark.rating_grade|rating_star }}{% endif %}
<span>{{ mark.comment.html|safe }}</span>
</div>
<span class="tag-list">
{% for tag in mark.tags %}
{% if forloop.counter <= 5 %}
<span>
<a href="{% url 'common:search' %}?c=journal&amp;q=tag:{{ tag }}">{{ tag }}</a>
</span>
{% endif %}
{% endfor %}
</span>
{% if mark.comment.latest_post %}<div id="replies_{{ mark.comment.latest_post.pk }}"></div>{% endif %}
</section>
{% endif %}
{% if mark.review %}
<section>
<div class="action">
{% include "action_open_post.html" with post=mark.review.latest_post %}
<span class="timestamp">{{ mark.review.created_time|date }}</span>
</div>
<div class="tldr">
{% trans "Review" %}
<span>
<a href="{% url 'journal:review_retrieve' mark.review.uuid %}">{{ mark.review.title }}</a>
</span>
-
{{ mark.review.plain_content }}
</div>
{% if mark.review.latest_post %}<div id="replies_{{ mark.review.latest_post.pk }}"></div>{% endif %}
</section>
{% endif %}
{% endif %}
{% if collection_member %}
<p hx-target="this" hx-swap="innerHTML">
{% if collection_edit %}
<span class="action">
<a title="{% trans "Update note" %}"
hx-get="{% url 'journal:collection_update_item_note' collection.uuid item.uuid %}"><i class="fa-regular fa-pen-to-square"></i></a>
</span>
{% endif %}
{% if collection_member.note %}{{ collection_member.note }}{% endif %}
</p>
{% endif %}
</footer>
{% endif %}
</article>