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

View File

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

View File

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

View File

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