mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-17 21:49:04 +01:00
Add navigation to user profile
This commit is contained in:
parent
0492c24894
commit
29d4809ab3
@ -201,6 +201,7 @@ class UsersController extends AbstractController
|
||||
'title' => $this->translate('panel.users.userProfile', $user->username()),
|
||||
'user' => $user,
|
||||
'fields' => $fields,
|
||||
...$this->getPreviousAndNextUser($user),
|
||||
]));
|
||||
}
|
||||
|
||||
@ -308,4 +309,19 @@ class UsersController extends AbstractController
|
||||
FileSystem::delete($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{previousUser: ?User, nextUser: ?User}
|
||||
*/
|
||||
protected function getPreviousAndNextUser(User $user): array
|
||||
{
|
||||
$users = $this->site->users()->sortBy('username');
|
||||
|
||||
$userIndex = $users->indexOf($user);
|
||||
|
||||
return [
|
||||
'previousUser' => $users->nth($userIndex - 1),
|
||||
'nextUser' => $users->nth($userIndex + 1),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +329,9 @@ panel.users.deleteUser.prompt: Möchten Sie diesen Benutzer wirklich löschen? D
|
||||
panel.users.newUser: Neuer Benutzer
|
||||
panel.users.newUser.passwordSuggestion: mindestens 8 Zeichen
|
||||
panel.users.newUser.usernameSuggestion: zwischen 3-20 Buchstaben, Ziffern und Bindestriche
|
||||
panel.users.nextUser: Nächster Benutzer
|
||||
panel.users.options: Optionen
|
||||
panel.users.previousUser: Vorheriger Benutzer
|
||||
panel.users.user: Benutzer
|
||||
panel.users.user.cannotChangePassword: Das Passwort eines anderen Benutzers kann nicht geändert werden. Die Aktion ist nicht erlaubt.
|
||||
panel.users.user.cannotChangeRole: Die Rolle von %s kann nicht geändert werden. Die Aktion ist nicht erlaubt.
|
||||
|
@ -329,7 +329,9 @@ panel.users.deleteUser.prompt: Are you sure you want to delete this user? This a
|
||||
panel.users.newUser: New user
|
||||
panel.users.newUser.passwordSuggestion: at least 8 characters
|
||||
panel.users.newUser.usernameSuggestion: between 3-20 letters, digits and dashes
|
||||
panel.users.nextUser: Next user
|
||||
panel.users.options: Options
|
||||
panel.users.previousUser: Previous user
|
||||
panel.users.user: User
|
||||
panel.users.user.cannotChangePassword: Cannot change the password of another user. The action is not allowed.
|
||||
panel.users.user.cannotChangeRole: Cannot change the role of %s. The action is not allowed.
|
||||
|
@ -329,7 +329,9 @@ panel.users.deleteUser.prompt: ¿Estás seguro de que quieres borrar este usuari
|
||||
panel.users.newUser: Nuevo usuario
|
||||
panel.users.newUser.passwordSuggestion: al menos 8 caracteres
|
||||
panel.users.newUser.usernameSuggestion: entre 3 y 20 letras, dígitos y guiones
|
||||
panel.users.nextUser: Usuario siguiente
|
||||
panel.users.options: Opciones
|
||||
panel.users.previousUser: Usuario anterior
|
||||
panel.users.user: Usuario
|
||||
panel.users.user.cannotChangePassword: No se puede cambiar la contraseña de otro usuario. La acción no está permitida.
|
||||
panel.users.user.cannotChangeRole: No se puede cambiar el rol de %s. La acción no está permitida.
|
||||
|
@ -329,7 +329,9 @@ panel.users.deleteUser.prompt: ÊtesVous sûr de vouloir supprimer cet utilisate
|
||||
panel.users.newUser: Nouvel utilisateur
|
||||
panel.users.newUser.passwordSuggestion: au moins 8 caractères
|
||||
panel.users.newUser.usernameSuggestion: entre 3-20 lettres, chiffres et tirets
|
||||
panel.users.nextUser: Utilisateur suivant
|
||||
panel.users.options: Options
|
||||
panel.users.previousUser: Utilisateur précédent
|
||||
panel.users.user: Utilisateur
|
||||
panel.users.user.cannotChangePassword: Impossible de changer le mot de passe d’un autre utilisateur. L’action n’est pas autorisée.
|
||||
panel.users.user.cannotChangeRole: Impossible de changer le rôle de %s. L’action n’est pas autorisée.
|
||||
|
@ -329,7 +329,9 @@ panel.users.deleteUser.prompt: Si è sicuri di eliminare l’utente? Questa azio
|
||||
panel.users.newUser: Nuovo utente
|
||||
panel.users.newUser.passwordSuggestion: almeno 8 caratteri
|
||||
panel.users.newUser.usernameSuggestion: da 3 a 20 lettere, numeri, - e _
|
||||
panel.users.nextUser: Utente successivo
|
||||
panel.users.options: Opzioni
|
||||
panel.users.previousUser: Utente precedente
|
||||
panel.users.user: Utente
|
||||
panel.users.user.cannotChangePassword: Impossibile cambiare la password di un altro utente. L’azione non è consentita.
|
||||
panel.users.user.cannotChangeRole: Impossible cambare il ruolo di %s. L’azione non è consentita.
|
||||
|
@ -329,7 +329,9 @@ panel.users.deleteUser.prompt: Tem a certeza de que deseja excluir este utilizad
|
||||
panel.users.newUser: Novo utilizador
|
||||
panel.users.newUser.passwordSuggestion: pelo menos 8 caracteres
|
||||
panel.users.newUser.usernameSuggestion: entre 3 a 20 letras, números e hifens.
|
||||
panel.users.nextUser: Utilizador seguinte
|
||||
panel.users.options: Opções
|
||||
panel.users.previousUser: Utilizador anterior
|
||||
panel.users.user: Utilizador
|
||||
panel.users.user.cannotChangePassword: Não é possível alterar a senha de outro utilizador. A acção não é permitida.
|
||||
panel.users.user.cannotChangeRole: Não é possível alterar o cargo de %s. A acção não é permitida.
|
||||
|
@ -329,7 +329,9 @@ panel.users.deleteUser.prompt: Вы уверены, что хотите удал
|
||||
panel.users.newUser: Новый пользователь
|
||||
panel.users.newUser.passwordSuggestion: не менее 8 символов
|
||||
panel.users.newUser.usernameSuggestion: между 3-20 букв, цифр и тире
|
||||
panel.users.nextUser: Следующий пользователь
|
||||
panel.users.options: Параметры
|
||||
panel.users.previousUser: Предыдущий пользователь
|
||||
panel.users.user: Пользователь
|
||||
panel.users.user.cannotChangePassword: Невозможно изменить пароль другого пользователя. Действие не допускается.
|
||||
panel.users.user.cannotChangeRole: Невозможно изменить роль %s. Действие не допускается.
|
||||
|
@ -4,6 +4,8 @@
|
||||
<div class="header-title"><?= $this->translate('panel.users.user') ?></div>
|
||||
<?php if ($panel->user()->canChangeOptionsOf($user)) : ?>
|
||||
<div>
|
||||
<a class="<?= $this->classes(['button', 'button-link', 'show-from-md', 'disabled' => !$previousUser]) ?>" role="button" <?php if ($previousUser) : ?>href="<?= $panel->uri('/users/' . $previousUser->username() . '/profile/') ?>" <?php endif ?> title="<?= $this->translate('panel.users.previousUser') ?>" aria-label="<?= $this->translate('panel.users.previousUser') ?>"><?= $this->icon('chevron-left') ?></a>
|
||||
<a class="<?= $this->classes(['button', 'button-link', 'show-from-md', 'disabled' => !$nextUser]) ?>" role="button" <?php if ($nextUser) : ?>href="<?= $panel->uri('/users/' . $nextUser->username() . '/profile/') ?>" <?php endif ?> title="<?= $this->translate('panel.users.nextUser') ?>" aria-label="<?= $this->translate('panel.users.nextUser') ?>"><?= $this->icon('chevron-right') ?></a>
|
||||
<button type="button" class="button button-link" data-modal="deleteUserModal" data-modal-action="<?= $panel->uri('/users/' . $user->username() . '/delete/') ?>" title="<?= $this->translate('panel.users.deleteUser') ?>" aria-label="<?= $this->translate('panel.users.deleteUser') ?>" <?php if (!$panel->user()->canDeleteUser($user)) : ?>disabled<?php endif ?>><?= $this->icon('trash') ?></button>
|
||||
<button type="submit" class="button button-accent" data-command="save"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.save') ?></button>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user