lib.itmens/catalog/templates/item_base.html
2023-06-09 03:07:26 -04:00

420 lines
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% 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 %}
<!DOCTYPE html>
<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"
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 %}
<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>
{{ 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">
<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">
<div class="item-action item-mark-buttons">
{% for k, v in shelf_types %}
{% if v %}
<button class="primary"
data-status="{{ k }}"
hx-get="{% url 'journal:mark' item.uuid %}?shelf_type={{ k }}"
hx-target="body"
hx-swap="beforeend">{% trans v %}</button>
{% endif %}
{% endfor %}
</div>
<div class="tv-tip" style="display:none;">
这是全剧条目,以下是可标记的单季
{% 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 %}
</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"
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>
</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="#"
hx-get="{% url 'journal:mark' item.uuid %}"
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>
{% 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>
</span>
{% endfor %}
</div>
</section>
<section>
<h5>
我的短评
<small>
<a href="#"
hx-get="{% url 'journal:mark' item.uuid %}"
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 %}
</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>
{% 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 %}
<a href="{% url 'journal:review_edit' item.uuid review.uuid %}"
class="item-mark-icon">
<i class="fa-solid fa-pen-to-square"></i>
</a>
{% else %}
<a href="{% url 'journal:review_create' item.uuid %}"
class="item-mark-icon">
<i class="fa-regular fa-square-plus"></i>
</a>
{% 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>
{% else %}
<!-- <span class="empty">暂无</span> -->
{% endif %}
</section>
<section>
<h5>
我的收藏单
<small>
<a href="#"
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 %}
</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{% if not item.rating %} unavailable{% endif %}">
<div class="display">
<div>
<hgroup>
<h3>
{{ item.rating | floatformat:1 }} <small>/ 10</small>
</h3>
<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>
</div>
</div>
<div class="tag-list">
{% for tag in item.tags %}
<span>
<a href="{% url 'catalog:search' %}?tag={{ tag }}">{{ tag }}</a>
</span>
{% endfor %}
</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 %}
{% 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">
<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 %}
{% block content %}{% endblock %}
</section>
<section>
<h5>
短评
{% if request.user.is_authenticated %}
<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' %}">关注的人的标记</a>
</small>
{% endif %}
</h5>
{% if request.user.is_authenticated %}
<div>
<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>
{% else %}
<p class="empty">登录后可见</p>
{% endif %}
</section>
<section class="entity-reviews">
<h5>
{% trans '评论' %}
{% comment %}
{% if request.user.is_authenticated %}
<small>
| <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>
{% include "partial/_footer.html" %}
</body>
</html>