Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Одна форма отправки ответов к комментариям #1216

Merged
merged 6 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions frontend/html/comments/forms/reply.html

This file was deleted.

4 changes: 0 additions & 4 deletions frontend/html/comments/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@
{% else %}
{% include "comments/types/normal.html" with comment=tree.comment replies=tree.replies %}
{% endif %}

{% if post.is_commentable and me %}
{% include "comments/forms/reply.html" with comment=tree.comment reply_form=reply_form %}
{% endif %}
{% endfor %}
113 changes: 54 additions & 59 deletions frontend/html/comments/types/battle.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,66 @@
{% load text_filters %}
{% load battle %}
{% load posts %}
<div class="battle-comment-prefix battle-comment-prefix-side-{{ comment.metadata.battle.side }}">
за «{{ comment.battle_side }}»
</div>
<div class="block comment comment-type-battle comment-type-battle-side-{{ comment.metadata.battle.side }}" id="comment-{{ comment.id }}">
<div class="comment-header">
<div class="comment-title">{{ comment.title | rutypography }}</div>
<div class="comment-type-battle-userinfo">
{% include "users/widgets/tiny.html" with user=comment.author %}
<div class="battle-comments-list" id="comment-{{ comment.id }}">
<div class="battle-comment-prefix battle-comment-prefix-side-{{ comment.metadata.battle.side }}">
за «{{ comment.battle_side }}»
</div>
<div class="block comment comment-type-battle comment-type-battle-side-{{ comment.metadata.battle.side }}">
<div class="comment-header">
<div class="comment-title">{{ comment.title | rutypography }}</div>
<div class="comment-type-battle-userinfo">
{% include "users/widgets/tiny.html" with user=comment.author %}

<a href="#comment-{{ comment.id }}" class="reply-date">
{{ comment.created_at | cool_date }}
</a>
<a href="#comment-{{ comment.id }}" class="reply-date">
{{ comment.created_at | cool_date }}
</a>
</div>
</div>
</div>
<div class="comment-rating">
<comment-upvote :initial-upvotes="{{ comment.upvotes }}"
:hours-to-retract-vote="{{settings.RETRACT_VOTE_IN_HOURS}}"
upvote-url="{% url "upvote_comment" comment.id %}"
retract-vote-url="{% url "retract_comment_vote" comment.id %}"
{% if comment.is_voted %}
initial-is-voted
initial-upvote-timestamp="{{comment.upvoted_at}}"
{% endif %}
{% if not me|can_upvote_comment:comment or upvote_disabled %}is-disabled{% endif %}>
</comment-upvote>
<div class="comment-rating">
<comment-upvote :initial-upvotes="{{ comment.upvotes }}"
:hours-to-retract-vote="{{settings.RETRACT_VOTE_IN_HOURS}}"
upvote-url="{% url "upvote_comment" comment.id %}"
retract-vote-url="{% url "retract_comment_vote" comment.id %}"
{% if comment.is_voted %}
initial-is-voted
initial-upvote-timestamp="{{comment.upvoted_at}}"
{% endif %}
{% if not me|can_upvote_comment:comment or upvote_disabled %}is-disabled{% endif %}>
</comment-upvote>

