lib.itmens/catalog/templates/_item_comments.html
2023-10-22 17:46:34 -04:00

83 lines
3.5 KiB
HTML

{% load static %}
{% load i18n %}
{% load l10n %}
{% load admin_url %}
{% load mastodon %}
{% load oauth_token %}
{% load truncate %}
{% load duration %}
{% load user_actions %}
{% if item.class_name == "tvseason" and not request.GET.last %}
{% if item.all_episodes %}
<div class="season-picker">
<span class="season-number"><a class="current">全部</a></span>
{% for ep in item.all_episodes %}
<span class="season-number" id="ci_{{ ep.uuid }}">
<a hx-swap="innerHTML"
hx-get="{% url "catalog:comments_by_episode" item.url_path item.uuid %}?episode_uuid={{ ep.uuid }}"
hx-target="#comments">{{ ep.episode_number }}</a>
</span>
{% endfor %}
</div>
<script defer>$(function(){ window.cil.forEach(function(uuid){ $('#ci_'+uuid).addClass('marked'); }) });</script>
{% else %}
<p _="init get localStorage.getItem('x_add_episode') then if it then add .hidden to #x_add_episode"
id="x_add_episode"
class="hint">
<a href={% url 'catalog:edit' item.url_path item.uuid %}>使用编辑功能</a>批量获取或手工添加单集子条目后可开启分集短评。
[<a _="on click add .hidden to #x_add_episode then call localStorage.setItem('x_add_episode', 1)">不再提示</a>]
</p>
{% endif %}
{% endif %}
{% for comment in comments %}
{% if forloop.counter <= 10 %}
<section>
<span class="action">
{% if comment.item.class_name == "podcastepisode" %}
<span>
<a href="{{ comment.item_url }}"
data-media="{{ comment.item.media_url }}"
data-position="{{ comment.metadata.position|default:0 }}"
data-cover="{{ comment.item.cover_url|default:item.cover.url }}"
class="episode"
data-hosts="{{ comment.item.hosts|join:' / ' }}"
data-title="{{ comment.item.title }}"
data-album="{{ item.title }}"
data-uuid="{{ comment.item.uuid }}"><i class="fa-regular fa-circle-play"></i></a>
</span>
{% endif %}
<span>
{% liked_piece comment as liked %}
{% include 'like_stats.html' with liked=liked piece=comment %}
</span>
<span>
<a target="_blank"
rel="noopener"
{% if comment.shared_link %} href="{{ comment.shared_link }}" title="打开联邦宇宙分享链接" {% else %} class="disabled" {% endif %}><i class="fa-solid {% if comment.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
</span>
</span>
<span>
{% if comment.rating_grade %}{{ comment.rating_grade|rating_star }}{% endif %}
<a href="{{ comment.owner.url }}"
class="nickname"
title="@{{ comment.owner.handler }}">{{ comment.owner.display_name }}</a>
</span>
<span class="action inline">
<span class="timestamp">
{{ comment.created_time|date }}
{{ comment.mark.action_label }}
</span>
</span>
{% if comment.item != item %}<a href="{{ comment.item_url }}">{{ comment.item.title }}</a>{% endif %}
<div>{{ comment.html|safe }}</div>
</section>
{% else %}
<a hx-get="{% url 'catalog:comments' comment.item.url_path comment.item.uuid %}?last={{ comment.created_time|date:'Y-m-d H:i:s.uO'|urlencode }}"
hx-trigger="click"
hx-swap="outerHTML">
<button class="outline">显示更多</button>
</a>
{% endif %}
{% empty %}
<div class="empty">{% trans '暂无' %}</div>
{% endfor %}