moved config to a json, which makes adding more variables easier, but perhaps otherwise adds complexity

This commit is contained in:
Ville Rantanen
2023-07-28 13:08:54 +03:00
parent 80af9c321c
commit f1c453d3d4
18 changed files with 258 additions and 182 deletions

View File

@@ -4,16 +4,17 @@
<title>{{ title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="utf-8" http-equiv="encoding">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel=stylesheet href="{{ url_for('static', filename='theme.css') }}">
{%- if config.server_name -%}
<link rel=stylesheet href="{{ url_for('static', filename='user.css') }}">
{%- if config.user_css -%}
<link rel=stylesheet href="{{ url_for('static', filename=config.user_css) }}">
{%- endif -%}
</head>
<body>
<h1>{{ title }}</h1>
<p>
<a href="{{ url_for('admin') }}">Admin panel</a><span> | </span>
<a href="{{ url_for('index') }}">Home page</a>
<span> &laquo; </span><a href="{{ url_for('index') }}">Forum Home</a>
<span> | </span><a href="{{ url_for('admin') }}">Admin panel</a>
</p>
{%- for category, msg in get_flashed_messages(True) -%}
<p class="flash {{ category }}">{{ msg }}</p>

View File

@@ -12,7 +12,7 @@
</tr>
{%- for id, name, join_date, role, banned_until in users -%}
<tr>
<td>{{ id }}</td>
<td><a href="{{ url_for('user_info', user_id = id) }}">{{ id }}</a></td>
<td>{{ name }}</td>
<td>{{ format_time(join_date) }}</td>
<td>
@@ -61,7 +61,7 @@
</tr>
{% for id, name, description, _, _, _ in forums %}
<tr>
<td>{{ id }}</td>
<td><a href="{{ url_for('forum', forum_id = id) }}">{{ id }}</a></td>
<td>
<form method=post action="forum/{{ id }}/edit/name/">
<input type=text name=name value="{{ name }}"</input>
@@ -114,6 +114,14 @@
<td>Login required</td>
<td><input name=login_required type=checkbox {{ 'checked' if config.login_required else '' }}></td>
</tr>
<tr>
<td>Number of threads per page</td>
<td><input type=number name=threads_per_page value="{{ config.threads_per_page }}"></td>
</tr>
<tr>
<td>User defined CSS file in static/ folder</td>
<td><input type=text name=user_css value="{{ config.user_css }}"></td>
</tr>
</table>
<input type=submit value=Update>
</form>
@@ -129,8 +137,6 @@
</p>
<!-- -->
<h2 class=admin_h2>Query</h2>
<p>&#9888; Only use queries if you know what you're doing &#9888;</p>

View File

@@ -6,8 +6,8 @@
<meta content="utf-8" http-equiv="encoding">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel=stylesheet href="{{ url_for('static', filename='theme.css') }}">
{%- if config.server_name -%}
<link rel=stylesheet href="{{ url_for('static', filename='user.css') }}">
{%- if config.user_css -%}
<link rel=stylesheet href="{{ url_for('static', filename=config.user_css) }}">
{%- endif -%}
</head>
<body>
@@ -50,5 +50,6 @@
<p class="flash {{ category }}">{{ msg | safe }}</p>
{%- endfor -%}
{%- block content %}{% endblock -%}
<a id="end"></a>
</main>
</body>

View File

@@ -3,7 +3,7 @@
{% block content %}
<form method="post" class=login>
<table>
<tr><td>Username</td><td><input type="text" name="username" required></td></tr>
<tr><td>Username</td><td><input type="text" name="username" required autofocus></td></tr>
<tr><td>Password</td><td><input type="password" name="password" required></td></tr>
</table>
<input type="submit" value="Login">

View File

@@ -3,7 +3,10 @@
{%- from 'moderator.html' import moderate_thread with context %}
{%- block content %}
<p><span> &laquo; </span><a href="{{ url_for('forum', forum_id = forum_id) }}">{{ forum_title }}</a></p>
<p>
<span> &laquo; </span><a href="{{ url_for('forum', forum_id = forum_id) }}">{{ forum_title }}</a>
<span> &raquo; </span><a href="#end">Page end</a>
</p>
{%- if user is not none and user.is_moderator() -%}
<p>{{ moderate_thread(thread_id, hidden) }}</p>
{%- endif -%}
@@ -15,4 +18,7 @@
{%- for c in comments %}
{{- render_comment(c, thread_id) }}
{%- endfor %}
<p>
<span> &raquo; </span><a href="#top">Page top</a>
</p>
{%- endblock %}