contentdb/app/templates/macros/threads.html

49 lines
1.5 KiB
HTML
Raw Normal View History

2018-06-11 23:49:25 +02:00
{% macro render_thread(thread, current_user) -%}
2018-06-12 00:11:15 +02:00
<ul class="comments">
2018-06-11 23:49:25 +02:00
{% for r in thread.replies %}
<li>
2018-06-12 00:20:18 +02:00
<div class="info_strip">
<a class="author {{ r.author.rank.name }}"
href="{{ url_for('user_profile_page', username=r.author.username) }}">
{{ r.author.display_name }}</a>
<span>{{ r.created_at | datetime }}</span>
<div class="clearboth"></div>
</div>
2018-06-12 00:11:15 +02:00
<div class="msg">
2018-07-28 15:07:29 +02:00
{{ r.comment | markdown }}
2018-06-12 00:11:15 +02:00
</div>
2018-06-11 23:49:25 +02:00
</li>
{% endfor %}
</ul>
{% if current_user.is_authenticated %}
2018-06-12 00:11:15 +02:00
<form method="post" action="{{ url_for('thread_page', id=thread.id)}}" class="comment_form">
2018-06-11 23:49:25 +02:00
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
2018-07-28 15:07:29 +02:00
<textarea required maxlength=500 name="comment" placeholder="Markdown supported"></textarea><br />
2018-06-11 23:49:25 +02:00
<input type="submit" value="Comment" />
</form>
{% endif %}
{% endmacro %}
2018-12-21 16:58:43 +01:00
{% macro render_threadlist(threads, list_group=False) -%}
{% if not list_group %}<ul>{% endif %}
<li {% if list_group %}class="list-group-item"{% endif %}>
2018-06-11 23:49:25 +02:00
{% for t in threads %}
2018-12-21 16:58:43 +01:00
{% if list_group %}
<a href="{{ url_for('thread_page', id=t.id) }}">
{% if t.private %}&#x1f512; {% endif %}
{{ t.title }}
by {{ t.author.display_name }}
</a>
{% else %}
{% if t.private %}&#x1f512; {% endif %}
<a href="{{ url_for('thread_page', id=t.id) }}">{{ t.title }}</a>
by {{ t.author.display_name }}
{% endif %}
2018-07-13 22:28:08 +02:00
{% else %}
2018-12-21 16:58:43 +01:00
<i>No threads found</i>
2018-06-11 23:49:25 +02:00
{% endfor %}
2018-12-21 16:58:43 +01:00
</li>
2018-06-11 23:49:25 +02:00
</ul>
{% endmacro %}