Skip to content

Commit

Permalink
user_show: Move tab definitions to jinja template
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed Jun 7, 2024
1 parent a2593da commit 2430e99
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 50 deletions.
50 changes: 0 additions & 50 deletions web/blueprints/user/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
]
)


Expand Down
51 changes: 51 additions & 0 deletions web/templates/user/user_show.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 #}
<section id="master-data">
Expand Down

0 comments on commit 2430e99

Please sign in to comment.