PCv5/app/templates/forum/forum.html

68 lines
1.9 KiB
HTML

{% extends "base/base.html" %}
{% import "widgets/editor.html" as widget_editor %}
{% block title %}
<a href='/forum'>Forum de Planète Casio</a> » <h1>{{ f.name }}</h1>
{% endblock %}
{% block content %}
<section>
<p>{{ f.descr }}</p>
{% if f.topics %}
<h2>Sujets</h2>
<table class=topiclist>
<tr><th>Sujet</th><th>Auteur</th><th>Date de création</th>
<th>Commentaires</th><th>Vues</th></tr>
{% for t in f.topics %}
<tr><td><a href='{{ url_for('forum_topic', f=t.forum, t=t) }}'>{{ t.title }}</a></td>
<td><a href='{{ url_for('user', username=t.author.name) }}'>{{ t.author.name }}</a></td>
<td>{{ t.date_created | date }}</td>
<td>{{ t.thread.comments.count() }}</td>
<td>{{ t.views }} </td></tr>
{% endfor %}
</table>
{% elif not f.sub_forums %}
<p>Il n'y a aucun topic sur ce forum ! Animons-le vite !</p>
{% endif %}
{% if f.sub_forums %}
<h2>Forums</h2>
<table class=forumlist>
<tr><th>{{ f.name }}</th><th>Nombre de sujets</th></tr>
{% for sf in f.sub_forums %}
<tr><td><a href='/forum{{ sf.url }}'>{{ sf.name }}</td>
<td>{{ sf.topics | length }}</td></tr>
<tr><td>{{ sf.descr }}</td><td></td></tr>
{% endfor %}
</table>
{% endif %}
{% if (current_user.is_authenticated and current_user.priv('write-anywhere'))
or ("/actus" in f.url and current_user.is_authenticated and current_user.priv('write-news'))
or ("/actus" not in f.url and not f.sub_forums) %}
<div class=form>
<h2>Créer un nouveau sujet</h2>
<form action="" method="post" enctype="multipart/form-data">
{{ form.hidden_tag() }}
<div>
{{ form.title.label }}
{{ form.title() }}
{% for error in form.title.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
</div>
{{ widget_editor.text_editor(form.message) }}
<div>{{ form.submit(class_='bg-ok') }}</div>
</form>
</div>
{% endif %}
</section>
{% endblock %}