Refactoring table into partial file

This commit is contained in:
Michael Bergbauer 2025-07-19 11:32:33 +02:00
parent b4305aa7fa
commit 80577d89de
2 changed files with 34 additions and 27 deletions

View File

@ -1,6 +1,6 @@
{% extends "master.html" %}
{% load static %}
{% load svg %}
{% block title %}
@ -10,34 +10,13 @@
{% block content %}
<div class="member-table">
<h1>{{ mymember.vorname }} {{ mymember.nachname }}</h1>
<p>Geburtsdatum: {{ mymember.geburtsdatum }}</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Rolle</th>
<th>Aktiv</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for x in accounts %}
<tr>
<td>{{ x.username }}</td>
<td>{{ x.rolle }}</td>
<td>{% if x.aktiv %}{% inline_svg 'icons/uxwing/check.svg' 'icon' %}{% endif %}</td>
<td><a href="{% url 'edit_account' x.id %}" title="Bearbeiten"><img src="{% static 'icons/heroicons/pencil.svg'%}" class="icon"></a> <a href="{% url 'delete_account' x.id %}" title="Löschen"><img src="{% static 'icons/heroicons/trash.svg'%}" class="icon"></a></td>
</tr>
{% endfor %}
<tr>
<td colspan="4">
<a href="{% url 'create_account' mymember.id %}" class="button"><img src="{% static 'icons/heroicons/plus.svg'%}" class="icon"> Konto hinzufügen</a>
</td>
</tr>
</tbody>
</table>
<div class="mb-4">
<h2 class="h5">Accounts</h2>
{% include "partials/account_table.html" %}
</div>
<p>Back to <a href="/members">Members</a></p>

View File

@ -0,0 +1,28 @@
{% load static %}
{% load svg %}
<table>
<thead>
<tr>
<th>Name</th>
<th>Rolle</th>
<th>Aktiv</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for x in accounts %}
<tr>
<td>{{ x.username }}</td>
<td>{{ x.rolle }}</td>
<td>{% if x.aktiv %}{% inline_svg 'icons/uxwing/check.svg' 'icon' %}{% endif %}</td>
<td><a href="{% url 'edit_account' x.id %}" title="Bearbeiten"><img src="{% static 'icons/heroicons/pencil.svg'%}" class="icon"></a> <a href="{% url 'delete_account' x.id %}" title="Löschen"><img src="{% static 'icons/heroicons/trash.svg'%}" class="icon"></a></td>
</tr>
{% endfor %}
<tr>
<td colspan="4">
<a href="{% url 'create_account' mymember.id %}" class="button"><img src="{% static 'icons/heroicons/plus.svg'%}" class="icon"> Konto hinzufügen</a>
</td>
</tr>
</tbody>
</table>