aboutsummaryrefslogtreecommitdiff
path: root/app/templates/macros/threads.html
blob: 9ce8a733f9807f682d99cd3be513e5a60df65cee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{% macro render_thread(thread, current_user) -%}
	<ul class="comments">
		{% for r in thread.replies %}
			<li>
				<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>
				<div class="msg">
					{{ r.comment | markdown }}
				</div>
			</li>
		{% endfor %}
	</ul>

	{% if current_user.is_authenticated %}
		<form method="post" action="{{ url_for('thread_page', id=thread.id)}}" class="comment_form">
			<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
			<textarea required maxlength=500 name="comment" placeholder="Markdown supported"></textarea><br />
			<input type="submit" value="Comment" />
		</form>
	{% endif %}
{% endmacro %}

{% macro render_threadlist(threads, list_group=False) -%}
	{% if not list_group %}<ul>{% endif %}
		<li {% if list_group %}class="list-group-item"{% endif %}>
		{% for t in threads %}
			{% 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 %}
		{% else %}
			<i>No threads found</i>
		{% endfor %}
		</li>
	</ul>
{% endmacro %}