85 lines
No EOL
5 KiB
HTML
Executable file
85 lines
No EOL
5 KiB
HTML
Executable file
{% extends 'forum_layout.html' %}
|
|
{% load forum_extras %}
|
|
{% load users_custom_tags %}
|
|
{% load paginator_tag %}
|
|
{% load bbcode_tags %}
|
|
|
|
{% block forum_content %}
|
|
<div class="forum">
|
|
<h2>{{ topic.title }}</h2>
|
|
<ul class="breadcrumbs">
|
|
<li><a href="{% url 'forum_home' %}">{{ topic.forum.category.name }}</a> »</li>
|
|
<li><a href="{% url 'topic_list' topic.forum.id %}">{{ topic.forum.name }}</a> »</li>
|
|
<li>{{ topic.title }}</li>
|
|
</ul>
|
|
|
|
{% for post in posts %}
|
|
<div class="forum-header" id="{{ post.id }}">
|
|
<div class="forum-column-detail"><div class="row"><span id="author-post-{{ post.id }}" class="{{ post.author.username_decoration }}" style="font-size:1.3rem;">{{ post.author.username }}</span> <small>le {{ post.created }}</small></div></div>
|
|
</div>
|
|
<div class="forum-body">
|
|
<div class="forum-row">
|
|
<div class="forum-column-detail details">
|
|
<center><div class="{{ post.author.border_avatar }}"><img src="/media/{{ post.author.avatar }}" style="width:100px;" alt="Avatar de {{ post.author.username }}"></div></center>
|
|
<small>
|
|
<ul>
|
|
<li>Groupe :
|
|
{% for group in post.author.groups.all %}
|
|
{% if group.name == "Administrateurs" %}
|
|
<span class="text-admin">{{ group.name }}</span>
|
|
{% elif group.name == "Super Admin" %}
|
|
<span class="text-sadmin">{{ group.name }}</span>
|
|
{% else %}
|
|
{{ group.name }}{% if not forloop.last %}, {% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
</li>
|
|
<li>Nombre de messages : {{ count_posts|get_item:post.author.id }}</li>
|
|
</ul>
|
|
</small>
|
|
{% if user|has_group:"Administrateurs" or user|has_group:"Super Admin" %}
|
|
<a href="{% url 'deactivate_post' post.id %}" class="btn btn-warning">Désactiver le message</a>
|
|
{% endif %}
|
|
</div>
|
|
<div class="forum-column-detail">
|
|
<span id="post-{{ post.id }}">{{ post.content|bbcode|safe|linebreaksbr }}</span>
|
|
<div class="footer-post" style="margin-top:50px;">
|
|
<hr>
|
|
<p style="padding: 10px;">{{ post.author.biography|bbcode|safe|linebreaksbr }}</p>
|
|
{% if post.created|date:"Y-m-d H:i:s" != post.updated|date:"Y-m-d H:i:s" %}
|
|
<span style="font-style:italic;font-size: 0.8rem;">modifié le {{ post.updated }}</span>
|
|
{% endif %}
|
|
<a style="float:right" id="quote" target="{{ post.id }}" class="btn btn-small">Citer</a>
|
|
<!-- Ajouter ceci dans la boucle des posts, près des autres actions -->
|
|
{% if request.user == post.author or request.user.is_staff %}
|
|
<a href="{% url 'forum_edit_post' post.id %}" style="float:right" id="edit" class="btn btn-small">Modifier</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div><br>
|
|
</div>
|
|
{% endfor %}
|
|
{% paginate %}
|
|
{% if user.is_authenticated %}
|
|
<!-- On affiche la possibilité de clore le topic si l'utilisateur est admin -->
|
|
{% if topic.state == "closed" %}
|
|
<h2>Topic fermé</h2>
|
|
{% if user|has_group:"Administrateurs" or user|has_group:"Super Admin" %}
|
|
<a href="{% url 'unlock_topic' topic.id %}" class="btn btn-add">Ouvrir le topic</a>
|
|
{% endif %}
|
|
{% else %}
|
|
{% if user|has_group:"Administrateurs" or user|has_group:"Super Admin" %}
|
|
<h2>Répondre</h2>
|
|
<a href="{% url 'lock_topic' topic.id %}" class="btn btn-danger">Fermer le topic</a>
|
|
{% endif %}
|
|
<form method="post">
|
|
{% csrf_token %}
|
|
<div class="form-group">
|
|
{{ post_form.as_p }}
|
|
</div>
|
|
<button>Répondre</button>
|
|
</form>
|
|
{% endif %}
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %} |