lib.itmens/journal/templates/_list_item.html

105 lines
4 KiB
HTML
Raw Normal View History

2023-06-09 02:23:15 -04:00
{# 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 %}
2025-01-01 11:47:13 -05:00
{% if not mark %}
{% get_mark_for_item item as mark %}
{% endif %}
2023-06-09 02:23:15 -04:00
<article class="entity-sort item-card"
draggable="true"
2023-06-09 02:23:15 -04:00
{% if collection_edit %}data-member-id="{{ collection_member.id }}"{% endif %}>
<span class="action">
{% if collection_edit %}
<span>
2024-05-20 23:17:47 -04:00
<a title="{% trans "Remove from collection" %}"
hx-target="closest article"
hx-swap="outerHTML"
2023-06-09 02:23:15 -04:00
hx-post="{% url 'journal:collection_remove_item' collection.uuid item.uuid %}">
<i class="fa-solid fa-square-minus"></i>
</a>
</span>
2024-12-30 01:51:19 -05:00
{% elif request.user.is_authenticated and item.class_name != 'collection' %}
2023-06-09 02:23:15 -04:00
<span>
2025-01-01 11:47:13 -05:00
{% if not mark.shelf_type %}
2024-05-20 23:17:47 -04:00
<a title="{% trans "add mark" %}"
2023-06-09 02:45:27 -04:00
hx-get="{% url 'journal:mark' item.uuid %}?shelf_type=wishlist"
2023-06-09 02:23:15 -04:00
hx-target="body"
hx-swap="beforeend">
<i class="fa-regular fa-bookmark"></i>
</a>
{% else %}
<a class="activated"
2024-05-20 23:17:47 -04:00
title="{% trans "update mark" %}"
2023-06-09 02:45:27 -04:00
hx-get="{% url 'journal:mark' item.uuid %}"
2023-06-09 02:23:15 -04:00
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 %}
2025-01-01 11:47:13 -05:00
{% if mark.shelf %}
2023-06-09 02:23:15 -04:00
<section>
<div class="action">
2025-01-01 18:41:31 -05:00
{% include "action_open_post.html" with post=mark.shelfmember.latest_post %}
2023-06-09 02:23:15 -04:00
<span class="timestamp">{{ mark.created_time|date }}</span>
</div>
2025-01-01 18:41:31 -05:00
<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>
2025-01-01 11:47:13 -05:00
<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>
2025-01-01 18:41:31 -05:00
{% if mark.comment.latest_post %}<div id="replies_{{ mark.comment.latest_post.pk }}"></div>{% endif %}
2023-06-09 02:23:15 -04:00
</section>
{% endif %}
{% if mark.review %}
<section>
2025-01-01 18:41:31 -05:00
<div class="action">
{% include "action_open_post.html" with post=mark.review.latest_post %}
2023-06-09 02:23:15 -04:00
<span class="timestamp">{{ mark.review.created_time|date }}</span>
2025-01-01 18:41:31 -05:00
</div>
2024-04-20 10:29:40 -04:00
<div class="tldr">
2024-05-26 22:57:49 -04:00
{% trans "Review" %}
2023-06-09 02:23:15 -04:00
<span>
<a href="{% url 'journal:review_retrieve' mark.review.uuid %}">{{ mark.review.title }}</a>
</span>
-
2024-04-20 10:29:40 -04:00
{{ mark.review.plain_content }}
2023-06-09 02:23:15 -04:00
</div>
2025-01-01 18:41:31 -05:00
{% if mark.review.latest_post %}<div id="replies_{{ mark.review.latest_post.pk }}"></div>{% endif %}
2023-06-09 02:23:15 -04:00
</section>
{% endif %}
{% endif %}
{% if collection_member %}
<div hx-swap="innerHTML" hx-target="this" class="item-note">
2023-06-09 02:23:15 -04:00
{% if collection_edit %}
<span class="action">
2024-05-20 23:17:47 -04:00
<a title="{% trans "Update note" %}"
2023-06-09 02:23:15 -04:00
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 %}
2025-01-20 10:21:57 -05:00
&nbsp;
</div>
2023-06-09 02:23:15 -04:00
{% endif %}
</footer>
{% endif %}
</article>