First Commit

This commit is contained in:
mrtoine 2025-09-12 11:11:44 +02:00
commit ce0758fbbb
496 changed files with 52062 additions and 0 deletions

View file

@ -0,0 +1,20 @@
{% extends 'forum_layout.html' %}
{% load forum_extras %}
{% block forum_content %}
<div class="forum">
<h2>{{ forum.name }}</h2>
<ul class="breadcrumbs">
<li><a href="{% url 'forum_home' %}">{{ forum.category.name }}</a> »</li>
<li>{{ forum.name }}</li>
</ul>
<h3>Créér un nouveau topic</h3>
<form method="post">
{% csrf_token %}
<div class="form-group">
{{ topic_form.as_p }}
</div>
<button>Créer topic</button>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,12 @@
{% extends 'layout.html' %}
{% block content %}
<div class="container">
<h2>Éditer le message</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary">Enregistrer les modifications</button>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,85 @@
{% 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 %}

60
templates/forum/topic_list.html Executable file
View file

@ -0,0 +1,60 @@
{% extends 'forum_layout.html' %}
{% load forum_extras %}
{% load paginator_tag %}
{% block forum_content %}
<h2>{{ forum.name }}</h2>
<ul class="breadcrumbs">
<li><a href="{% url 'forum_home' %}">{{ forum.category.name }}</a> »</li>
<li>{{ forum.name }}</li>
</ul>
<div class="forum">
{% if user.is_authenticated %}
<a href="{% url 'create_topic' forum.id %}" class="btn btn-add">Nouveau Topic</a>
{% endif %}
<div class="forum-header">
<div class="forum-column">Sujet</div>
<div class="forum-column">Auteur</div>
<div class="forum-column">Messages</div>
<div class="forum-column">Dernier Message</div>
</div>
<div class="forum-body">
{% for topic in topics %}
<div class="forum-row">
<div class="forum-column">
{% if unread_topics|get_item:topic.id %}
<span class="unread-badge"></span>
<strong><a href="{% url 'post_list' topic.forum.id topic.id %}">{{ topic.title }}</a></strong>
{% else %}
<a href="{% url 'post_list' topic.forum.id topic.id %}">{{ topic.title }}</a>
{% endif %}
<br>
<small>{{ topic.created_at }}</small>
</div>
<div class="forum-column">
<span class="{{ topic.author.username_decoration }}">{{ topic.author.username }}</span>
</div>
<div class="forum-column">
{{ count_posts|get_item:topic.id|default_if_none:'Aucun' }}
</div>
<div class="forum-column">
{% with last_post=last_posts|get_item:topic.id %}
{% if last_post %}
<strong><span class="{{ last_post.author.username_decoration }}">{{ last_post.author.username }}</span></strong>
<br>
<small>
<a href="{% url 'post_list' last_post.topic.forum.id last_post.topic.id %}?page={{ page_numbers|get_item:topic.id }}#{{ last_post.id }}">
{{ last_post.created }}
</a>
</small>
{% else %}
Aucun message
{% endif %}
{% endwith %}
</div>
</div>
{% endfor %}
{% paginate %}
</div>
</div>
{% endblock %}