44 lines
2.5 KiB
HTML
44 lines
2.5 KiB
HTML
{% load form_helpers %}
|
|
<div class="card bg-white rounded-xl shadow-sm border border-gray-100" id="comment-{{ comment.pk }}">
|
|
<div class="card-body p-4">
|
|
<div class="flex items-start gap-3">
|
|
<div class="w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-xs font-bold flex-shrink-0">{{ comment.author.username|first|upper }}</div>
|
|
<div class="flex-1 min-w-0">
|
|
<div class="flex items-center gap-2 mb-1">
|
|
<span class="text-sm font-semibold text-gray-900">{{ comment.author.username }}</span>
|
|
<span class="text-xs text-gray-400">{{ comment.created_at|timesince }} ago</span>
|
|
</div>
|
|
<div class="prose prose-sm max-w-none text-gray-700 mb-2">
|
|
{{ comment.body|render_markdown }}
|
|
</div>
|
|
{% if not comment.parent %}
|
|
<button type="button"
|
|
class="text-xs text-blue-600 hover:text-blue-800 font-medium"
|
|
onclick="event.stopPropagation(); document.getElementById('reply-form-{{ comment.pk }}').classList.toggle('hidden')">
|
|
Reply
|
|
</button>
|
|
<form method="post" action="{% url 'card_comment' comment.card.pk %}"
|
|
id="reply-form-{{ comment.pk }}"
|
|
class="hidden mt-3 space-y-2"
|
|
hx-target="#comment-{{ comment.pk }}" hx-swap="afterend">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="parent" value="{{ comment.pk }}">
|
|
<textarea name="body" class="textarea textarea-bordered w-full text-sm min-h-[80px]" placeholder="Write a reply..." required></textarea>
|
|
<div class="flex gap-2">
|
|
<button type="submit" class="btn btn-sm bg-blue-600 text-white hover:bg-blue-700 border-0">Reply</button>
|
|
<button type="button" class="btn btn-sm btn-ghost" onclick="this.closest('form').classList.add('hidden')">Cancel</button>
|
|
</div>
|
|
</form>
|
|
{% endif %}
|
|
{% if comment.replies.all %}
|
|
<div class="mt-3 space-y-3 pl-4 border-l-2 border-gray-100">
|
|
{% for reply in comment.replies.all %}
|
|
{% include "partials/kanban/comment.html" with comment=reply %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|