Basics to view threads

This commit is contained in:
David Hoppenbrouwers
2022-10-07 13:18:19 +02:00
commit d72fd14c92
11 changed files with 247 additions and 0 deletions

13
templates/base.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<head>
<title>{{ title }}</title>
</head>
<body>
<nav>
<a href="{{ url_for('index') }}">Home</a>
</nav>
<h1>{{ title }}</h1>
<main>
{% block content %}{% endblock %}
</main>
</body>

9
templates/index.html Normal file
View File

@@ -0,0 +1,9 @@
{% extends 'base.html' %}
{% block content %}
<ul>
{% for id, name, description in subforums %}
<li><a href="{{ url_for('subforum', forum_id = id) }}">{{ name }} - {{ description }}</a></li>
{% endfor %}
</ul>
{% endblock %}

10
templates/subforum.html Normal file
View File

@@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block content %}
<p>{{ description }}</p>
<ul>
{% for id, title in threads %}
<li><a href="{{ url_for('thread', thread_id = id) }}">{{ title }}</a></li>
{% endfor %}
</ul>
{% endblock %}

19
templates/thread.html Normal file
View File

@@ -0,0 +1,19 @@
{% extends 'base.html' %}
{% macro render_comment(comment) %}
<div style="margin-left:20px">
<p><i>{{ comment.author }}</i></p>
<p>{{ comment.text }}</p>
{% for c in comment.children %}
{{ render_comment(c) }}
{% endfor %}
</div>
{% endmacro %}
{% block content %}
<p>{{ author }} - rjgoire</p>
<p>{{ text }}</p>
{% for c in comments %}
{{ render_comment(c) }}
{% endfor %}
{% endblock %}