{% extends "base/base.html" %}
{% import "widgets/editor.html" as widget_editor %}
{% import "widgets/user.html" as widget_user %}

{% block title %}
<a href='/forum'>Forum de Planète Casio</a> » Édition de commentaire</h1>
{% endblock %}

{% block content %}
<section>
	<h1>Édition de commentaire</h1>

	<h3>Commentaire actuel</h3>
	<table class="thread topcomment">
		<tr>
			<td class="author">{{ widget_user.profile(comment.author) }}</td>
			<td class="message"><div>{{ comment.text | md }}</div></td>
		</tr>
	</table>

	<div class="form">
		<h3>Nouveau commentaire</h3>
		<form action="" method="post" enctype="multipart/form-data">
			{{ form.hidden_tag() }}

			{% if form.pseudo %}
				<div>
					{{ form.pseudo.label }}
					{{ form.pseudo }}
					{% for error in form.pseudo.errors %}
					<span class="msgerror">{{ error }}</span>
					{% endfor %}
				</div>
			{% endif %}

			{{ widget_editor.text_editor(form.message, label=False, autofocus=True) }}

			{% if form.attachment_list %}
				<div>Supprimer des pièces jointes<br>
					{% for id, a in form.attachment_list.items() %}
						{{ form[id]() }} <code>{{ a.name }}</code> ({{ a.size }} octets)<br>
					{% endfor %}
				</div>
			{% endif %}

			<div>
				{{ form.attachments.label }}
				<div>
					{{ form.attachments }}
					{% for error in form.attachments.errors %}
					<span class="msgerror">{{ error }}</span>
					{% endfor %}
				</div>
			</div>

			<div>{{ form.submit(class_='bg-ok') }}</div>
		</form>
	</div>
</section>
{% endblock %}
