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

157 lines
6.6 KiB
HTML

{% load static %}
{% load i18n %}
{% load l10n %}
{% load humanize %}
{% load admin_url %}
{% load mastodon %}
{% load oauth_token %}
{% load truncate %}
{% load thumb %}
{% load collection %}
{% load user_actions %}
<!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 property="og:title"
content="{{ site_name }}{% trans '收藏单' %} - {{ collection.title }}">
<meta property="og:description" content="{{ collection.description }}">
<meta property="og:type" content="article">
<meta property="og:article:author"
content="{{ collection.owner.display_name }}">
<meta property="og:url" content="{{ request.build_absolute_uri }}">
<meta property="og:image" content="{{ collection.cover|thumb:'normal' }}">
<title>{{ site_name }} {% trans '收藏单' %} - {{ collection.title }}</title>
{% include "common_libs.html" with jquery=0 v2=1 %}
</head>
<body>
{% include "_header.html" %}
<main>
<div class="grid__main">
<section>
<hgroup>
<h3>
<div class="action">
{% if request.user.is_authenticated %}
<span>{% include '_feature_stats.html' with featured=featured_since %}</span>
<span>
<a href="#"
hx-get="{% url 'journal:collection_share' collection.uuid %}"
hx-target="body"
hx-swap="beforeend"
title="分享到联邦宇宙"><i class="fa-solid fa-share-nodes"></i></a>
</span>
{% endif %}
{% if collection.latest_post %}
{% include "action_like_post.html" with post=collection.latest_post %}
{% include "action_boost_post.html" with post=collection.latest_post %}
{% endif %}
</div>
{{ collection.title }}
{% if collection.visibility > 0 %}<small><i class="fa-solid fa-lock"></i></small>{% endif %}
</h3>
</hgroup>
<div class="owner-info">
<div class="owner">
<span class="avatar">
<img src="{{ collection.owner.avatar }}"
alt="{{ collection.owner.display_name }}">
</span>
</div>
<div class="info">
<p>
<a href="{{ collection.owner.url }}">{{ collection.owner.mastodon_account.display_name }}</a>
<span class="handler">@{{ collection.owner.handler }}</span>
</p>
<p>
{% for cat, count in collection.get_summary.items %}
{% if count %}<span>{{ count }} {{ cat|prural_items }}</span>&nbsp;&nbsp;{% endif %}
{% endfor %}
</p>
{% if featured_since %}
<p>
<progress value="{{ stats.percentage }}"
max="100"
title="{{ stats.percentage }}%" />
</p>
{% endif %}
<div class="markdown-content">{{ collection.html | safe }}</div>
</div>
<div class="more">
<div style="text-align: center;">
<img src="{{ collection.cover|thumb:'normal' }}" alt="">
</div>
</div>
</div>
</section>
{% comment %}
{% if featured_since %}
<section style="min-width:10vw;">
<div class="donut" style="background: conic-gradient(#7CBDFE 0deg {{ stats.complete_deg }}deg, #B4D2A5 {{ stats.complete_deg }}deg {{ stats.complete_deg|add:stats.progress_deg }}deg, #ccc {{ stats.complete_deg|add:stats.progress_deg }}deg 1deg );"><div class="hole"><div class="text">
{% if stats.progress %}
{{ stats.progress }} 进行中<br>
{% endif %}
{% if stats.complete %}
{{ stats.complete }} 已完成
{% elif not stats.progress %}
尚未开始
{% endif %}
</div></div></div>
<div style="margin:8px; color:lightgray" class="muted">
开始于{{ featured_since|date }}
<a class="muted" href="#" title="停止" onclick="if (confirm('停止这个目标吗?')) $('#stop-featured').submit();"><i class="fa-solid fa-ban"></i></a>
<form action="{% url 'journal:collection_remove_featured' collection.uuid %}" method="post" id="stop-featured">
{% csrf_token %}
</form>
</div>
</section>
{% endif %}
{% endcomment %}
<section>
<div class="entity-list"
hx-get="{% url 'journal:collection_retrieve_items' collection.uuid %}"
hx-trigger="load"></div>
</section>
<section>
{% if request.user.is_authenticated %}
<span class="action">
<span>
<a hx-get="{% url 'journal:piece_replies' collection.uuid %}"
hx-swap="outerHTML"
hx-trigger="click once"
hx-target="#replies_{{ collection.latest_post.pk }}">
{{ collection.latest_post.stats.replies | default:'' }}
回应
</a>
</span>
{% if request.user.identity == collection.owner %}
<span>
<a href="{% url 'journal:collection_edit' collection.uuid %}">{% trans '编辑' %}</a>
</span>
<span>
<a href="{% url 'journal:collection_delete' collection.uuid %}">{% trans '删除' %}</a>
</span>
{% elif editable %}
<a href="{% url 'journal:collection_edit' collection.uuid %}">{% trans '协助整理' %}</a>
{% endif %}
</span>
{% endif %}
<span class="action inline">
<span>
<a target="_blank"
rel="noopener"
href="{{ collection.shared_link }}"
title="打开联邦宇宙分享链接"><i class="fa-solid {% if collection.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
</span>
<span><a>创建于 {{ collection.created_time|date }}</a></span>
</span>
</section>
<section id="replies_{{ collection.latest_post.pk }}">
</section>
</div>
{% include "_sidebar.html" with identity=collection.owner show_profile=1 %}
</main>
{% include "_footer.html" %}
</body>
</html>