added template with navbar

This commit is contained in:
Simon Pirkelmann 2021-03-14 17:08:46 +01:00
parent daed27372b
commit 253db849ff
5 changed files with 58 additions and 78 deletions

25
templates/base.html Normal file
View File

@ -0,0 +1,25 @@
<!doctype html>
<title>Space Token Administration - {% block title %}{% endblock %}</title>
<!--<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">-->
<nav>
<ul>
<li><a href="{{ url_for('door_lock') }}">Home</a>
<li><a href="{{ url_for('register') }}">Token Registrierung</a>
<li><a href="{{ url_for('list_tokens') }}">Token Übersicht</a>
{% if g.user %}
<li><span>{{ g.user['username'] }}</span>
<li><a href="{{ url_for('security.logout') }}">Log Out</a>
{% else %}
<li><a href="{{ url_for('security.login') }}">Log In</a>
{% endif %}
</ul>
</nav>
<section class="content">
<header>
{% block header %}{% endblock %}
</header>
{% for message in get_flashed_messages() %}
<div class="flash">{{ message }}</div>
{% endfor %}
{% block content %}{% endblock %}
</section>

View File

@ -1,22 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Token editieren</title>
{% extends 'base.html' %}
{% block header %}
{% block title %}<h1>Token editieren</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script>
</head>
<body>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
<div>
{% endblock %}
{% block content %}
<div>
<p>
Token {{ token }} editieren:
</p>
@ -55,8 +44,7 @@
</tr>
</table>
</form>
</div>
</body>
</div>
<script>
$(function () {
@ -70,4 +58,4 @@
});
});
</script>
</html>
{% endblock %}

View File

@ -1,11 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Space Zugangsverwaltung</title>
</head>
<body>
<h1>Space Zugangsverwaltung</h1>
{% extends 'base.html' %}
{% block header %}
{% block title %}<h1>Space Zugangsverwaltung</h1>{% endblock %}
{% endblock %}
{% block content %}
Zustand der Tür:
{% if door_state == 'closed' %}
<div style="color: red">
@ -18,12 +16,4 @@ Zustand der Tür:
{% endif %}
<br>
Position Drehgeber: {{ encoder_position }}
<p>
<a href="{{ url_for('list_tokens') }}">Übersicht Tokens</a>
</p>
<p>
<a href="{{ url_for('register') }}">Token registrieren</a>
</p>
</body>
</html>
{% endblock %}

View File

@ -1,23 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tokens registrieren</title>
{% extends 'base.html' %}
{% block header %}
{% block title %}<h1>Token Registrierung</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script>
</head>
<body>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% if token is not none %}
Letzter unregistrierter Token: {{ token['token'] }} <br>
{% endblock %}
{% block content %}
{% if not token.vars %}
Letzter gelesener unregistrierter Token: {{ token['token'] }} <br>
Gelesen: {{ token['timestamp']}}
<div>
@ -62,9 +51,8 @@
</form>
</div>
{% else %}
Keine unregistrierten Tokens in Logfile gefunden. Bitte Token scannen und die Seite neu laden.
Keine unregistrierten Tokens in MQTT Nachrichten. Bitte Token scannen und die Seite neu laden.
{% endif %}
</body>
<script>
$(function () {
@ -78,4 +66,4 @@
});
});
</script>
</html>
{% endblock %}

View File

@ -1,21 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tokens</title>
{% extends 'base.html' %}
{% block header %}
{% block title %}<h1>Token Übersicht</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script>
</head>
<body>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% endblock %}
{% block content %}
<table border="1">
<td>Token</td>
<td>NutzerIn</td>
@ -50,7 +40,6 @@
{% endfor %}
</table>
</body>
<script>
function confirmDelete(t) {
debugger
@ -66,4 +55,4 @@
}
}
</script>
</html>
{% endblock %}