Add theme

This commit is contained in:
David Hoppenbrouwers
2022-10-07 19:13:16 +02:00
parent a6695b3e39
commit 09cb2df004
11 changed files with 164 additions and 32 deletions

View File

@@ -1,23 +1,27 @@
<!doctype html>
<head>
<title>{{ title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="utf-8" http-equiv="encoding">
<link rel=stylesheet href="{{ url_for('static', filename='theme.css') }}">
</head>
<body>
<nav>
<a href="{{ url_for('index') }}">Home</a>
<a class=logo href="{{ url_for('index') }}">A</a>
<div style="margin:auto"></div>
{% if 'user_id' in session %}
<a href="{{ url_for('user_edit') }}">{{ session.get('username', '???') }}</a>
|
<span>|</span>
<a href="{{ url_for('logout') }}">Logout</a>
{% else %}
<a href="{{ url_for('login') }}">Login</a>
{% endif %}
</nav>
<h1>{{ title }}</h1>
{% for category, msg in get_flashed_messages(True) %}
<p>{{ category}}: {{ msg }}</p>
{% endfor %}
<main>
<h1>{{ title }}</h1>
{% for category, msg in get_flashed_messages(True) %}
<p class="flash {{ category }}">{{ msg }}</p>
{% endfor %}
{% block content %}{% endblock %}
</main>
</body>

View File

@@ -1,19 +1,27 @@
{% macro render_comment(comment) %}
<div style="margin-left:20px">
<p><i>{{ comment.author }}</i></p>
{% macro render_comment_pre(comment) %}
<div class=comment>
<p><sub><i>{{ comment.author }}</i></sub></p>
<p>{{ comment.text }}</p>
<sup><a href="{{ url_for("comment", comment_id = comment.id) }}">reply</a></sup>
{% endmacro %}
{% macro render_comment_post(comment) %}
{% for c in comment.children %}
{{ render_comment(c) }}
{% endfor %}
</div>
{% endmacro %}
{% macro render_comment(comment) %}
{{ render_comment_pre(comment) }}
<sup><a href="{{ url_for("comment", comment_id = comment.id) }}">reply</a></sup>
{{ render_comment_post(comment) }}
{% endmacro %}
{% macro reply() %}
{% if 'user_id' in session %}
<form method="post" action="comment/">
<textarea name="text"></textarea>
<input type="submit" value="Post comment">
<p><textarea name="text"></textarea></p>
<p><input type="submit" value="Post comment"></p>
</form>
{% endif %}
{% endmacro %}

View File

@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% from 'comment.html' import render_comment, reply %}
{% from 'comment.html' import render_comment, render_comment_pre, render_comment_post, reply %}
{% block content %}
<sup><a href="{{ url_for('thread', thread_id = thread_id) }}">thread</a></sup>
@@ -7,9 +7,14 @@
<sup><a href="../{{ parent_id }}">parent</a></sup>
{% endif %}
{{ render_comment_pre(reply_comment) }}
{{ reply() }}
{% for c in comments %}
{{ render_comment(c) }}
{% endfor %}
{{ render_comment_post(reply_comment) }}
{% endblock %}

View File

@@ -2,10 +2,12 @@
{% block content %}
<p>Are you sure you want to delete "{{ thread_title }}"?</p>
<form method="post" action="../delete">
<input type="submit" value="Yes">
</form>
<form method="get" action="..">
<input type="submit" value="No">
</form>
<p>
<form method="post" action="../delete" style=inline>
<input type="submit" value="Yes">
</form>
<form method="get" action=".." style=inline>
<input type="submit" value="No">
</form>
</p>
{% endblock %}

View File

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

View File

@@ -2,8 +2,16 @@
{% block content %}
<form method="post">
<input type="text" name="title">
<textarea name="text"></textarea>
<input type="submit" value="Post">
<table class=form>
<tr>
<td>Title</td>
<td><input type="text" name="title"></td>
</tr>
<tr>
<td>Text</td>
<td><textarea name="text"></textarea></td>
</tr>
</table>
<p><input type="submit" value="Post"></p>
</form>
{% endblock %}

View File

@@ -2,10 +2,15 @@
{% block content %}
<p>{{ description }}</p>
<a href="{{ url_for('new_thread', forum_id = forum_id) }}">Create thread</a>
<ul>
<p><a href="{{ url_for('new_thread', forum_id = forum_id) }}">Create thread</a></p>
<table>
<tr>
<th>Topic</th>
</tr>
{% for id, title in threads %}
<li><a href="{{ url_for('thread', thread_id = id) }}">{{ title }}</a></li>
<tr>
<th><a href="{{ url_for('thread', thread_id = id) }}">{{ title }}</a></th>
</tr>
{% endfor %}
</ul>
</table>
{% endblock %}

View File

@@ -9,7 +9,7 @@
</form>
</div>
{% endif %}
<p>{{ author }} - rjgoire</p>
<sup><i>{{ author }}</i></sup>
<p>{{ text }}</p>
{{ reply() }}

View File

@@ -3,7 +3,7 @@
{% block content %}
<form method="post">
<p>{{ name }}</p>
<textarea name="about">{{ about }}</textarea>
<input type="submit" value="Update">
<p><textarea name="about">{{ about }}</textarea></p>
<p><input type="submit" value="Update"></p>
</form>
{% endblock %}