Merge pull request 'UI Updates for Admin Home, Round Two' (#423) from JollyDevelopment/pyfedi:jollydev/admin-tabbed-ui-00 into main

Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/423
This commit is contained in:
rimu 2025-01-17 04:10:39 +00:00
commit e06afb874f
15 changed files with 83 additions and 47 deletions

View file

@ -0,0 +1,21 @@
<div>
<nav id="block_chooser">
<div class="nav nav-tabs nav-justified" id="typeTab" role="tablist">
<a class="nav-link{% if active_child == 'admin_site' %} active{% endif %}" id="site-profile-tab" type="button" role="tab" href="/admin/site" style="view-transition-name: site">{{ _('Site') }}</a>
<a class="nav-link{% if active_child == 'admin_misc' %} active{% endif %}" id="misc-tab" type="button" role="tab" href="/admin/misc" style="view-transition-name: misc">{{ _('Misc') }}</a>
<a class="nav-link{% if active_child == 'admin_communities' %} active{% endif %}" id="communities-tab" type="button" role="tab" href="/admin/communities" style="view-transition-name: communities">{{ _('Communities') }}</a>
<a class="nav-link{% if active_child == 'admin_topics' %} active{% endif %}" id="topics-tab" type="button" role="tab" href="/admin/topics" style="view-transition-name: topics">{{ _('Topics') }}</a>
<a class="nav-link{% if active_child == 'admin_users' %} active{% endif %}" id="users-tab" type="button" role="tab" href="/admin/users" style="view-transition-name: users">{{ _('Users') }}</a>
{% if g.site.registration_mode == 'RequireApplication' %}
<a class="nav-link{% if active_child == 'admin_approve_registrations' %} active{% endif %}" id="users-tab" type="button" role="tab" href="/admin/approve_registrations" style="view-transition-name: approve">{{ _('Registration') }}</a>
{% endif %}
<a class="nav-link{% if active_child == 'admin_content' %} active{% endif %}" id="content-tab" type="button" role="tab" href="/admin/content" style="view-transition-name: content">{{ _('Content') }}</a>
<a class="nav-link{% if active_child == 'admin_reports' %} active{% endif %}" id="moderation-tab" type="button" role="tab" href="/admin/reports" style="view-transition-name: reports">{{ _('Moderation') }}</a>
<a class="nav-link{% if active_child == 'admin_federation' %} active{% endif %}" id="federation-tab" type="button" role="tab" href="/admin/federation" style="view-transition-name: federation">{{ _('Federation') }}</a>
<a class="nav-link{% if active_child == 'admin_instances' %} active{% endif %}" id="instances-tab" type="button" role="tab" href="/admin/instances" style="view-transition-name: instances">{{ _('Instances') }}</a>
<a class="nav-link{% if active_child == 'admin_newsletter' %} active{% endif %}" id="newsletter-tab" type="button" role="tab" href="/admin/newsletter" style="view-transition-name: newsletter">{{ _('Newsletter') }}</a>
<a class="nav-link{% if active_child == 'admin_permissions' %} active{% endif %}" id="permissions-tab" type="button" role="tab" href="/admin/permissions" style="view-transition-name: permissions">{{ _('Permissions') }}</a>
<a class="nav-link{% if active_child == 'admin_activities' %} active{% endif %}" id="activities-tab" type="button" role="tab" href="/admin/activities" style="view-transition-name: activities">{{ _('Activities') }}</a>
</div>
</nav>
</div>

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_activities' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ _('Activities') }}</h1>
@ -20,40 +22,42 @@
<a href="{{ url_for('admin.admin_activities', result=request.args.get('result')) }}">Both</a> |
<a href="{{ url_for('admin.admin_activities', result=request.args.get('result'), direction='in') }}">In</a> |
<a href="{{ url_for('admin.admin_activities', result=request.args.get('result'), direction='out') }}">Out</a>
<table class="table">
<tr>
<th>When</th>
<th>Direction</th>
<th>ID</th>
<th>Type</th>
<th>Result</th>
<th>Message</th>
<th>JSON</th>
</tr>
{% for activity in activities.items %}
<div>
<table class="table">
<tr>
<td>{{ arrow.get(activity.created_at).humanize(locale=locale) }}</td>
<td>{{ activity.direction }}</td>
<td>{{ activity.activity_id }}</td>
<td>{{ activity.activity_type if activity.activity_type else '' }}</td>
{% if activity.result == 'success' %}
<td><span style="color: green;">{{ activity.result }}</span></td>
{% elif activity.result == 'ignored' %}
<td><span style="color: orange;">{{ activity.result }}</span></td>
{% else %}
<td><span style="color: red;">{{ activity.result }}</span></td>
{% endif %}
<td>{{ activity.exception_message if activity.exception_message else '' }}</td>
<td>
{% if activity.activity_json is none %}
None
{% else %}
<a href="{{ url_for('admin.activity_json', activity_id=activity.id) }}">View</a>
{% endif %}
</td>
<th>When</th>
<th>Direction</th>
<th>ID</th>
<th>Type</th>
<th>Result</th>
<th>Message</th>
<th>JSON</th>
</tr>
{% endfor %}
</table>
{% for activity in activities.items %}
<tr>
<td>{{ arrow.get(activity.created_at).humanize(locale=locale) }}</td>
<td>{{ activity.direction }}</td>
<td>{{ activity.activity_id }}</td>
<td>{{ activity.activity_type if activity.activity_type else '' }}</td>
{% if activity.result == 'success' %}
<td><span style="color: green;">{{ activity.result }}</span></td>
{% elif activity.result == 'ignored' %}
<td><span style="color: orange;">{{ activity.result }}</span></td>
{% else %}
<td><span style="color: red;">{{ activity.result }}</span></td>
{% endif %}
<td>{{ activity.exception_message if activity.exception_message else '' }}</td>
<td>
{% if activity.activity_json is none %}
None
{% else %}
<a href="{{ url_for('admin.activity_json', activity_id=activity.id) }}">View</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
<nav aria-label="Pagination" class="mt-4" role="navigation">
{% if prev_url %}
<a href="{{ prev_url }}" class="btn btn-primary" rel="nofollow">

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_approve_registrations' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ _('Registrations') }}</h1>

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_communities' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ title }}</h1>

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_content' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ _('Content') }}</h1>

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_federation' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_instances' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ title }}</h1>

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_misc' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ _('Misc settings') }}</h1>

