_comment_div.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {# section commentaire. prends en parametre un objet Story ou Epic #}
  2. {# l'objet en parametre doit avoir une propriete 'comments' et une propriete 'uuid' #}
  3. {% load martortags %}
  4. <div class="comment-section">
  5. <ul class="comment-list">
  6. {% for comment in obj.comments %}
  7. <li class="comment flex-col" data-id="{{ comment.id }}">
  8. <div class="flex-row">
  9. <span class="comment-header"><i class="fa fa-comment"></i> {{ comment.author }}, le {{ comment.created }}</span>
  10. {% if comment.author.id == request.user.id %}
  11. <a class="disabled comment-edit-btn" href="" style="margin-left: 20px;"><i class="fa fa-pencil"></i></a>
  12. <a class="comment-del-btn" href="{% url 'comment_del' comment_id=comment.id %}" style="margin-left: 10px;"><i class="fa fa-trash"></i></a>
  13. {% endif %}
  14. </div>
  15. <div class="comment-display">
  16. {{ comment.content|safe_markdown }}
  17. </div>
  18. </li>
  19. {% endfor %}
  20. </ul>
  21. <form action="{% url 'comment_post' obj_uuid=obj.uuid %}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
  22. {% csrf_token %}
  23. {{ comment_form.as_p }}
  24. <div class="flex-row flex-end" style="margin-top: 10px;">
  25. <input type="submit">
  26. </div>
  27. </form>
  28. </div>
  29. <script>
  30. $(".comment-del-btn").click(function (event) {
  31. if (confirm('Êtes vous sûr de vouloir supprimer le commentaire?')) {
  32. return true;
  33. }
  34. });
  35. </script>