1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-23 14:59:36 +02:00

feat: enhance adventure sorting by adding date and rating filters, update admin settings localization for OIDC

This commit is contained in:
Sean Morley 2025-01-08 17:08:53 -05:00
parent f670fbc93a
commit a883d4104d
11 changed files with 117 additions and 29 deletions

View file

@ -20,6 +20,7 @@ from django.contrib.auth import get_user_model
from icalendar import Calendar, Event, vText, vCalAddress from icalendar import Calendar, Event, vText, vCalAddress
from django.http import HttpResponse from django.http import HttpResponse
from datetime import datetime from datetime import datetime
from django.db.models import Min
User = get_user_model() User = get_user_model()
@ -44,17 +45,25 @@ class AdventureViewSet(viewsets.ModelViewSet):
order_direction = self.request.query_params.get('order_direction', 'asc') order_direction = self.request.query_params.get('order_direction', 'asc')
include_collections = self.request.query_params.get('include_collections', 'true') include_collections = self.request.query_params.get('include_collections', 'true')
valid_order_by = ['name', 'type', 'start_date', 'rating', 'updated_at'] valid_order_by = ['name', 'type', 'date', 'rating', 'updated_at']
if order_by not in valid_order_by: if order_by not in valid_order_by:
order_by = 'name' order_by = 'name'
if order_direction not in ['asc', 'desc']: if order_direction not in ['asc', 'desc']:
order_direction = 'asc' order_direction = 'asc'
if order_by == 'date':
# order by the earliest visit object associated with the adventure
queryset = queryset.annotate(earliest_visit=Min('visits__start_date'))
queryset = queryset.filter(earliest_visit__isnull=False)
ordering = 'earliest_visit'
# Apply case-insensitive sorting for the 'name' field # Apply case-insensitive sorting for the 'name' field
if order_by == 'name': elif order_by == 'name':
queryset = queryset.annotate(lower_name=Lower('name')) queryset = queryset.annotate(lower_name=Lower('name'))
ordering = 'lower_name' ordering = 'lower_name'
elif order_by == 'rating':
queryset = queryset.filter(rating__isnull=False)
ordering = 'rating'
else: else:
ordering = order_by ordering = order_by

View file

