lib.itmens/journal/templates/review.html
2023-12-29 22:27:28 -05:00

122 lines
4.6 KiB
HTML

{% load static %}
{% load i18n %}
{% load admin_url %}
{% load mastodon %}
{% load oauth_token %}
{% load truncate %}
{% load thumb %}
{% load user_actions %}
{% load duration %}
<!DOCTYPE html>
<html lang="zh" class="content-page">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="CCBot" content="nofollow">
<meta property="og:title"
content="{{ site_name }} - {{ review.title }} ({{ review.item.title }} {% trans '评论' %})">
<meta property="og:type" content="article">
<meta property="og:article:author"
content="{{ review.owner.display_name }}">
<meta property="og:url" content="{{ request.build_absolute_uri }}">
<meta property="og:image" content="{{ review.item.cover|thumb:'normal' }}">
<meta property="og:site_name" content="{{ site_name }}">
{% if not identity.anonymous_viewable %}<meta name="robots" content="noindex">{% endif %}
<title>{{ site_name }}{% trans '评论' %} - {{ review.title }}</title>
{% include "common_libs.html" with jquery=0 v2=1 %}
</head>
<body>
{% include "_header.html" %}
<main>
<div>
<article>
<header>
<hgroup>
<h3>
<div class="action">
{% if review.latest_post %}
{% include "action_like_post.html" with post=review.latest_post %}
{% include "action_boost_post.html" with post=review.latest_post %}
{% endif %}
</div>
{{ review.title }}
</h3>
</hgroup>
<div class="owner-info">
<div class="owner">
<span class="avatar">
<img src="{{ review.owner.avatar }}" alt="{{ review.owner.display_name }}">
</span>
</div>
<div class="info">
<a href="{{ review.owner.url }}">{{ review.owner.display_name }}</a>
<span class="handler">@{{ review.owner.handler }}</span>
<br>
评论
<a href="{{ review.item.url }}">{{ review.item.title }}</a>
{% if review.rating_grade %}{{ review.rating_grade | rating_star }}{% endif %}
</div>
</div>
</header>
<div class="markdown-content">
{% if request.user.is_authenticated or review.owner.anonymous_viewable %}
{{ review.html_content | safe }}
{% else %}
<p class="empty">
<span>作者已设置为<a href="{% url 'users:login' %}?next={{ request.path }}">登录</a>后可查看</span>
</p>
{% endif %}
</div>
<footer>
{% if request.user.is_authenticated %}
<span class="action">
<span>
<a hx-get="{% url 'journal:piece_replies' review.uuid %}"
hx-swap="outerHTML"
hx-trigger="click once"
hx-target="#replies_{{ review.latest_post.pk }}">
{{ review.latest_post.stats.replies | default:'' }}
回应
</a>
</span>
{% if request.user.identity == review.owner %}
<span>
<a href="{% url 'journal:review_edit' review.item.uuid review.uuid %}">{% trans '编辑' %}</a>
</span>
<span>
<a href="{% url 'journal:review_delete' review.uuid %}">{% trans '删除' %}</a>
</span>
{% endif %}
</span>
{% endif %}
<span class="action inline">
<span>
<a target="_blank"
rel="noopener"
href="{{ review.shared_link }}"
title="打开联邦宇宙分享链接"><i class="fa-solid {% if review.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
</span>
<span><a>{{ review.created_time|date }}</a></span>
</span>
</footer>
</article>
<style>
main>div>.replies {
padding-top: 2em
}
</style>
<section id="replies_{{ review.latest_post.pk }}">
</section>
</div>
<aside>
{% include "_sidebar_item.html" with item=review.item %}
</aside>
</main>
<script>
$(".spoiler").on('click', function(){
$(this).toggleClass('revealed');
})
</script>
{% include "_footer.html" %}
</body>
</html>