add reply feature to collection and review
This commit is contained in:
parent
407d8fe2a3
commit
433a680f77
7 changed files with 76 additions and 38 deletions
|
@ -33,11 +33,11 @@
|
|||
<hgroup>
|
||||
<h3>
|
||||
<div class="action">
|
||||
<span>
|
||||
{% liked_piece collection as liked %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-heart' %}
|
||||
</span>
|
||||
{% if request.user.is_authenticated %}
|
||||
<span>
|
||||
{% liked_piece collection as liked %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-bookmark' %}
|
||||
</span>
|
||||
<span>{% include '_feature_stats.html' with featured=featured_since %}</span>
|
||||
<span>
|
||||
<a href="#"
|
||||
|
@ -114,19 +114,40 @@
|
|||
hx-trigger="load"></div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="action">
|
||||
{% if request.user.identity == collection.owner %}
|
||||
{% if request.user.is_authenticated %}
|
||||
<span class="action">
|
||||
<span>
|
||||
<a href="{% url 'journal:collection_edit' collection.uuid %}">{% trans '编辑' %}</a>
|
||||
<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>
|
||||
<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 %}
|
||||
</div>
|
||||
<span>创建于 {{ collection.created_time | date }}</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 %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% if liked %}
|
||||
<a class="activated"
|
||||
hx-post="{% url 'journal:unlike' piece.uuid %}?stats=1&icon={{ icon }}&label={{ label }}"
|
||||
{% if request.user.is_authenticated %} hx-post="{% url 'journal:unlike' piece.uuid %}?stats=1&icon={{ icon }}&label={{ label }}" {% endif %}
|
||||
hx-swap="outerHTML"
|
||||
hx-target="this"
|
||||
title="已{{ label|default:'赞' }}">
|
||||
|
@ -10,11 +10,8 @@
|
|||
{% else %}
|
||||
<a hx-swap="outerHTML"
|
||||
hx-target="this"
|
||||
title="{{ label|default:'赞' }}"
|
||||
{% if piece.owner == request.user %} {% if not piece.like_count %} class="hidden" {% else %} class="disabled" {% endif %}
|
||||
{% else %}
|
||||
hx-post="{% url 'journal:like' piece.uuid %}?stats=1&icon={{ icon }}&label={{ label }}"
|
||||
{% endif %}>
|
||||
{% if request.user.is_authenticated %} hx-post="{% url 'journal:like' piece.uuid %}?stats=1&icon={{ icon }}&label={{ label }}" {% endif %}
|
||||
title="{{ label|default:'赞' }}">
|
||||
<i class="fa-regular {{ icon|default:'fa-thumbs-up' }}"></i>
|
||||
{% if piece.like_count %}<span>{{ piece.like_count }}</span>{% endif %}
|
||||
</a>
|
||||
|
|
|
@ -36,14 +36,8 @@
|
|||
<div class="action">
|
||||
<span>
|
||||
{% liked_piece review as liked %}
|
||||
{% include 'like_stats.html' with liked=liked piece=review %}
|
||||
{% include 'like_stats.html' with liked=liked piece=review icon='fa-heart' %}
|
||||
</span>
|
||||
<span>
|
||||
<a target="_blank"
|
||||
rel="noopener"
|
||||
{% if review.shared_link %} href="{{ review.shared_link }}" title="打开联邦宇宙分享链接" {% else %} class="disabled" {% endif %}><i class="fa-solid {% if review.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
|
||||
</span>
|
||||
{% if request.user == review.owner %}{% endif %}
|
||||
</div>
|
||||
{{ review.title }}
|
||||
</h3>
|
||||
|
@ -66,19 +60,45 @@
|
|||
</header>
|
||||
<div class="markdown-content">{{ review.html_content | safe }}</div>
|
||||
<footer>
|
||||
{% if request.user == review.owner %}
|
||||
{% if request.user.is_authenticated %}
|
||||
<span class="action">
|
||||
<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>
|
||||
<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="review-head__time">{{ review.created_time|date }}</span>
|
||||
<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 %}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<div class="action">
|
||||
<span>
|
||||
{% liked_piece collection as liked %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-bookmark' %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-heart' %}
|
||||
</span>
|
||||
<span>
|
||||
<a target="_blank"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<span class="action">
|
||||
<span>
|
||||
{% liked_piece activity.action_object as liked %}
|
||||
{% include 'like_stats.html' with liked=liked piece=activity.action_object label='关注' icon='fa-bookmark' %}
|
||||
{% include 'like_stats.html' with liked=liked piece=activity.action_object label='关注' icon='fa-heart' %}
|
||||
</span>
|
||||
</span>
|
||||
<div class="spacing">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<span class="action">
|
||||
<span>
|
||||
{% liked_piece collection as liked %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-bookmark' %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-heart' %}
|
||||
</span>
|
||||
</span>
|
||||
<div class="spacing">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<span class="action">
|
||||
<span>
|
||||
{% liked_piece collection as liked %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-bookmark' %}
|
||||
{% include 'like_stats.html' with liked=liked piece=collection label='关注' icon='fa-heart' %}
|
||||
</span>
|
||||
</span>
|
||||
<div class="spacing">
|
||||
|
|
Loading…
Add table
Reference in a new issue