aboutsummaryrefslogtreecommitdiff
path: root/app/templates/macros/threads.html
diff options
context:
space:
mode:
Diffstat (limited to 'app/templates/macros/threads.html')
-rw-r--r--app/templates/macros/threads.html27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/templates/macros/threads.html b/app/templates/macros/threads.html
new file mode 100644
index 0000000..96e1107
--- /dev/null
+++ b/app/templates/macros/threads.html
@@ -0,0 +1,27 @@
+{% macro render_thread(thread, current_user) -%}
+ <ul>
+ {% for r in thread.replies %}
+ <li>
+ &lt;<a href="{{ url_for('user_profile_page', username=r.author.username) }}">{{ r.author.display_name }}</a>&gt;
+ {{ r.comment }}
+ </li>
+ {% endfor %}
+ </ul>
+
+ {% if current_user.is_authenticated %}
+ <form method="post" action="{{ url_for('thread_page', id=thread.id)}}">
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
+ <textarea required maxlength=500 name="comment"></textarea><br />
+ <input type="submit" value="Comment" />
+ </form>
+ {% endif %}
+{% endmacro %}
+
+{% macro render_threadlist(threads) -%}
+ <ul>
+ {% for t in threads %}
+ <li><a href="{{ url_for('thread_page', id=t.id) }}">{{ t.title }}</a> by {{ t.author.display_name }}</li>
+ {% endfor %}
+ </ul>
+
+{% endmacro %}