templates: added a widget for threads
It will be used for program comments, etc.
This commit is contained in:
parent
5253f8ec8f
commit
e308fca0ba
|
@ -1,8 +1,8 @@
|
|||
{% extends "base/base.html" %}
|
||||
{% import "widgets/editor.html" as widget_editor %}
|
||||
{% import "widgets/thread.html" as widget_thread %}
|
||||
{% import "widgets/user.html" as widget_user %}
|
||||
{% import "widgets/pagination.html" as widget_pagination with context %}
|
||||
{% import "widgets/attachments.html" as widget_attachments %}
|
||||
|
||||
{% block title %}
|
||||
<a href='/forum'>Forum de Planète Casio</a> » <a href="{{ url_for('forum_page', f=t.forum) }}">{{ t.forum.name }}</a> » <h1>{{ t.title }}</h1>
|
||||
|
@ -13,64 +13,39 @@
|
|||
<h1>{{ t.title }}</h1>
|
||||
<table class="thread"><tr>
|
||||
<td class="author">{{ widget_user.profile(t.author ) }}</td>
|
||||
<td>{{ t.thread.top_comment.text|md }}</td>
|
||||
</tr></table>
|
||||
<td>{{ t.thread.top_comment.text|md }}</td>
|
||||
</tr></table>
|
||||
|
||||
{{ widget_pagination.paginate(comments, 'forum_topic', t, {'f': t.forum}) }}
|
||||
|
||||
<table class="thread">
|
||||
{% for c in comments.items %}
|
||||
<tr id="{{ c.id }}">
|
||||
{% if c != t.thread.top_comment %}
|
||||
<td class="author">{{ widget_user.profile(c.author) }}</td>
|
||||
<td>
|
||||
<div>{% if c.date_created != c.date_modified %}
|
||||
Posté le {{ c.date_created|date }} (Modifié le {{ c.date_modified|date }})
|
||||
{% else %}
|
||||
Posté le {{ c.date_created|dyndate }}
|
||||
{% endif %}
|
||||
| <a href="{{ url_for('forum_topic', f=t.forum, page=(t,comments.page), _anchor=c.id) }}">#</a>
|
||||
| <a href="{{ url_for('edit_post', postid=c.id, r=request.path) }}">Modifier</a>
|
||||
| <a href="#">Supprimer</a>
|
||||
</div>
|
||||
<!--<hr>-->
|
||||
{{ c.text|md }}
|
||||
{{ widget_attachments.attachments(c) }}
|
||||
{{ c.author.signature|md }}
|
||||
{% elif loop.index0 != 0 %}
|
||||
<div>Ce message est le top comment</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{{ widget_thread.thread(comments, t.thread.top_comment) }}
|
||||
|
||||
{{ widget_pagination.paginate(comments, 'forum_topic', t, {'f': t.forum}) }}
|
||||
|
||||
{% if current_user.is_authenticated or V5Config.ENABLE_GUEST_POST %}
|
||||
<div class=form>
|
||||
<h3>Commenter le sujet</h3>
|
||||
<h3>Commenter le sujet</h3>
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{% if form.pseudo %}
|
||||
{{ form.pseudo.label }}
|
||||
{{ form.pseudo }}
|
||||
{% for error in form.pseudo.errors %}
|
||||
<span class="msgerror">{{ error }}</span>
|
||||
{% endfor %}
|
||||
<span class="msgerror">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{{ widget_editor.text_editor(form.message, label=False) }}
|
||||
{{ widget_editor.text_editor(form.message, label=False) }}
|
||||
|
||||
{{ form.attachments }}
|
||||
{% for error in form.attachments.errors %}
|
||||
<span class="msgerror">{{ error }}</span>
|
||||
{% endfor %}
|
||||
|
||||
<div>{{ form.submit(class_='bg-ok') }}</div>
|
||||
</form>
|
||||
<div>{{ form.submit(class_='bg-ok') }}</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
{% import "widgets/user.html" as widget_user %}
|
||||
{% import "widgets/attachments.html" as widget_attachments %}
|
||||
|
||||
{% macro thread(comments, top_comment, anchor) %}
|
||||
<table class="thread">
|
||||
{% for c in comments.items %}
|
||||
<tr id="{{ c.id }}">
|
||||
{% if c != top_comment %}
|
||||
<td class="author">{{ widget_user.profile(c.author) }}</td>
|
||||
<td>
|
||||
<div>{% if c.date_created != c.date_modified %}
|
||||
Posté le {{ c.date_created|date }} (Modifié le {{ c.date_modified|date }})
|
||||
{% else %}
|
||||
Posté le {{ c.date_created|dyndate }}
|
||||
{% endif %}
|
||||
| <a href="{{ request.path }}#{{ c.id }}">#</a>
|
||||
| <a href="{{ url_for('edit_post', postid=c.id, r=request.path) }}">Modifier</a>
|
||||
| <a href="#">Supprimer</a>
|
||||
</div>
|
||||
<!--<hr>-->
|
||||
{{ c.text|md }}
|
||||
{{ widget_attachments.attachments(c) }}
|
||||
{{ c.author.signature|md }}
|
||||
{% elif loop.index0 != 0 %}
|
||||
<div>Ce message est le top comment</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endmacro %}
|
Loading…
Reference in New Issue