added bootstrap for nicer layout

This commit is contained in:
Simon Pirkelmann 2021-04-07 11:29:50 +02:00
parent 5facd44325
commit 7684268002
13 changed files with 167 additions and 50 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,19 +2,22 @@
{% block header %} {% block header %}
{% block title %}<h1>Admin Übersicht</h1>{% endblock %} {% block title %}<h1>Admin Übersicht</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script> <script src="../static/js/jquery-3.6.0.js"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<table border="1"> <table class="table">
<td>Username</td> <thead>
<td>E-Mail</td> <th scope="col">Username</th>
<td>Aktiv</td> <th scope="col">E-Mail</th>
<td>Aktionen</td> <th scope="col">Aktiv</th>
<th scope="col">Aktionen</th>
</thead>
<tbody>
{% for data in admin_data %} {% for data in admin_data %}
<tr> <tr>
{% for field in ['username', 'email', 'active'] %} {% for field in ['username', 'email', 'active'] %}
<td>{{ data[field] if data[field] }}</td> <th scope="row">{{ data[field] if data[field] }}</th>
{% endfor %} {% endfor %}
<td> <td>
<a href="{{ url_for('admin_toggle_active', username=data['username']) }}"><img src="static/stop.png" title="Aktivieren/Deaktivieren" alt="Toggle active"></a> <a href="{{ url_for('admin_toggle_active', username=data['username']) }}"><img src="static/stop.png" title="Aktivieren/Deaktivieren" alt="Toggle active"></a>
@ -22,6 +25,7 @@
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody>
</table> </table>
<div> <div>
<p> <p>

View File

@ -1,30 +1,92 @@
<!doctype html> <!doctype html>
<title>Space Token Administration - {% block title %}{% endblock %}</title> <html lang="de">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<nav> <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
<ul>
<li><a href="{{ url_for('door_lock') }}">Home</a> <title>Space Token Administration - {% block title %}{% endblock %}</title>
<li><a href="{{ url_for('register') }}">Token Registrierung</a> </head>
<li><a href="{{ url_for('list_tokens') }}">Token Übersicht</a>
<li><a href="{{ url_for('open_door') }}">Tür öffnen</a> <body>
<li><a href="{{ url_for('close_door') }}">Tür schließen</a> <nav class="navbar navbar-expand-lg navbar-light bg-light">
{% if current_user.has_role('super_admin') %} <div class="container-fluid">
<li><a href="{{ url_for('manage_admins') }}">Admins verwalten</a> <a class="navbar-brand" href="{{ url_for('door_lock') }}">iR</a>
{% endif %} <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
{% if current_user.is_authenticated %} {% if current_user.is_authenticated %}
<li><a href="{{ url_for('security.change_password') }}">Passwort ändern</a>
<li><a href="{{ url_for('security.logout') }}">Benutzer <span>{{ current_user.username }}</span> ausloggen</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Tür
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ url_for('open_door') }}">Tür öffnen</a>
<a class="dropdown-item" href="{{ url_for('close_door') }}">Tür schließen</a>
</div>
</li>
{% if current_user.has_role('admin') %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Tokens
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ url_for('register') }}">Token Registrierung</a>
<a class="dropdown-item" href="{{ url_for('list_tokens') }}">Token Übersicht</a>
</div>
</li>
{% endif %}
{% if current_user.has_role('super_admin') %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('manage_admins') }}">Admins verwalten</a>
</li>
{% endif %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Benutzer <span>{{ current_user.username }}</span>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ url_for('security.change_password') }}">Passwort
ändern</a>
<a class="dropdown-item" href="{{ url_for('security.logout') }}">Ausloggen</a>
</div>
</li>
{% else %} {% else %}
<li><a href="{{ url_for('security.login') }}">Einloggen</a> <li class="nav-item">
<a class="nav-link" href="{{ url_for('security.login') }}">Einloggen</a>
</li>
{% endif %} {% endif %}
</ul> </ul>
</div>
</div>
</nav> </nav>
<section class="content"> <section class="content">
<div class="container">
<header> <header>
{% block header %}{% endblock %} {% block header %}{% endblock %}
</header> </header>
{% for message in get_flashed_messages() %} {% for message in get_flashed_messages() %}
<div class="flash">{{ message }}</div> <div class="alert alert-primary" role="alert">
{{ message }}
</div>
{% endfor %} {% endfor %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div>
</section> </section>
<script src="../static/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -1,7 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block header %} {% block header %}
{% block title %}<h1>Token löschen</h1>{% endblock %} {% block title %}<h1>Token löschen</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script> <script src="../static/js/jquery-3.6.0.js"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -1,7 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block header %} {% block header %}
{% block title %}<h1>Admin Benutzer löschen</h1>{% endblock %} {% block title %}<h1>Admin Benutzer löschen</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script> <script src="../static/js/jquery-3.6.0.js"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -1,7 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block header %} {% block header %}
{% block title %}<h1>Token editieren</h1>{% endblock %} {% block title %}<h1>Token editieren</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script> <script src="../static/js/jquery-3.6.0.js"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -1,7 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block header %} {% block header %}
{% block title %}<h1>Token Registrierung</h1>{% endblock %} {% block title %}<h1>Token Registrierung</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script> <script src="../static/js/jquery-3.6.0.js"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -0,0 +1 @@
<!-- empty since messages are already displayed in the base.html template -->

