39 lines
1.9 KiB
HTML
39 lines
1.9 KiB
HTML
{% for comment in comments %}
|
|
{% if comment == edited_comment %}
|
|
<form id="edited_comment" class="comment" method="post">
|
|
<div class="meta">
|
|
<span class="author">{{ comment.author }}</span>
|
|
<span class="date">posté le {{ comment.created_on|date }} à {{ comment.created_on|time }}</span>
|
|
<a href="{{ comment.commented_object.get_absolute_url }}" title="Annuler la modification"><i class="fa fa-ban" aria-hidden="true"></i></a>
|
|
</div>
|
|
|
|
{% csrf_token %}
|
|
<textarea name="comment_text" required>{{ comment.text }}</textarea>
|
|
<button type="submit"><i class="fa fa-pencil" aria-hidden="true"></i> Modifier mon commentaire</button>
|
|
</form>
|
|
{% else %}
|
|
<div class="comment">
|
|
<div class="meta">
|
|
<span class="author">{{ comment.author }}</span>
|
|
<span class="date">posté le {{ comment.created_on|date }} à {{ comment.created_on|time }}{% if comment.created_on|date:"YmdHi" != comment.modified_on|date:"YmdHi" %}, dernière modification le {{ comment.modified_on|date }} à {{ comment.modified_on|time }}{% endif %}</span>
|
|
{% if comment.author == request.user %}
|
|
<a href="{{ comment.get_modification_url }}#edited_comment" title="Éditer mon commentaire"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
|
{% endif %}
|
|
</div>
|
|
{{ comment.text|linebreaks }}
|
|
</div>
|
|
{% endif %}
|
|
{% empty %}
|
|
<p>(Aucun commentaire sur ce jeu)</p>
|
|
{% endfor %}
|
|
{% if not edited_comment %}
|
|
{% if request.user.is_authenticated %}
|
|
<form class="comment" method="post" action="{{ add_comment_url }}">
|
|
{% csrf_token %}
|
|
<textarea name="comment_text" placeholder="Ajouter un commentaire" required></textarea>
|
|
<button type="submit"><i class="fa fa-paper-plane" aria-hidden="true"></i> Envoyer le commentaire</button>
|
|
</form>
|
|
{% else %}
|
|
<p><a href="{% url "accounts:login" %}?next={{ request.get_full_path }}">Connectez-vous</a> pour ajouter un commentaire.</p>
|
|
{% endif %}
|
|
{% endif %}
|