@ -284,7 +284,8 @@
"email_required": "E-Mail ist erforderlich", "email_required": "E-Mail ist erforderlich",
"both_passwords_required": "Beide Passwörter sind erforderlich", "both_passwords_required": "Beide Passwörter sind erforderlich",
"new_password": "Neues Passwort", "new_password": "Neues Passwort",
"reset_failed": "Passwort konnte nicht zurückgesetzt werden" "reset_failed": "Passwort konnte nicht zurückgesetzt werden",
"or_3rd_party": "Oder melden Sie sich bei einem Drittanbieter an"
}, },
"users": { "users": {
"no_users_found": "Keine Benutzer mit öffentlichen Profilen gefunden." "no_users_found": "Keine Benutzer mit öffentlichen Profilen gefunden."
@ -369,7 +370,15 @@
"csrf_failed": "CSRF-Token konnte nicht abgerufen werden", "csrf_failed": "CSRF-Token konnte nicht abgerufen werden",
"duplicate_email": "Diese E-Mail-Adresse wird bereits verwendet.", "duplicate_email": "Diese E-Mail-Adresse wird bereits verwendet.",
"email_taken": "Diese E-Mail-Adresse wird bereits verwendet.", "email_taken": "Diese E-Mail-Adresse wird bereits verwendet.",
"username_taken": "Dieser Benutzername wird bereits verwendet." "username_taken": "Dieser Benutzername wird bereits verwendet.",
"administration_settings": "Verwaltungseinstellungen",
"documentation_link": "Dokumentationslink",
"launch_account_connections": "Kontoverbindungen starten",
"launch_administration_panel": "Starten Sie das Administrationspanel",
"no_verified_email_warning": "Sie müssen über eine verifizierte E-Mail-Adresse verfügen, um die Zwei-Faktor-Authentifizierung zu aktivieren.",
"social_auth_desc": "Aktivieren oder deaktivieren Sie soziale und OIDC-Authentifizierungsanbieter für Ihr Konto. \nMit diesen Verbindungen können Sie sich bei selbst gehosteten Authentifizierungsidentitätsanbietern wie Authentik oder Drittanbietern wie GitHub anmelden.",
"social_auth_desc_2": "Diese Einstellungen werden auf dem AdventureLog-Server verwaltet und müssen vom Administrator manuell aktiviert werden.",
"social_oidc_auth": "Soziale und OIDC-Authentifizierung"
}, },
"checklist": { "checklist": {
"add_item": "Artikel hinzufügen", "add_item": "Artikel hinzufügen",

View file

@ -371,7 +371,14 @@
"duplicate_email": "This email address is already in use.", "duplicate_email": "This email address is already in use.",
"csrf_failed": "Failed to fetch CSRF token", "csrf_failed": "Failed to fetch CSRF token",
"email_taken": "This email address is already in use.", "email_taken": "This email address is already in use.",
"username_taken": "This username is already in use." "username_taken": "This username is already in use.",
"administration_settings": "Administration Settings",
"launch_administration_panel": "Launch Administration Panel",
"social_oidc_auth": "Social and OIDC Authentication",
"social_auth_desc": "Enable or disable social and OIDC authentication providers for your account. These connections allow you to sign in with self hosted authentication identity providers like Authentik or 3rd party providers like GitHub.",
"social_auth_desc_2": "These settings are managed in the AdventureLog server and must be manually enabled by the administrator.",
"documentation_link": "Documentation Link",
"launch_account_connections": "Launch Account Connections"
}, },
"collection": { "collection": {
"collection_created": "Collection created successfully!", "collection_created": "Collection created successfully!",

View file

@ -295,7 +295,8 @@
"email_required": "Se requiere correo electrónico", "email_required": "Se requiere correo electrónico",
"both_passwords_required": "Se requieren ambas contraseñas", "both_passwords_required": "Se requieren ambas contraseñas",
"new_password": "Nueva contraseña", "new_password": "Nueva contraseña",
"reset_failed": "No se pudo restablecer la contraseña" "reset_failed": "No se pudo restablecer la contraseña",
"or_3rd_party": "O inicie sesión con un servicio de terceros"
}, },
"users": { "users": {
"no_users_found": "No se encontraron usuarios con perfiles públicos." "no_users_found": "No se encontraron usuarios con perfiles públicos."
@ -369,7 +370,15 @@
"csrf_failed": "No se pudo recuperar el token CSRF", "csrf_failed": "No se pudo recuperar el token CSRF",
"duplicate_email": "Esta dirección de correo electrónico ya está en uso.", "duplicate_email": "Esta dirección de correo electrónico ya está en uso.",
"email_taken": "Esta dirección de correo electrónico ya está en uso.", "email_taken": "Esta dirección de correo electrónico ya está en uso.",
"username_taken": "Este nombre de usuario ya está en uso." "username_taken": "Este nombre de usuario ya está en uso.",
"administration_settings": "Configuración de administración",
"documentation_link": "Enlace de documentación",
"launch_account_connections": "Iniciar conexiones de cuenta",
"launch_administration_panel": "Iniciar el panel de administración",
"no_verified_email_warning": "Debe tener una dirección de correo electrónico verificada para habilitar la autenticación de dos factores.",
"social_auth_desc": "Habilite o deshabilite los proveedores de autenticación social y OIDC para su cuenta. \nEstas conexiones le permiten iniciar sesión con proveedores de identidad de autenticación autohospedados como Authentik o proveedores externos como GitHub.",
"social_auth_desc_2": "Estas configuraciones se administran en el servidor AdventureLog y el administrador debe habilitarlas manualmente.",
"social_oidc_auth": "Autenticación social y OIDC"
}, },
"checklist": { "checklist": {
"add_item": "Agregar artículo", "add_item": "Agregar artículo",

View file

@ -284,7 +284,8 @@
"email_required": "L'e-mail est requis", "email_required": "L'e-mail est requis",
"both_passwords_required": "Les deux mots de passe sont requis", "both_passwords_required": "Les deux mots de passe sont requis",
"new_password": "Nouveau mot de passe", "new_password": "Nouveau mot de passe",
"reset_failed": "Échec de la réinitialisation du mot de passe" "reset_failed": "Échec de la réinitialisation du mot de passe",
"or_3rd_party": "Ou connectez-vous avec un service tiers"
}, },
"users": { "users": {
"no_users_found": "Aucun utilisateur trouvé avec des profils publics." "no_users_found": "Aucun utilisateur trouvé avec des profils publics."
@ -369,7 +370,15 @@
"csrf_failed": "Échec de la récupération du jeton CSRF", "csrf_failed": "Échec de la récupération du jeton CSRF",
"duplicate_email": "Cette adresse e-mail est déjà utilisée.", "duplicate_email": "Cette adresse e-mail est déjà utilisée.",
"email_taken": "Cette adresse e-mail est déjà utilisée.", "email_taken": "Cette adresse e-mail est déjà utilisée.",
"username_taken": "Ce nom d'utilisateur est déjà utilisé." "username_taken": "Ce nom d'utilisateur est déjà utilisé.",
"administration_settings": "Paramètres d'administration",
"documentation_link": "Lien vers la documentation",
"launch_account_connections": "Lancer les connexions au compte",
"launch_administration_panel": "Lancer le panneau d'administration",
"no_verified_email_warning": "Vous devez disposer d'une adresse e-mail vérifiée pour activer l'authentification à deux facteurs.",
"social_auth_desc": "Activez ou désactivez les fournisseurs d'authentification sociale et OIDC pour votre compte. \nCes connexions vous permettent de vous connecter avec des fournisseurs d'identité d'authentification auto-hébergés comme Authentik ou des fournisseurs tiers comme GitHub.",
"social_auth_desc_2": "Ces paramètres sont gérés sur le serveur AdventureLog et doivent être activés manuellement par l'administrateur.",
"social_oidc_auth": "Authentification sociale et OIDC"
}, },
"checklist": { "checklist": {
"add_item": "Ajouter un article", "add_item": "Ajouter un article",

View file

@ -284,7 +284,8 @@
"email_required": "L'e-mail è obbligatoria", "email_required": "L'e-mail è obbligatoria",
"both_passwords_required": "Sono necessarie entrambe le password", "both_passwords_required": "Sono necessarie entrambe le password",
"new_password": "Nuova parola d'ordine", "new_password": "Nuova parola d'ordine",
"reset_failed": "Impossibile reimpostare la password" "reset_failed": "Impossibile reimpostare la password",
"or_3rd_party": "Oppure accedi con un servizio di terze parti"
}, },
"users": { "users": {
"no_users_found": "Nessun utente trovato con profili pubblici." "no_users_found": "Nessun utente trovato con profili pubblici."
@ -369,7 +370,15 @@
"csrf_failed": "Impossibile recuperare il token CSRF", "csrf_failed": "Impossibile recuperare il token CSRF",
"duplicate_email": "Questo indirizzo email è già in uso.", "duplicate_email": "Questo indirizzo email è già in uso.",
"email_taken": "Questo indirizzo email è già in uso.", "email_taken": "Questo indirizzo email è già in uso.",
"username_taken": "Questo nome utente è già in uso." "username_taken": "Questo nome utente è già in uso.",
"administration_settings": "Impostazioni di amministrazione",
"documentation_link": "Collegamento alla documentazione",
"launch_account_connections": "Avvia Connessioni account",
"launch_administration_panel": "Avvia il pannello di amministrazione",
"no_verified_email_warning": "È necessario disporre di un indirizzo e-mail verificato per abilitare l'autenticazione a due fattori.",
"social_auth_desc": "Abilita o disabilita i provider di autenticazione social e OIDC per il tuo account. \nQueste connessioni ti consentono di accedere con provider di identità di autenticazione self-hosted come Authentik o provider di terze parti come GitHub.",
"social_auth_desc_2": "Queste impostazioni sono gestite nel server AdventureLog e devono essere abilitate manualmente dall'amministratore.",
"social_oidc_auth": "Autenticazione sociale e OIDC"
}, },
"checklist": { "checklist": {
"add_item": "Aggiungi articolo", "add_item": "Aggiungi articolo",

View file

@ -284,7 +284,8 @@
"email_required": "E-mail is vereist", "email_required": "E-mail is vereist",
"both_passwords_required": "Beide wachtwoorden zijn vereist", "both_passwords_required": "Beide wachtwoorden zijn vereist",
"new_password": "Nieuw wachtwoord", "new_password": "Nieuw wachtwoord",
"reset_failed": "Kan het wachtwoord niet opnieuw instellen" "reset_failed": "Kan het wachtwoord niet opnieuw instellen",
"or_3rd_party": "Of log in met een service van derden"
}, },
"users": { "users": {
"no_users_found": "Er zijn geen gebruikers gevonden met openbare profielen." "no_users_found": "Er zijn geen gebruikers gevonden met openbare profielen."
@ -369,7 +370,15 @@
"csrf_failed": "Kan CSRF-token niet ophalen", "csrf_failed": "Kan CSRF-token niet ophalen",
"duplicate_email": "Dit e-mailadres is al in gebruik.", "duplicate_email": "Dit e-mailadres is al in gebruik.",
"email_taken": "Dit e-mailadres is al in gebruik.", "email_taken": "Dit e-mailadres is al in gebruik.",
"username_taken": "Deze gebruikersnaam is al in gebruik." "username_taken": "Deze gebruikersnaam is al in gebruik.",
"administration_settings": "Beheerinstellingen",
"documentation_link": "Documentatielink",
"launch_account_connections": "Start Accountverbindingen",
"launch_administration_panel": "Start het Beheerpaneel",
"no_verified_email_warning": "U moet een geverifieerd e-mailadres hebben om tweefactorauthenticatie in te schakelen.",
"social_auth_desc": "Schakel sociale en OIDC-authenticatieproviders in of uit voor uw account. \nMet deze verbindingen kunt u inloggen met zelfgehoste authenticatie-identiteitsproviders zoals Authentik of externe providers zoals GitHub.",
"social_auth_desc_2": "Deze instellingen worden beheerd op de AdventureLog-server en moeten handmatig worden ingeschakeld door de beheerder.",
"social_oidc_auth": "Sociale en OIDC-authenticatie"
}, },
"checklist": { "checklist": {
"add_item": "Artikel toevoegen", "add_item": "Artikel toevoegen",

View file

@ -295,7 +295,8 @@
"email_required": "Adres e-mail jest wymagany", "email_required": "Adres e-mail jest wymagany",
"both_passwords_required": "Obydwa hasła są wymagane", "both_passwords_required": "Obydwa hasła są wymagane",
"new_password": "Nowe hasło", "new_password": "Nowe hasło",
"reset_failed": "Nie udało się zresetować hasła" "reset_failed": "Nie udało się zresetować hasła",
"or_3rd_party": "Lub zaloguj się za pomocą usługi strony trzeciej"
}, },
"users": { "users": {
"no_users_found": "Nie znaleziono użytkowników z publicznymi profilami." "no_users_found": "Nie znaleziono użytkowników z publicznymi profilami."
@ -369,7 +370,15 @@
"csrf_failed": "Nie udało się pobrać tokena CSRF", "csrf_failed": "Nie udało się pobrać tokena CSRF",
"duplicate_email": "Ten adres e-mail jest już używany.", "duplicate_email": "Ten adres e-mail jest już używany.",
"email_taken": "Ten adres e-mail jest już używany.", "email_taken": "Ten adres e-mail jest już używany.",
"username_taken": "Ta nazwa użytkownika jest już używana." "username_taken": "Ta nazwa użytkownika jest już używana.",
"administration_settings": "Ustawienia administracyjne",
"documentation_link": "Link do dokumentacji",
"launch_account_connections": "Uruchom Połączenia kont",
"launch_administration_panel": "Uruchom Panel administracyjny",
"no_verified_email_warning": "Aby włączyć uwierzytelnianie dwuskładnikowe, musisz mieć zweryfikowany adres e-mail.",
"social_auth_desc": "Włącz lub wyłącz dostawców uwierzytelniania społecznościowego i OIDC dla swojego konta. \nPołączenia te umożliwiają logowanie się za pośrednictwem dostawców tożsamości uwierzytelniających, takich jak Authentik, lub dostawców zewnętrznych, takich jak GitHub.",
"social_auth_desc_2": "Ustawienia te są zarządzane na serwerze AdventureLog i muszą zostać włączone ręcznie przez administratora.",
"social_oidc_auth": "Uwierzytelnianie społecznościowe i OIDC"
}, },
"collection": { "collection": {
"collection_created": "Kolekcja została pomyślnie utworzona!", "collection_created": "Kolekcja została pomyślnie utworzona!",

View file

@ -295,7 +295,8 @@
"email_required": "E-post krävs", "email_required": "E-post krävs",
"both_passwords_required": "Båda lösenorden krävs", "both_passwords_required": "Båda lösenorden krävs",
"new_password": "Nytt lösenord", "new_password": "Nytt lösenord",
"reset_failed": "Det gick inte att återställa lösenordet" "reset_failed": "Det gick inte att återställa lösenordet",
"or_3rd_party": "Eller logga in med en tredjepartstjänst"
}, },
"users": { "users": {
"no_users_found": "Inga användare hittades med offentliga profiler." "no_users_found": "Inga användare hittades med offentliga profiler."
@ -369,7 +370,15 @@
"csrf_failed": "Det gick inte att hämta CSRF-token", "csrf_failed": "Det gick inte att hämta CSRF-token",
"duplicate_email": "Den här e-postadressen används redan.", "duplicate_email": "Den här e-postadressen används redan.",
"email_taken": "Den här e-postadressen används redan.", "email_taken": "Den här e-postadressen används redan.",
"username_taken": "Detta användarnamn används redan." "username_taken": "Detta användarnamn används redan.",
"administration_settings": "Administrationsinställningar",
"documentation_link": "Dokumentationslänk",
"launch_account_connections": "Starta kontoanslutningar",
"launch_administration_panel": "Starta administrationspanelen",
"no_verified_email_warning": "Du måste ha en verifierad e-postadress för att aktivera tvåfaktorsautentisering.",
"social_auth_desc": "Aktivera eller inaktivera sociala och OIDC-autentiseringsleverantörer för ditt konto. \nDessa anslutningar gör att du kan logga in med leverantörer av autentiseringsidentitetsidentitet som är värd för dig som Authentik eller tredjepartsleverantörer som GitHub.",
"social_auth_desc_2": "Dessa inställningar hanteras i AdventureLog-servern och måste aktiveras manuellt av administratören.",
"social_oidc_auth": "Social och OIDC-autentisering"
}, },
"checklist": { "checklist": {
"add_item": "Lägg till objekt", "add_item": "Lägg till objekt",

View file

@ -284,7 +284,8 @@
"email_required": "电子邮件为必填项", "email_required": "电子邮件为必填项",
"both_passwords_required": "两个密码都需要", "both_passwords_required": "两个密码都需要",
"new_password": "新密码", "new_password": "新密码",
"reset_failed": "重置密码失败" "reset_failed": "重置密码失败",
"or_3rd_party": "或者使用第三方服务登录"
}, },
"worldtravel": { "worldtravel": {
"all": "全部", "all": "全部",
@ -369,7 +370,15 @@
"csrf_failed": "获取 CSRF 令牌失败", "csrf_failed": "获取 CSRF 令牌失败",
"duplicate_email": "该电子邮件地址已被使用。", "duplicate_email": "该电子邮件地址已被使用。",
"email_taken": "该电子邮件地址已被使用。", "email_taken": "该电子邮件地址已被使用。",
"username_taken": "该用户名已被使用。" "username_taken": "该用户名已被使用。",
"administration_settings": "管理设置",
"documentation_link": "文档链接",
"launch_account_connections": "启动帐户连接",
"launch_administration_panel": "启动管理面板",
"no_verified_email_warning": "您必须拥有经过验证的电子邮件地址才能启用双因素身份验证。",
"social_auth_desc": "为您的帐户启用或禁用社交和 OIDC 身份验证提供商。\n这些连接允许您使用自托管身份验证身份提供商如 Authentik或第三方提供商如 GitHub登录。",
"social_auth_desc_2": "这些设置在 AdventureLog 服务器中进行管理,并且必须由管理员手动启用。",
"social_oidc_auth": "社交和 OIDC 身份验证"
}, },
"checklist": { "checklist": {
"add_item": "添加项目", "add_item": "添加项目",

View file

@ -436,10 +436,12 @@
<!-- Admin Settings --> <!-- Admin Settings -->
{#if user.is_staff} {#if user.is_staff}
<section class="space-y-8"> <section class="space-y-8">
<h2 class="text-2xl font-semibold text-center mt-8">Administration Settings</h2> <h2 class="text-2xl font-semibold text-center mt-8">
{$t('settings.administration_settings')}
</h2>
<div class="bg-neutral p-6 rounded-lg shadow-md text-center"> <div class="bg-neutral p-6 rounded-lg shadow-md text-center">
<a class="btn btn-primary mt-4" href={`${public_url}/admin/`} target="_blank" <a class="btn btn-primary mt-4" href={`${public_url}/admin/`} target="_blank"
>Launch Administration Pannel</a >{$t('settings.launch_administration_panel')}</a
> >
</div> </div>
</section> </section>
@ -447,12 +449,10 @@
<!-- Social Auth Settings --> <!-- Social Auth Settings -->
<section class="space-y-8"> <section class="space-y-8">
<h2 class="text-2xl font-semibold text-center mt-8">Social and ODIC Authentication</h2> <h2 class="text-2xl font-semibold text-center mt-8">{$t('settings.social_oidc_auth')}</h2>
<div class="bg-neutral p-6 rounded-lg shadow-md text-center"> <div class="bg-neutral p-6 rounded-lg shadow-md text-center">
<p> <p>
Enable or disable social and OIDC authentication providers for your account. These {$t('settings.social_auth_desc')}
connections allow you to sign in with self hosted authentication identity providers like
Authentik or 3rd party providers like GitHub.
</p> </p>
<div role="alert" class="alert alert-info mt-2"> <div role="alert" class="alert alert-info mt-2">
<svg <svg
@ -469,18 +469,18 @@
></path> ></path>
</svg> </svg>
<span <span
>These settings are managed in the AdventureLog server and must be manually enabled by the >{$t('settings.social_auth_desc_2')}
administrator. <a <a
href="https://adventurelog.app/docs/configuration/social_auth.html" href="https://adventurelog.app/docs/configuration/social_auth.html"
class="link link-neutral" class="link link-neutral"
target="_blank">Documentation Link</a target="_blank">{$t('settings.documentation_link')}</a
>. >.
</span> </span>
</div> </div>
<a <a
class="btn btn-primary mt-4" class="btn btn-primary mt-4"
href={`${public_url}/accounts/social/connections/`} href={`${public_url}/accounts/social/connections/`}
target="_blank">Launch Account Connections</a target="_blank">{$t('settings.launch_account_connections')}</a
> >
</div> </div>
</section> </section>