View File

@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block doc -%}
<!DOCTYPE html>
<html{% block html_attribs %}{% endblock html_attribs %}>
{%- block html %}
<head>
{%- block head %}
<title>{% block title %}{{ title|default }}{% endblock title %}</title>
{%- block metas %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{%- endblock metas %}
{%- block styles %}
{%- endblock styles %}
{%- endblock head %}
</head>
<body{% block body_attribs %}{% endblock body_attribs %}>
{% block body -%}
{% block navbar %}
{%- endblock navbar %}
{% block content -%}
{%- endblock content %}
{% block scripts %}
{%- endblock scripts %}
{%- endblock body %}
</body>
{%- endblock html %}
</html>
{% endblock doc -%}

View File

@ -2,17 +2,20 @@
{% block header %} {% block header %}
{% block title %}<h1>Token Übersicht</h1>{% endblock %} {% block title %}<h1>Token Übersicht</h1>{% endblock %}
<script src="../static/jquery-3.6.0.js"></script> <script src="../static/js/jquery-3.6.0.js"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<table border="1"> <table class="table">
<thead>
<td>Token</td> <td>Token</td>
<td>NutzerIn</td> <td>NutzerIn</td>
<td>Organisation</td> <td>Organisation</td>
<td>E-Mail</td> <td>E-Mail</td>
<td>Gültig bis</td> <td>Gültig bis</td>
<td>Aktionen</td> <td>Aktionen</td>
</thead>
<tbody>
{% for t, data in assigned_tokens.items() %} {% for t, data in assigned_tokens.items() %}
<tr> <tr>
<td>{{ t }}</td> <td>{{ t }}</td>
@ -38,6 +41,7 @@
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody>
</table> </table>
<form action="{{ url_for('backup_tokens') }}" method="get"> <form action="{{ url_for('backup_tokens') }}" method="get">
<input type="submit" value="Token Daten sichern"> <input type="submit" value="Token Daten sichern">

View File

@ -201,6 +201,7 @@ def create_application(config):
class ExtendedLoginForm(LoginForm): class ExtendedLoginForm(LoginForm):
email = StringField('Benutzername oder E-Mail', [Required()]) email = StringField('Benutzername oder E-Mail', [Required()])
password = PasswordField('Passwort', [Required()]) password = PasswordField('Passwort', [Required()])
remember = BooleanField('Login merken?')
def validate(self): def validate(self):
# search for user in the current database # search for user in the current database