View file

@ -3,6 +3,8 @@
{% set active_child = 'admin_newsletter' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_permissions' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_reports' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ _('Reports') }}</h1>

View file

@ -6,8 +6,11 @@
{% from 'bootstrap/form.html' import render_field %}
{% set active_child = 'admin_site' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ _('Site profile') }}</h1>

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_topics' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
{% macro render_topic(topic, depth) %}
<tr>
<td nowrap="nowrap">{{ '--' * depth }} <a href="/topic/{{ topic['topic'].path() }}">{{ topic['topic'].name }}</a></td>

View file

@ -7,6 +7,8 @@
{% set active_child = 'admin_users' %}
{% block app_content %}
{% include 'admin/_tabbed_nav.html' %}
<br>
<div class="row">
<div class="col">
<h1>{{ _('Users') }}</h1>

View file

@ -228,21 +228,7 @@
<li class="nav-item dropdown{% if active_parent == 'admin' %} active{% endif %}">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="/admin/" aria-haspopup="true" aria-expanded="false">{{ _('Admin') }}</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_site' }}" href="{{ url_for('admin.admin_site') }}">{{ _('Site profile') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_misc' }}" href="{{ url_for('admin.admin_misc') }}">{{ _('Misc settings') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_communities' }}" href="{{ url_for('admin.admin_communities') }}">{{ _('Communities') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_topics' }}" href="{{ url_for('admin.admin_topics') }}">{{ _('Topics') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_users' }}" href="{{ url_for('admin.admin_users', local_remote='local') }}">{{ _('Users') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_content' }}" href="{{ url_for('admin.admin_content') }}">{{ _('Content') }}</a></li>
{% if g.site.registration_mode == 'RequireApplication' %}
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_approve_registrations' }}" href="{{ url_for('admin.admin_approve_registrations') }}">{{ _('Registration applications') }}</a></li>
{% endif %}
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_reports' }}" href="{{ url_for('admin.admin_reports') }}">{{ _('Moderation') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_federation' }}" href="{{ url_for('admin.admin_federation') }}">{{ _('Federation') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_instances' }}" href="{{ url_for('admin.admin_instances') }}">{{ _('Instances') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_newsletter' }}" href="{{ url_for('admin.newsletter') }}">{{ _('Newsletter') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_permissions' }}" href="{{ url_for('admin.admin_permissions') }}">{{ _('Permissions') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_activities' }}" href="{{ url_for('admin.admin_activities') }}">{{ _('Activities') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_site' }}" href="{{ url_for('admin.admin_site') }}">{{ _('Home') }}</a></li>
<li><a class="dropdown-item{{ ' active' if active_child == 'modlog' }}" href="{{ url_for('main.modlog') }}">{{ _('Modlog') }}</a></li>
{% if debug_mode %}
<li><a class="dropdown-item{{ ' active' if active_child == 'dev_tools' }}" href="{{ url_for('dev.tools') }}">{{ _('Dev Tools') }}</a></li>