{% if comment.is_pinned %}
<div class="comment-pinned-icon"><i class="fas fa-thumbtack"></i></div>
{% endif %}
</div>
<div class="comment-body thread-collapse-toggle">
<div class="text-body text-body-type-comment">
{% render_comment comment %}
{% if comment.is_pinned %}
<div class="comment-pinned-icon"><i class="fas fa-thumbtack"></i></div>
{% endif %}
</div>
</div>
<div class="comment-footer thread-collapse-toggle">
{% if me.id == comment.author_id or me.id == comment.post.author_id or me.is_moderator %}
{% if comment.is_deleted %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Восстанавливаем?')"><i class="fas fa-trash-restore"></i></a>
{% else %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Удаляем?')"><i class="fas fa-trash"></i></a>
<div class="comment-body thread-collapse-toggle">
<div class="text-body text-body-type-comment">
{% render_comment comment %}
</div>
</div>
<div class="comment-footer thread-collapse-toggle">
{% if me.id == comment.author_id or me.id == comment.post.author_id or me.is_moderator %}
{% if comment.is_deleted %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Восстанавливаем?')"><i class="fas fa-trash-restore"></i></a>
{% else %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Удаляем?')"><i class="fas fa-trash"></i></a>
{% endif %}
{% endif %}
{% endif %}

{% if me.id == comment.author_id or me.is_moderator %}
<a href="{% url "edit_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover"><i class="fas fa-edit"></i></a>
{% endif %}

{% if me and me.is_active_membership and comment.post.is_commentable %}
<span class="comment-footer-button" v-on:click="showReplyForm('{{ comment.id }}', '', true)"><i class="fas fa-reply"></i>&nbsp;ответить</span>
{% endif %}
</div>
</div>

<div class="clearfix"></div>

{% if replies %}
<div class="replies replies-indent-normal">
{% for reply_tree in replies %}
{% include "comments/types/reply.html" with comment=reply_tree.comment reply_to=reply_tree.comment replies=reply_tree.replies %}
{% if me.id == comment.author_id or me.is_moderator %}
<a href="{% url "edit_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover"><i class="fas fa-edit"></i></a>
{% endif %}

{% if post.is_commentable and me %}
{% include "comments/forms/reply.html" with comment=reply_tree.comment reply_form=reply_form %}
{% if me and me.is_active_membership and comment.post.is_commentable %}
<span class="comment-footer-button" v-on:click="showReplyForm('{{ comment.id }}', '', true)"><i class="fas fa-reply"></i>&nbsp;ответить</span>
{% endif %}
{% endfor %}
</div>
</div>
<div class="clearfix20"></div>
{% endif %}

{% if replies %}
<div class="replies replies-type-battle replies-indent-normal">
{% for reply_tree in replies %}
{% include "comments/types/reply.html" with comment=reply_tree.comment reply_to=reply_tree.comment replies=reply_tree.replies %}
{% endfor %}
</div>
{% endif %}
</div>
182 changes: 89 additions & 93 deletions frontend/html/comments/types/bold.html
Original file line number Diff line number Diff line change
@@ -1,111 +1,107 @@
{% load text_filters %}
{% load posts %}
{% load comments %}
<div class="block comment comment-layout-block {% if comment.metadata.badges %}comment-is-badged{% endif %}" id="comment-{{ comment.id }}">
<div class="comment-side">
<a class="avatar comment-side-avatar" href="{% url "profile" comment.author.slug %}">
<img src="{{ comment.author.get_avatar }}" alt="Аватар {{ comment.author.full_name }}" loading="lazy" />
</a>
</div>
<div class="comment-header">
<span class="comment-header-author-and-date">
<span class="comment-header-author">
<a
href="{% url "profile" comment.author.slug %}"
data-author-slug="{{ comment.author.slug }}"
class="comment-header-author-name"
>
{{ comment.author.full_name }}
</a>
{% if comment.author_id in user_notes %}
<span class="comment-header-author-note">{{ user_notes|lookup:comment.author_id|truncatechars:128 }}</span>
{% else %}
<span class="comment-header-author-position">{{ comment.author.position }}</span>
{% endif %}
{% if comment.author.hat %}{% include "users/widgets/hat.html" with hat=comment.author.hat %}{% endif %}
{% if comment.author == post.author %}{% include "users/widgets/hat_author.html" %}{% endif %}

{% if me and comment.author_id != me.id and not comment.author.deleted_at %}
<a href="{% url "create_badge_for_comment" comment.id %}">
<span class="comment-badge-button"><i class="fas fa-gift"></i></span>
<div id="comment-{{ comment.id }}">
<div class="block comment comment-layout-block {% if comment.metadata.badges %}comment-is-badged{% endif %}">
<div class="comment-side">
<a class="avatar comment-side-avatar" href="{% url "profile" comment.author.slug %}">
<img src="{{ comment.author.get_avatar }}" alt="Аватар {{ comment.author.full_name }}" loading="lazy" />
</a>
</div>
<div class="comment-header">
<span class="comment-header-author-and-date">
<span class="comment-header-author">
<a
href="{% url "profile" comment.author.slug %}"
data-author-slug="{{ comment.author.slug }}"
class="comment-header-author-name"
>
{{ comment.author.full_name }}
</a>
{% endif %}
</span>
{% if comment.author_id in user_notes %}
<span class="comment-header-author-note">{{ user_notes|lookup:comment.author_id|truncatechars:128 }}</span>
{% else %}
<span class="comment-header-author-position">{{ comment.author.position }}</span>
{% endif %}
{% if comment.author.hat %}{% include "users/widgets/hat.html" with hat=comment.author.hat %}{% endif %}
{% if comment.author == post.author %}{% include "users/widgets/hat_author.html" %}{% endif %}

<a class="comment-header-date" href="{% url "show_post" comment.post.type comment.post.slug %}#comment-{{ comment.id }}">
{{ comment.created_at | cool_date }}
</a>
</span>
{% if me and comment.author_id != me.id and not comment.author.deleted_at %}
<a href="{% url "create_badge_for_comment" comment.id %}">
<span class="comment-badge-button"><i class="fas fa-gift"></i></span>
</a>
{% endif %}
</span>

<div class="comment-header-badges">
{% if comment.metadata.badges %}
<div class="comment-badges">
{% include "badges/widgets/badges.html" with badges=comment.metadata.badges %}
</div>
<a class="comment-header-date" href="{% url "show_post" comment.post.type comment.post.slug %}#comment-{{ comment.id }}">
{{ comment.created_at | cool_date }}
</a>
</span>

{% if me and comment.author_id != me.id and not comment.author.deleted_at %}
<a class="comment-badge-button" href="{% url "create_badge_for_comment" comment.id %}">
<i class="fas fa-gift"></i>
</a>
<div class="comment-header-badges">
{% if comment.metadata.badges %}
<div class="comment-badges">
{% include "badges/widgets/badges.html" with badges=comment.metadata.badges %}
</div>

{% if me and comment.author_id != me.id and not comment.author.deleted_at %}
<a class="comment-badge-button" href="{% url "create_badge_for_comment" comment.id %}">
<i class="fas fa-gift"></i>
</a>
{% endif %}
{% endif %}
{% endif %}
</div>
</div>
</div>
<div class="comment-rating">
<comment-upvote :initial-upvotes="{{ comment.upvotes }}"
:hours-to-retract-vote="{{settings.RETRACT_VOTE_IN_HOURS}}"
upvote-url="{% url "upvote_comment" comment.id %}"
retract-vote-url="{% url "retract_comment_vote" comment.id %}"
{% if comment.is_voted %}
initial-is-voted
initial-upvote-timestamp="{{comment.upvoted_at}}"
{% endif %}
{% if not me|can_upvote_comment:comment or upvote_disabled %}is-disabled{% endif %}>
</comment-upvote>
<div class="comment-rating">
<comment-upvote :initial-upvotes="{{ comment.upvotes }}"
:hours-to-retract-vote="{{settings.RETRACT_VOTE_IN_HOURS}}"
upvote-url="{% url "upvote_comment" comment.id %}"
retract-vote-url="{% url "retract_comment_vote" comment.id %}"
{% if comment.is_voted %}
initial-is-voted
initial-upvote-timestamp="{{comment.upvoted_at}}"
{% endif %}
{% if not me|can_upvote_comment:comment or upvote_disabled %}is-disabled{% endif %}>
</comment-upvote>

{% if comment.is_pinned %}
<div class="comment-pinned-icon"><i class="fas fa-thumbtack"></i></div>
{% endif %}
</div>
<div class="comment-body">
<div class="text-body text-body-type-comment">
{% render_comment comment %}
{% if comment.is_pinned %}
<div class="comment-pinned-icon"><i class="fas fa-thumbtack"></i></div>
{% endif %}
</div>
</div>
<div class="comment-footer">
{% if me.id == comment.post.author_id or me.is_moderator %}
<a href="{% url "pin_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover"><i class="fas fa-thumbtack"></i></a>
{% endif %}
<div class="comment-body">
<div class="text-body text-body-type-comment">
{% render_comment comment %}
</div>
</div>
<div class="comment-footer">
{% if me.id == comment.post.author_id or me.is_moderator %}
<a href="{% url "pin_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover"><i class="fas fa-thumbtack"></i></a>
{% endif %}

{% if me.id == comment.author_id or me.id == comment.post.author_id or me.is_moderator %}
{% if comment.is_deleted %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Восстанавливаем?')"><i class="fas fa-trash-restore"></i></a>
{% else %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Удаляем?')"><i class="fas fa-trash"></i></a>
{% if me.id == comment.author_id or me.id == comment.post.author_id or me.is_moderator %}
{% if comment.is_deleted %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Восстанавливаем?')"><i class="fas fa-trash-restore"></i></a>
{% else %}
<a href="{% url "delete_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover" onclick="return confirm('Удаляем?')"><i class="fas fa-trash"></i></a>
{% endif %}
{% endif %}
{% endif %}

{% if me.id == comment.author_id or me.is_moderator %}
<a href="{% url "edit_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover"><i class="fas fa-edit"></i></a>
{% endif %}
{% if me.id == comment.author_id or me.is_moderator %}
<a href="{% url "edit_comment" comment.id %}" class="comment-footer-button comment-button-visible-on-hover"><i class="fas fa-edit"></i></a>
{% endif %}

{% if me and me.is_active_membership and comment.post.is_commentable %}
<span class="comment-footer-button" v-on:click="showReplyForm('{{ comment.id }}', '{{ comment.author.slug }}', true)"><i class="fas fa-reply"></i>&nbsp;ответить</span>
{% endif %}
{% if me and me.is_active_membership and comment.post.is_commentable %}
<span class="comment-footer-button" v-on:click="showReplyForm('{{ comment.id }}', '{{ comment.author.slug }}', true)"><i class="fas fa-reply"></i>&nbsp;ответить</span>
{% endif %}
</div>
</div>
</div>

<div class="clearfix"></div>

{% if replies %}
<div class="replies replies-indent-normal">
{% for reply_tree in replies %}
{% include "comments/types/reply.html" with comment=reply_tree.comment reply_to=reply_tree.comment replies=reply_tree.replies %}

{% if post.is_commentable and me %}
{% include "comments/forms/reply.html" with comment=reply_tree.comment reply_form=reply_form %}
{% endif %}
{% endfor %}
{% if replies %}
<div class="replies replies-indent-normal">
{% for reply_tree in replies %}
{% include "comments/types/reply.html" with comment=reply_tree.comment reply_to=reply_tree.comment replies=reply_tree.replies %}
{% endfor %}
</div>
<div class="clearfix20"></div>
{% endif %}
</div>
<div class="clearfix20"></div>
{% endif %}
4 changes: 0 additions & 4 deletions frontend/html/comments/types/normal.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@
<div class="replies">
{% for reply_tree in replies %}
{% include "comments/types/reply.html" with comment=reply_tree.comment reply_to=reply_tree.comment replies=reply_tree.replies %}

{% if post.is_commentable and me %}
{% include "comments/forms/reply.html" with comment=reply_tree.comment reply_form=reply_form %}
{% endif %}
{% endfor %}
</div>
<div class="clearfix20"></div>
Expand Down
Loading
Loading