lib.itmens/catalog/templates/item_base.html

334 lines
15 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 %}
2022-12-15 17:29:35 -05:00
<!DOCTYPE html>
<html lang="en">
<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.title }}">
2022-12-25 13:45:24 -05:00
<meta property="og:type" content="{{ item.category }}">
2022-12-15 17:29:35 -05:00
<meta property="og:url" content="{{ request.build_absolute_uri }}">
2023-02-10 15:56:13 -05:00
{% if item.has_cover %}
2023-02-10 16:39:58 -05:00
<meta property="og:image" content="{{ item.cover_absolute_url }}">
2023-02-10 15:56:13 -05:00
{% endif %}
2022-12-15 17:29:35 -05:00
<meta property="og:site_name" content="{{ site_name }}">
<meta property="og:description" content="{{ item.brief }}">
2023-01-31 21:21:50 -05:00
{% block head %}
2022-12-25 13:45:24 -05:00
{% endblock %}
2022-12-15 17:29:35 -05:00
<title>{{ site_name }} - {% trans item.category.label %} | {{ item.title }}</title>
{% include "common_libs.html" with jquery=0 %}
2022-12-15 17:29:35 -05:00
</head>
<body>
<div id="page-wrapper">
<div id="content-wrapper">
{% include "partial/_navbar.html" %}
<section id="content">
<div class="grid">
<div class="grid__main" id="main">
<div class="main-section-wrapper">
<div class="entity-detail">
2023-02-11 23:23:21 -05:00
<a href="{{ item.cover.url }}" class="entity-detail__img-origin" target="_blank" rel="noopener" title="{% trans '查看原图' %}">
2022-12-15 17:29:35 -05:00
<img src="{{ item.cover|thumb:'normal' }}" class="entity-detail__img" alt="{{ item.title }}">
</a>
<div class="entity-detail__info">
2023-01-23 16:31:30 -05:00
{% if item.is_deleted %}
[DELETED]
{% endif %}
{% if item.merged_to_item %}
2023-01-29 20:05:30 -05:00
[MERGED <a href="{{ item.merged_to_item.url }}">{{ item.merged_to_item.title }}</a>]
2023-01-23 16:31:30 -05:00
{% endif %}
2022-12-16 01:08:10 -05:00
{% block title %}
2022-12-15 17:29:35 -05:00
<h5 class="entity-detail__title">
{{ item.title }}
{% for res in item.external_resources.all %}
<a href="{{ res.url }}">
<span class="source-label source-label__{{ res.site_name }}">{{ res.site_name.label }}</span>
</a>
{% endfor %}
</h5>
2022-12-16 01:08:10 -05:00
{% endblock %}
2022-12-15 17:29:35 -05:00
{% block details %}
<div class="entity-detail__fields">
<div class="entity-detail__rating">
{% if item.rating %}
2022-12-31 00:20:20 -05:00
<span class="entity-detail__rating-star rating-star" data-rating-score="{{ item.rating | floatformat:0 }}"></span>
<span class="entity-detail__rating-score"> {{ item.rating | floatformat:1 }} </span>
2022-12-15 17:29:35 -05:00
<small>({{ item.rating_count }}人评分)</small>
{% else %}
<span> {% trans '评分:评分人数不足' %}</span>
{% endif %}
</div>
2023-01-29 20:05:30 -05:00
<div>此类数据尚未支持</div>
2022-12-17 23:03:19 -05:00
<div>uuid: {{item.uuid}}</div>
2022-12-15 17:29:35 -05:00
<div>class: {{item.class_name}}</div>
<div>category: {{item.category}}</div>
</div>
{% endblock %}
<div class="tag-collection">
{% for tag in item.tags %}
<span class="tag-collection__tag">
<a href="{% url 'catalog:search' %}?tag={{ tag }}">{{ tag }}</a>
2022-12-15 17:29:35 -05:00
</span>
{% endfor %}
</div>
</div>
</div>
<div class="dividing-line"></div>
{% if item.brief %}
<div class="entity-desc" id="description">
<h5 class="entity-desc__title">{% trans '简介' %}</h5>
<p class="entity-desc__content">{{ item.brief | linebreaksbr }}</p>
<div class="entity-desc__unfold-button entity-desc__unfold-button--hidden">
<a href="javascript:void(0);">展开全部</a>
</div>
2023-01-29 20:05:30 -05:00
</div>
2022-12-16 01:08:10 -05:00
{% endif %}
{% block content %}
{% if item.contents %}
<div class="entity-desc" id="contents">
<h5 class="entity-desc__title">{% trans '目录' %}</h5>
<p class="entity-desc__content">{{ item.contents | linebreaksbr }}</p>
<div class="entity-desc__unfold-button entity-desc__unfold-button--hidden">
<a href="javascript:void(0);">展开全部</a>
</div>
</div>
{% endif %}
{% if item.track_list %}
<div class="entity-desc" id="description">
<h5 class="entity-desc__title">{% trans '曲目' %}</h5>
<p class="entity-desc__content">{{ item.track_list | linebreaksbr }}</p>
<div class="entity-desc__unfold-button entity-desc__unfold-button--hidden">
<a href="javascript:void(0);">展开全部</a>
</div>
</div>
{% endif %}
{% endblock %}
2022-12-15 17:29:35 -05:00
<div class="entity-marks">
<h5 class="entity-marks__title">{% trans '标记' %}</h5>
2022-12-24 01:28:24 -05:00
{% if mark_list %}
<a href="{% url 'catalog:mark_list' item.url_path item.uuid %}" class="entity-marks__more-link">{% trans '全部标记' %}</a>
<a href="{% url 'catalog:mark_list' item.url_path item.uuid 'following' %}" class="entity-marks__more-link">关注的人的标记</a>
{% endif %}
2023-01-23 16:31:30 -05:00
2022-12-24 01:28:24 -05:00
<ul class="entity-marks__mark-list">
{% for others_mark in mark_list %}
<li class="entity-marks__mark">
<a href="{% url 'journal:user_profile' others_mark.owner.mastodon_username %}" class="entity-marks__owner-link">{{ others_mark.owner.username }}</a>
2022-12-24 01:28:24 -05:00
2023-02-04 10:56:14 -05:00
<span>{{ others_mark.action_label }}</span>
2022-12-24 01:28:24 -05:00
{% if others_mark.rating %}
<span class="entity-marks__rating-star rating-star" data-rating-score="{{ others_mark.rating }}"></span>
{% endif %}
{% if others_mark.visibility > 0 %}
<i class="fa-solid fa-lock"></i>
2022-12-24 01:28:24 -05:00
{% endif %}
{% if others_mark.shelfmember.metadata.shared_link %}
2023-02-11 23:23:21 -05:00
<a href="{{ others_mark.shelfmember.metadata.shared_link }}" target="_blank" rel="noopener"><span class="entity-marks__mark-time">{{ others_mark.created_time | date }}</span></a>
2022-12-24 01:28:24 -05:00
{% else %}
2023-01-10 22:36:13 -05:00
<span class="entity-marks__mark-time">{{ others_mark.created_time | date }}</span>
2022-12-24 01:28:24 -05:00
{% endif %}
{% if others_mark.text %}
<p class="entity-marks__mark-content">{{ others_mark.comment_html|safe }}
<span class="action-bar inline">
<span>
{% liked_piece others_mark.shelfmember as liked %}
{% include 'like_stats.html' with liked=liked piece=others_mark.shelfmember %}
</span>
</span>
</p>
2022-12-24 01:28:24 -05:00
{% endif %}
</li>
{% empty %}
<div> {% trans '暂无标记' %} </div>
{% endfor %}
</ul>
2022-12-15 17:29:35 -05:00
</div>
<div class="entity-reviews">
<h5 class="entity-reviews__title">{% trans '评论' %}</h5>
2022-12-24 01:28:24 -05:00
{% if review_list %}
<a href="{% url 'catalog:review_list' item.url_path item.uuid %}" class="entity-reviews__more-link">{% trans '全部评论' %}</a>
2022-12-15 17:29:35 -05:00
{% endif %}
{% if review_list %}
<ul class="entity-reviews__review-list">
{% for others_review in review_list %}
<li class="entity-reviews__review">
<a href="{% url 'journal:user_profile' others_review.owner.mastodon_username %}" class="entity-reviews__owner-link">{{ others_review.owner.username }}</a>
2022-12-15 17:29:35 -05:00
{% if others_review.visibility > 0 %}
<i class="fa-solid fa-lock"></i>
2022-12-15 17:29:35 -05:00
{% endif %}
<span class="entity-reviews__review-time">{{ others_review.created_time | date }}</span>
2022-12-24 01:28:24 -05:00
<span class="entity-reviews__review-title"> <a href="{% url 'journal:review_retrieve' others_review.uuid %}">{{ others_review.title }}</a></span>
<span class="action-bar inline">
<span>
{% liked_piece others_review as liked %}
{% include 'like_stats.html' with liked=liked piece=others_review %}
</span>
</span>
2022-12-15 17:29:35 -05:00
<span>{{ others_review.get_plain_content | truncate:100 }}</span>
</li>
{% endfor %}
</ul>
{% else %}
<div>{% trans '暂无评论' %}</div>
{% endif %}
</div>
</div>
</div>
<div class="grid__aside" id="aside">
{% block sidebar_review %}
2023-01-08 23:28:19 -05:00
{% if user.is_authenticated %}
2022-12-15 17:29:35 -05:00
<div class="aside-section-wrapper">
{% if mark.shelf_type %}
<div class="mark-panel">
2022-12-16 01:08:10 -05:00
<span class="mark-panel__status">{% trans '我' %}{% trans mark.shelf_label %}</span>
2022-12-15 17:29:35 -05:00
{% if mark.rating %}
2022-12-23 00:08:42 -05:00
<span class="mark-panel__rating-star rating-star" data-rating-score="{{ mark.rating | floatformat:'0' }}"></span>
2022-12-15 17:29:35 -05:00
{% endif %}
{% if mark.visibility > 0 %}
<i class="fa-solid fa-lock"></i>
2022-12-15 17:29:35 -05:00
{% endif %}
<span class="mark-panel__actions">
2022-12-23 00:08:42 -05:00
<a href="#" hx-get="{% url 'journal:mark' item.uuid %}" class="edit" hx-target="body" hx-swap="beforeend">{% trans '修改' %}</a>
2022-12-25 13:45:24 -05:00
<form id="mark_delete" action="{% url 'journal:mark' item.uuid %}" method="post">
2022-12-15 17:29:35 -05:00
{% csrf_token %}
2022-12-25 13:45:24 -05:00
<input type="hidden" name="delete" value="1">
<a href="javascript:$('#mark_delete').submit()" class="delete">{% trans '删除' %}</a>
2022-12-15 17:29:35 -05:00
</form>
</span>
<div class="mark-panel__clear"></div>
2022-12-23 00:08:42 -05:00
<div class="mark-panel__time">
2023-01-10 22:36:13 -05:00
<!-- <div>
{% for log in mark.logs %}
{{ log.timestamp|date }} {{ log.action_label }}<br>
{% endfor %}
</div> -->
2022-12-23 00:08:42 -05:00
{% if mark.metadata.shared_link %}
2023-01-10 22:36:13 -05:00
<a href="{{ mark.metadata.shared_link }}">{{ mark.created_time|date }}</a>
2022-12-23 00:08:42 -05:00
{% else %}
2023-01-10 22:36:13 -05:00
{{ mark.created_time|date }}
2022-12-23 00:08:42 -05:00
{% endif %}
</div>
2022-12-15 17:29:35 -05:00
{% if mark.text %}
2023-01-31 10:24:57 -05:00
<p class="mark-panel__text">{{ mark.comment_html|safe }}</p>
2022-12-15 17:29:35 -05:00
{% endif %}
<div class="tag-collection">
{% for tag in mark.tags %}
<span class="tag-collection__tag"><a href="{% url 'journal:user_tag_member_list' user.mastodon_username tag %}">{{ tag }}</a></span>
2022-12-15 17:29:35 -05:00
{% endfor %}
</div>
</div>
{% else %}
<div class="action-panel" id="addMarkPanel">
<div class="action-panel__label">{% trans '标记' %}{% trans item.demonstrative %}</div>
<div class="action-panel__button-group">
2022-12-25 13:45:24 -05:00
{% for k, v in shelf_types %}
2023-02-15 23:45:12 -05:00
{% if v %}
2022-12-25 13:45:24 -05:00
<button class="action-panel__button" data-status="{{ k }}" hx-get="{% url 'journal:mark' item.uuid %}?shelf_type={{ k }}" class="edit" hx-target="body" hx-swap="beforeend">{% trans v %}</button>
2023-02-15 23:45:12 -05:00
{% endif %}
2022-12-25 13:45:24 -05:00
{% endfor %}
2022-12-15 17:29:35 -05:00
</div>
</div>
{% endif %}
</div>
<div class="aside-section-wrapper">
2022-12-25 13:45:24 -05:00
<div class="review-panel action-panel">
{% if review %}
2022-12-15 17:29:35 -05:00
<span class="review-panel__label">{% trans '我的评论' %}</span>
{% if review.visibility > 0 %}
<i class="fa-solid fa-lock"></i>
2022-12-15 17:29:35 -05:00
{% endif %}
<span class="review-panel__actions">
2022-12-25 13:45:24 -05:00
<a href="{% url 'journal:review_edit' item.uuid review.uuid %}">{% trans '编辑' %}</a>
2022-12-29 14:30:31 -05:00
<a href="{% url 'journal:review_delete' review.uuid %}?return_url={{ item.url }}">{% trans '删除' %}</a>
2022-12-15 17:29:35 -05:00
</span>
<div class="review-panel__time">{{ review.edited_time }}</div>
2022-12-24 01:28:24 -05:00
<a href="{% url 'journal:review_retrieve' review.uuid %}" class="review-panel__review-title">
2022-12-15 17:29:35 -05:00
{{ review.title }}
</a>
2022-12-25 13:45:24 -05:00
{% else %}
2022-12-15 17:29:35 -05:00
<div class="action-panel__button-group action-panel__button-group--center">
2022-12-25 13:45:24 -05:00
<a href="{% url 'journal:review_create' item.uuid %}">
<button class="action-panel__button">{% trans '撰写评论' %}</button>
2022-12-15 17:29:35 -05:00
</a>
</div>
2022-12-25 13:45:24 -05:00
{% endif %}
2022-12-15 17:29:35 -05:00
</div>
</div>
2023-01-08 23:28:19 -05:00
{% else %}
<div class="aside-section-wrapper">
<div class="mark-panel">
<span>{% trans '登录后可管理标记和评论' %}</span>
</div>
</div>
{% endif %}
2022-12-15 17:29:35 -05:00
{% endblock %}
{% block sidebar %}
{% endblock %}
{% block sidebar_collection %}
<div class="aside-section-wrapper">
<div class="action-panel">
<div class="action-panel__label">{% trans '相关收藏单' %}</div>
<div >
2022-12-23 00:08:42 -05:00
{% if collection_list %}
2022-12-15 17:29:35 -05:00
{% for c in collection_list %}
<p>
2022-12-28 01:09:55 -05:00
<a href="{{ c.url }}">{{ c.title }}</a>
2022-12-15 17:29:35 -05:00
</p>
{% endfor %}
2022-12-23 00:08:42 -05:00
{% endif %}
{% if request.user.is_authenticated %}
2022-12-15 17:29:35 -05:00
<div class="action-panel__button-group action-panel__button-group--center">
2022-12-23 00:08:42 -05:00
<button class="action-panel__button add-to-list" hx-get="{% url 'journal:add_to_collection' item.uuid %}" hx-target="body" hx-swap="beforeend">{% trans '添加到收藏单' %}</button>
2022-12-15 17:29:35 -05:00
</div>
2022-12-23 00:08:42 -05:00
{% endif %}
2022-12-15 17:29:35 -05:00
</div>
</div>
</div>
{% endblock %}
</div>
</div>
</section>
</div>
{% include "partial/_footer.html" %}
</div>
</body>
</html>