| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- {# section commentaire. prends en parametre un objet Story ou Epic #}
- {# l'objet en parametre doit avoir une propriete 'comments' et une propriete 'uuid' #}
- {% load martortags %}
- <a class="anchor" id="a-comment-section"></a>
- <div id="comment-section">
- <ul class="comment-list">
- {% for comment, frm in com_pack.comments.items %}
- <li class="comment flex-col anchor" id="comment-{{ comment.id }}" data-id="{{ comment.id }}">
- <a class="anchor" id="a-comment-{{ comment.id }}"></a>
- <div class="flex-row">
- <span class="comment-header"><i class="fa fa-comment"></i> {{ comment.author }}, le {{ comment.created }}</span>
- {% if comment.author.id == request.user.id %}
- <a class="comment-edit-btn" href="" style="margin-left: 20px;"><i class="fa fa-pencil"></i></a>
- <a class="comment-del-btn" href="{% url 'comment_del' comment_id=comment.id %}" style="margin-left: 10px;"><i class="fa fa-trash"></i></a>
- {% endif %}
- </div>
- <div class="comment-display">
- {{ comment.content|safe_markdown }}
- </div>
-
- <div class="comment-edition" style="display: none;">
- <form action="{% url 'comment_edit' comment_id=comment.id %}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
- {% csrf_token %}
-
- {{ frm.content }}
-
- <div class="flex-row flex-end" style="margin-top: 10px;">
- <a href="" class="comment-edition-cancel" style="margin-right: 20px;">Annuler</a>
- <input type="submit">
- </div>
- </form>
- </div>
- </li>
- {% endfor %}
- </ul>
-
- <form action="{% url 'comment_post' obj_uuid=com_pack.obj.uuid %}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
- {% csrf_token %}
-
- {{ com_pack.empty_form.as_p }}
-
- <div class="flex-row flex-end" style="margin-top: 10px;">
- <input type="submit">
- </div>
- </form>
-
- </div>
- <script>
-
- $(".comment-edit-btn, .comment-edition-cancel").click(function (event) {
- event.preventDefault();
- var comment_li = $(this).closest('.comment');
- comment_li.find('.comment-edition').toggle();
- comment_li.find('.comment-display').toggle();
- });
-
- $(".comment-del-btn").click(function (event) {
- if (confirm('Êtes vous sûr de vouloir supprimer le commentaire?')) {
- return true;
- }
- });
- </script>
|