From 2430e998367bc9b0a3fd292119218b6d8bc5be7b Mon Sep 17 00:00:00 2001 From: Lukas Juhrich Date: Fri, 7 Jun 2024 17:26:36 +0200 Subject: [PATCH] user_show: Move tab definitions to jinja template --- web/blueprints/user/__init__.py | 50 ------------------------------ web/templates/user/user_show.html | 51 +++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/web/blueprints/user/__init__.py b/web/blueprints/user/__init__.py index 04dcd057f..60f78e31e 100644 --- a/web/blueprints/user/__init__.py +++ b/web/blueprints/user/__init__.py @@ -381,56 +381,6 @@ def user_show(user_id: int) -> ResponseReturnValue: tenancy_table=TenancyTable( data_url=url_for(".tenancies_json", user_id=user.id) ), - tabs=[ - { - 'id': 'hosts', - 'icon': 'fa-laptop', - 'name': 'Hosts', - 'badge': len(user.hosts) - }, - { - 'id': 'tasks', - 'icon': 'fa-clipboard-check', - 'name': 'Tasks', - 'badge': len(user.tasks), - 'badge_color': '#d9534f' if len(user.tasks) > 0 else None - }, - { - 'id': 'logs', - 'icon': 'fa-list-ul', - 'name': 'Logs', - 'badge': len(user.log_entries) - }, - { - 'id': 'traffic', - 'icon': 'fa-chart-area', - 'name': 'Traffic', - }, - { - 'id': 'finance', - 'icon': 'fa-euro-sign', - 'name': 'Finanzen', - }, - { - 'id': 'groups', - 'icon': 'fa-users-cog', - 'name': 'Gruppen', - 'badge': len(user.active_memberships()) - }, - { - 'id': 'room_history', - 'icon': 'fa-history', - 'name': 'Wohnorte', - 'badge': len(user.room_history_entries) - }, - { - 'id': 'tenancies', - 'icon': 'fa-file-signature', - 'name': 'Mietverträge', - 'badge': len(user.tenancies), - 'disabled': len(user.tenancies) == 0, - }, - ] ) diff --git a/web/templates/user/user_show.html b/web/templates/user/user_show.html index e920aecb3..dfa9a5c35 100644 --- a/web/templates/user/user_show.html +++ b/web/templates/user/user_show.html @@ -9,6 +9,57 @@ {% import "macros/forms.html" as forms %} {% import "macros/resources.html" as resources %} +{% set tabs = [ + { + 'id': 'hosts', + 'icon': 'fa-laptop', + 'name': 'Hosts', + 'badge': user.hosts | length + }, + { + 'id': 'tasks', + 'icon': 'fa-clipboard-check', + 'name': 'Tasks', + 'badge': user.tasks | length, + 'badge_color': '#d9534f' if user.tasks | length > 0 else None + }, + { + 'id': 'logs', + 'icon': 'fa-list-ul', + 'name': 'Logs', + 'badge': user.log_entries | length + }, + { + 'id': 'traffic', + 'icon': 'fa-chart-area', + 'name': 'Traffic', + }, + { + 'id': 'finance', + 'icon': 'fa-euro-sign', + 'name': 'Finanzen', + }, + { + 'id': 'groups', + 'icon': 'fa-users-cog', + 'name': 'Gruppen', + 'badge': user.active_memberships() | length + }, + { + 'id': 'room_history', + 'icon': 'fa-history', + 'name': 'Wohnorte', + 'badge': user.room_history_entries | length + }, + { + 'id': 'tenancies', + 'icon': 'fa-file-signature', + 'name': 'Mietverträge', + 'badge': user.tenancies | length, + 'disabled': user.tenancies | length == 0, + }, +] +%} {% block content %} {# Stammdaten #}