lib.itmens/catalog/templates/item_base.html
2024-04-06 11:55:23 -04:00

277 lines
11 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="{{ item.absolute_url }}">
{% 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" %}
{% 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_label }}</a>
{% endfor %}
</span>
</div>
<div id="item-cover" class="left">
<img src="{{ item.cover_image_url|default:item.cover.url|relative_uri }}"
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_actions %}
{% if v and k != 'dropped' %}
<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 %}
{% include "_item_user_pieces.html" %}
{% else %}
<section>
<p class="empty">
<span><a href="{% url 'users:login' %}?next={{ request.path }}">登录</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 '编辑这个条目' %}"><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="{{ item.last_editor.url }}">{{ item.last_editor.display_name | 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>
<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 solo-hidden">
{% 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 class="solo-hidden">
<div>
<h5>
短评
<small>
{% if request.user.is_authenticated %}
| <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>
{% endif %}
</small>
</h5>
<div id="comments">
<div hx-swap="outerHTML"
hx-get="{% if request.GET.focus and item.class_name == "tvseason" %}{% url 'catalog:comments_by_episode' item.url_path item.uuid %}?episode_uuid={{ request.GET.focus }}{% else %}{% url 'catalog:comments' item.url_path item.uuid %}{% endif %}"
hx-trigger="intersect once">
<i class="fa-solid fa-compact-disc fa-spin loading"></i>
</div>
</div>
</div>
</section>
<section class="solo-hidden">
<h5>{% trans '评论' %}</h5>
<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>
</section>
</div>
<div id="item-more" class="middle">
<!-- test more content -->
</div>
<div style="clear: both;display: table;"></div>
</main>
{% include "_footer.html" %}
</body>
</html>