Add configuration table

This commit is contained in:
David Hoppenbrouwers
2022-10-09 12:27:59 +02:00
parent e3af03bbac
commit f73f2b405c
10 changed files with 227 additions and 56 deletions

View File

@@ -7,22 +7,28 @@
<input type=submit value=Submit>
</form>
<h2>Configuration</h2>
<form action=config/edit/ method=post>
<table>
<tr>
<td>Name</td>
<td>
<input type=text value="Agrepy">
<input type=submit value=Set>
</td>
<td>Server name</td>
<td><input type=text name=server_name value="{{ config.server_name }}"></td>
</tr>
<tr>
<td>Registrations enabled</td>
<td>
<input type=checkbox checked>
<input type=submit value=Set>
</td>
<td>Server description</td>
<td><textarea name=server_description>{{ config.server_description }}</textarea></td>
</tr>
<tr>
<td>Registration enabled</td>
<td><input name=registration_enabled type=checkbox {{ 'checked' if config.registration_enabled else '' }}></td>
</tr>
</table>
<input type=submit value=Update>
</form>
<p>
<form action=config/new_secrets/ method=post>
<input type=submit value="Generate new secrets">
</form>
</p>
<h2>Forums</h2>
<table>
<tr>

View File

@@ -9,25 +9,27 @@
<nav>
<a class=logo href="{{ url_for('index') }}">A</a>
<div style="margin:auto"></div>
{% if user is not none %}
{%- if user is not none -%}
<a href="{{ url_for('user_edit') }}">{{ user.name }}</a>
<span>|</span>
{% if user.is_admin() %}
<span> | </span>
{%- if user.is_admin() -%}
<a href="{{ url_for('admin') }}">Admin panel</a>
<span>|</span>
{% endif %}
<span> | </span>
{%- endif -%}
<a href="{{ url_for('logout') }}">Logout</a>
{% else %}
{%- else -%}
{%- if config.registration_enabled -%}
<a href="{{ url_for('register') }}">Register</a>
<span>|</span>
<span> | </span>
{%- endif -%}
<a href="{{ url_for('login') }}">Login</a>
{% endif %}
{%- endif -%}
</nav>
<main>
<h1>{{ title }}</h1>
{% for category, msg in get_flashed_messages(True) %}
{%- for category, msg in get_flashed_messages(True) -%}
<p class="flash {{ category }}">{{ msg }}</p>
{% endfor %}
{% block content %}{% endblock %}
{%- endfor -%}
{%- block content %}{% endblock -%}
</main>
</body>

View File

@@ -1,6 +1,7 @@
{% extends 'base.html' %}
{% block content %}
{%- block content %}
<p>{{ minimd(description) | safe }}</p>
<table>
<tr>
<th>Forum</th>
@@ -23,4 +24,4 @@
</tr>
{%- endfor -%}
</table>
{% endblock %}
{%- endblock %}

View File

@@ -1,6 +1,7 @@
{% extends 'base.html' %}
{%- block content %}
{%- if config.registration_enabled -%}
<form method="post" class=login>
<table>
<tr><td>Username</td><td><input type="text" name="username" minlength=3></td></tr>
@@ -10,4 +11,7 @@
<input name="answer" value="{{ answer }}" hidden>
<input type="submit" value="Register">
</form>
{% endblock %}
{%- else -%}
<p>Registrations are disabled.</p>
{%- endif %}
{%- endblock %}