admin blueprint

This commit is contained in:
2023-06-08 19:58:07 +02:00
parent f7064811d7
commit bc57f6f747
12 changed files with 288 additions and 253 deletions

View File

@@ -0,0 +1,40 @@
<table id="report-table"
class="table table-striped table-hover table-bordered bg-light"
data-toggle="table"
data-sticky-header="true"
data-sticky-header-offset-y="65"
data-sortable="true">
<thead>
<tr class="bg-primary text-white">
<th class="text-center">Username</th>
<th class="text-center">Email</th>
<th class="text-center">Date Created</th>
<th class="text-center">Last Login</th>
<th class="text-center">Is Admin</th>
<th class="text-center">Benchmark</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td class="text-center">{{ user.date_created.strftime("%d-%m-%Y, %T") }}</td>
<td class="text-center">{{ user.last_login.strftime("%d-%m-%Y, %T") }}</td>
<td class="text-center">
<input type="checkbox" onclick="return false" {{ "checked" if user.admin else "" }}>
</td>
<td>{{ user.benchmark.name }}</td>
<td>
<a href="{{ url_for("admin.user_edit", user_id=user.id) }}"
class="btn btn-primary"><span><i class="mdi mdi-account"></i></span></a>
<a href="{{ url_for("admin.user_delete", user_id=user.id) }}"
class="btn btn-danger"><i class="mdi mdi-account-remove"></i></a>
<a href="{{ url_for("admin.password", user_id=user.id, back="admin.users") }}"
class="btn btn-warning"><i class="mdi mdi-lock-reset"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,12 @@
{% extends "base.html" %}
{% from 'bootstrap5/form.html' import render_form %}
{% block content %}
<div class="alert alert-info col-md-4" role="alert">
<h4 class="alert-heading">Change password for {{ user_name }}</h4>
<button class="btn btn-primary"
onclick="window.location.href='{{ url_for(back) }}'">Back</button>
<div class="row">
<div>{{ render_form(form) }}</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% extends "base.html" %}
{% from 'bootstrap5/form.html' import render_form %}
{% block content %}
<div class="alert alert-{{ alert_type }} col-md-4" role="alert">
<h4 class="alert-heading">{{ title }}</h4>
<button class="btn btn-primary"
onclick="window.location.href='{{ url_for("admin.users") }}'">Back</button>
<div class="row">
<div>{{ render_form(form) }}</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,20 @@
{% extends "report_tables.html" %}
{% block content %}
<div class="container col-7">
<div class="alert alert-primary" role="alert">
<div class="navbar">
<div class="float-left">
<h2>
User <b>Management</b>
</h2>
</div>
<div class="float-end">
<a href="{{ url_for("admin.user_new") }}" class="btn btn-primary"><span><i class="mdi mdi-plus-circle"></i> Add New User</span></a>
</div>
</div>
<hr>
</div>
<div class="float-left">{% include "_table_users.html" %}</div>
</div>
</div>
{% endblock content %}