lib.itmens/catalog/templates/item_base.html

442 lines
18 KiB
HTML
Raw Normal View History

2022-12-15 17:29:35 -05:00
{% load static %}
{% load i18n %}
{% load l10n %}
{% load humanize %}
{% load admin_url %}
{% load mastodon %}
{% load oauth_token %}
{% load truncate %}
{% load strip_scheme %}
{% load thumb %}
{% load user_actions %}
{% load duration %}
2022-12-15 17:29:35 -05:00
<!DOCTYPE html>
2023-05-23 08:08:07 -04:00
<html lang="zh" class="item-page">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title"
2023-06-05 02:46:26 -04:00
content="{{ site_name }}{% trans item.category.label %} - {{ item.display_title }}">
<meta property="og:type" content="{{ item.category }}">
<meta property="og:url" content="{{ request.build_absolute_uri }}">
{% if item.has_cover %}<meta property="og:image" content="{{ item.cover_image_url }}">{% endif %}
<meta property="og:site_name" content="{{ site_name }}">
<meta property="og:description" content="{{ item.brief }}">
{% if item.is_deleted or item.merged_to_item %}<meta name="robots" content="noindex">{% endif %}
2023-06-05 02:46:26 -04:00
<title>{{ site_name }} - {% trans item.category.label %} | {{ item.display_title }}</title>
{% include "common_libs.html" with jquery=0 v2=1 %}
{% block head %}{% endblock %}
</head>
<body>
{% include "_header.html" %}
<main>
<div id="item-title" class="middle">
{% if item.is_deleted %}[DELETED]{% endif %}
{% if item.merged_to_item %}
[MERGED TO <a href="{{ item.merged_to_item.url }}">{{ item.merged_to_item.title }}</a>]
{% endif %}
<h1>
2023-06-05 02:46:26 -04:00
{{ item.display_title }}
<small>
{% if item.year %}({{ item.year }}){% endif %}
</small>
</h1>
<span class="site-list">
{% for res in item.external_resources.all %}
<a href="{{ res.url }}" class="{{ res.site_name }}">{{ res.site_name.label }}</a>
{% endfor %}
</span>
</div>
<div id="item-cover" class="left">
2023-06-05 02:04:52 -04:00
<img src="{{ item.cover_image_url|default:item.cover.url }}"
alt="{{ item.title }}">
</div>
{% if request.user.is_authenticated and not mark.shelf_type %}
<div id="item-primary-action" class="right mark">
2023-05-21 17:14:35 -04:00
<div class="item-action item-mark-buttons">
{% for k, v in shelf_types %}
{% if v %}
<button class="primary"
data-status="{{ k }}"
2023-06-09 02:45:27 -04:00
hx-get="{% url 'journal:mark' item.uuid %}?shelf_type={{ k }}"
hx-target="body"
hx-swap="beforeend">{% trans v %}</button>
{% endif %}
{% endfor %}
</div>
2023-05-21 17:14:35 -04:00
<div class="tv-tip" style="display:none;">
2023-05-22 12:41:27 -04:00
这是全剧条目,以下是可标记的单季
2023-05-21 17:43:05 -04:00
{% if item.class_name == 'tvshow' %}
{% with item.all_seasons as seasons %}
{% if seasons %}
<div _="init hide .item-mark-buttons then hide .item-mark-icon then show .tv-tip end">
{% for s in seasons %}
<span class="season-number">
<a href="{{ s.url }}">{{ s.season_number|default:"#" }}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% endwith %}
{% endif %}
2023-05-21 17:14:35 -04:00
</div>
</div>
{% endif %}
{% if request.user.is_authenticated and mark.shelf_type %}
<div id="item-primary-mark" class="right mark">
<div class="item-action">
<button class="outline edit"
2023-06-09 02:45:27 -04:00
hx-get="{% url 'journal:mark' item.uuid %}"
hx-target="body"
hx-swap="beforeend">
{{ mark.created_time | date }} {% trans mark.action_label %}
{% if mark.rating_grade %}
<br>
{{ mark.rating_grade | rating_star }}
<!-- <span style="white-space: nowrap;">
<i class="fa-solid fa-star"></i><i class="fa-solid fa-star"></i><i class="fa-solid fa-star"></i><i class="fa-solid fa-star-half-stroke"></i><i class="fa-regular fa-star"></i>
</span> -->
{% endif %}
</button>
2022-12-15 17:29:35 -05:00
</div>
<div class="small-only" style="margin-top:2vh;">
<a href="#item-sidebar">标签 · 短评 · 评论 · 收藏</a>
</div>
</div>
{% endif %}
<div id="item-sidebar" class="right">
{% if request.user.is_authenticated %}
<section>
<h5>
我的标签
<small>
<a href="#"
2023-06-09 02:45:27 -04:00
hx-get="{% url 'journal:mark' item.uuid %}"
2023-05-21 17:14:35 -04:00
class="item-mark-icon"
hx-target="body"
hx-swap="beforeend">
{% if mark.tags %}
<i class="fa-solid fa-pen-to-square"></i>
{% else %}
<i class="fa-regular fa-square-plus"></i>
2023-02-15 23:45:12 -05:00
{% endif %}
</a>
</small>
</h5>
<div class="tag-list">
{% for tag in mark.tags %}
<span>
<a href="{% url 'journal:user_tag_member_list' request.user.mastodon_username tag %}">{{ tag }}</a>
2022-12-15 17:29:35 -05:00
</span>
{% endfor %}
</div>
</section>
<section>
<h5>
我的短评
<small>
<a href="#"
2023-06-09 02:45:27 -04:00
hx-get="{% url 'journal:mark' item.uuid %}"
2023-05-21 17:14:35 -04:00
class="item-mark-icon"
hx-target="body"
hx-swap="beforeend">
{% if mark.comment_text %}
<i class="fa-solid fa-pen-to-square"></i>
{% else %}
<i class="fa-regular fa-square-plus"></i>
{% endif %}
2022-12-15 17:29:35 -05:00
</a>
</small>
</h5>
{% if mark.comment %}
<span class="action">
<span>
{% liked_piece mark.comment as liked %}
{% include 'like_stats.html' with liked=liked piece=mark.comment %}
</span>
<span>
<a target="_blank"
rel="noopener"
{% if mark.comment.metadata.shared_link %} href="{{ mark.comment.metadata.shared_link }}" title="打开联邦网络分享链接" {% else %} class="disabled" {% endif %}><i class="fa-solid {% if mark.comment.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
</span>
2023-06-01 16:39:31 -04:00
{% comment %} <span class="timestamp">{{ mark.comment.created_time|date }}</span> {% endcomment %}
</span>
<p>{{ mark.comment.html|safe }}</p>
{% else %}
<!-- <span class="empty">暂无</span> -->
{% endif %}
</section>
<section>
<h5>
我的评论
<small>
{% if review %}
2023-05-21 17:14:35 -04:00
<a href="{% url 'journal:review_edit' item.uuid review.uuid %}"
class="item-mark-icon">
<i class="fa-solid fa-pen-to-square"></i>
</a>
2022-12-25 13:45:24 -05:00
{% else %}
2023-05-21 17:14:35 -04:00
<a href="{% url 'journal:review_create' item.uuid %}"
class="item-mark-icon">
<i class="fa-regular fa-square-plus"></i>
2022-12-15 17:29:35 -05:00
</a>
2022-12-25 13:45:24 -05:00
{% endif %}
</small>
</h5>
{% if review %}
<span class="action">
<span>
{% liked_piece mark.review as liked %}
{% include 'like_stats.html' with liked=liked piece=mark.review %}
</span>
<span>
<a target="_blank"
rel="noopener"
{% if mark.review.metadata.shared_link %} href="{{ mark.review.metadata.shared_link }}" title="打<><E68993><EFBFBD>联邦网<E982A6><E7BD91><EFBFBD>分享链接" {% else %} class="disabled" {% endif %}><i class="fa-solid {% if mark.review.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
</span>
<span class="timestamp">{{ mark.review.created_time|date }}</span>
</span>
<p>
<a href="{% url 'journal:review_retrieve' review.uuid %}">{{ review.title }}</a>
</p>
2023-01-08 23:28:19 -05:00
{% else %}
<!-- <span class="empty">暂无</span> -->
{% endif %}
</section>
<section>
<h5>
我的收藏单
<small>
<a href="#"
2023-06-09 02:45:27 -04:00
hx-get="{% url 'journal:add_to_collection' item.uuid %}"
class="edit"
hx-target="body"
hx-swap="beforeend">
<i class="fa-regular fa-square-plus"></i>
</a>
</small>
</h5>
<div>
{% for c in my_collections %}
<p>
<a href="{{ c.url }}">{{ c.title }}</a>
{% if c.visibility > 0 %}<i class="fa-solid fa-lock"></i>{% endif %}
</p>
{% empty %}
<!-- <span class="empty">暂无</span> -->
{% endfor %}
2023-01-08 23:28:19 -05:00
</div>
</section>
<!--
<section>
<h5>标记历史</h5>
<div>
{% for log in mark.logs %}{{ log.timestamp|date }} {{ log.action_label }}<br>{% endfor %}
</div>
</section>
-->
{% else %}
<section>
<p class="empty">
<span><a href="{% url 'users:login' %}">登录</a>后可管理标记收藏</span>
</p>
</section>
{% endif %}
{% block sidebar %}{% endblock %}
{% if collection_list %}
<section>
<h5>相关收藏单</h5>
<div>
{% for c in collection_list %}
<p>
<a href="{{ c.url }}">{{ c.title }}</a>
{% if c.visibility > 0 %}<i class="fa-solid fa-lock"></i>{% endif %}
</p>
{% endfor %}
</div>
</section>
{% endif %}
</div>
<div id="item-metadata" class="left">
<section>
{% block details %}
<div>此类数据尚未支持</div>
<div>uuid: {{ item.uuid }}</div>
<div>class: {{ item.class_name }}</div>
<div>category: {{ item.category }}</div>
{% endblock %}
{% if request.user.is_authenticated %}
<div class="item-edit">
<span class="action inline">
<a href="{% url 'catalog:edit' item.url_path item.uuid %}"
title="{% trans '编辑' %}{{ item.demonstrative }}"><i class="fa-solid fa-pen-to-square"></i></a>
</span>
{% if item.last_editor and item.last_editor.preference.show_last_edit %}
<span>
{% trans '最近编辑:' %}
<a href="{% url 'journal:user_profile' item.last_editor.mastodon_username %}">{{ item.last_editor | default:"" }}</a>
</span>
{% endif %}
</div>
{% endif %}
<div class="rating solo-hidden {% if not item.rating %}unavailable{% endif %}">
<div class="display">
<div>
<hgroup>
<h3>
{{ item.rating | floatformat:1 }} <small>/ 10</small>
</h3>
2023-06-10 23:28:56 -04:00
<p>{{ item.rating_count }}个评分</p>
</hgroup>
</div>
<div data-placement="top">
<ul class="chart">
<li data-tooltip="{{ item.rating_dist.0 }}%" data-placement="left">
<span style="height:{{ item.rating_dist.0 }}%"></span>
</li>
<li data-tooltip="{{ item.rating_dist.1 }}%" data-placement="left">
<span style="height:{{ item.rating_dist.1 }}%"></span>
</li>
<li data-tooltip="{{ item.rating_dist.2 }}%" data-placement="left">
<span style="height:{{ item.rating_dist.2 }}%"></span>
</li>
<li data-tooltip="{{ item.rating_dist.3 }}%" data-placement="left">
<span style="height:{{ item.rating_dist.3 }}%"></span>
</li>
<li data-tooltip="{{ item.rating_dist.4 }}%" data-placement="left">
<span style="height:{{ item.rating_dist.4 }}%"></span>
</li>
</ul>
</div>
</div>
<div class="undisplay">
<span>评分人数不足</span>
2022-12-15 17:29:35 -05:00
</div>
</div>
<div class="tag-list solo-hidden">
{% for tag in item.tags %}
<span>
<a href="{% url 'catalog:search' %}?tag={{ tag }}">{{ tag }}</a>
</span>
{% endfor %}
2022-12-15 17:29:35 -05:00
</div>
</section>
{% block left_sidebar %}{% endblock %}
</div>
<div id="item-title-more" class="middle">
<hgroup>
{% if item.subtitle %}<p>{{ item.subtitle }}</p>{% endif %}
{% if item.orig_title %}
<p>
{{ item.orig_title }}
<small>
{% if item.season_number %}Season {{ item.season_number }}{% endif %}
</small>
</p>
{% endif %}
2023-06-06 13:06:03 -04:00
{% if item.parent_item %}
<p>
{% trans '所属' %}{{ item.parent_item.type.label }} <span><a href="{{ item.parent_item.url }}"></span>{{ item.parent_item.title }}</a>
</p>
{% endif %}
{% if item.author or item.translator %}
<p>
<i>
{% include '_people.html' with people=item.author _role='作者' max=2 %}
</i>
&nbsp;&nbsp;
<i>
{% include '_people.html' with people=item.translator role='译者' max=2 %}
</i>
</p>
{% endif %}
</hgroup>
</div>
<div id="item-detail" class="middle">
2023-05-21 11:12:40 -04:00
<section id="item-content">
<h5>简介</h5>
{% if item.brief %}
<p class="tldr" _="on click toggle .tldr on me">{{ item.brief | linebreaksbr }}</p>
{% elif item.parent_item.brief %}
<p class="tldr" _="on click toggle .tldr on me">{{ item.parent_item.brief | linebreaksbr }}</p>
{% else %}
<p class="empty">暂缺</p>
{% endif %}
2023-05-21 11:12:40 -04:00
{% block content %}{% endblock %}
</section>
<section class="solo-hidden">
{% if request.user.is_authenticated %}
<div id="comment-default">
<h5>
短评
<small>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid %}">{% trans '全部标记' %}</a>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid 'following' %}">{% trans '关注的人的标记' %}</a>
</small>
</h5>
<div id="comments">
<div hx-get="{% url 'catalog:comments' item.url_path item.uuid %}"
hx-trigger="intersect once"
hx-swap="outerHTML">
<i class="fa-solid fa-compact-disc fa-spin loading"></i>
</div>
</div>
</div>
{% comment %} {% if item.class_name == "tvseason" %}
<div id="comment-by-episode" style="display: none;">
<h5>
<small>
<a _="on click hide #comment-by-episode then show #comment-default">短评</a>
|
</small>
{% trans '分集短评' %}
<small>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid %}">{% trans '全部标记' %}</a>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid 'following' %}">{% trans '关注的人的标记' %}</a>
</small>
</h5>
<div>
<div hx-get="{% url 'catalog:comments_by_episode' item.url_path item.uuid %}" hx-trigger="intersect once" hx-swap="outerHTML" id="#comments_by_episode">
<i class="fa-solid fa-compact-disc fa-spin loading"></i>
</div>
</div>
</div>
{% endif %} {% endcomment %}
{% else %}
<h5>短评</h5>
<p class="empty">登录后可见</p>
{% endif %}
</section>
<section class="solo-hidden">
<h5>
{% trans '评论' %}
{% comment %}
{% if request.user.is_authenticated %}
<small>
2023-05-20 14:17:02 -04:00
| <a href="{% url 'catalog:review_list' item.url_path item.uuid %}">{% trans '全部评论' %}</a>
</small>
{% endif %}
{% endcomment %}
</h5>
{% if request.user.is_authenticated %}
<div>
<div hx-get="{% url 'catalog:reviews' item.url_path item.uuid %}"
hx-trigger="intersect once"
hx-swap="outerHTML">
<i class="fa-solid fa-compact-disc fa-spin loading"></i>
</div>
</div>
{% else %}
<p class="empty">登录后可见</p>
{% endif %}
</section>
</div>
<div id="item-more" class="middle">
<!-- test more content -->
</div>
<div style="clear: both;display: table;"></div>
</main>
2023-06-09 03:01:17 -04:00
{% include "_footer.html" %}
</body>
2022-12-15 17:29:35 -05:00
</html>