mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 01:49:05 +02:00
Show user avatar next to its name, in all possible locations
This commit is contained in:
parent
29bce6f19f
commit
97b87dee5f
9 changed files with 143 additions and 47 deletions
|
@ -44,6 +44,7 @@ use App\Exceptions\EntityNotSupportedException;
|
|||
use App\Repository\LogEntryRepository;
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use App\Services\UserSystem\UserAvatarHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Omines\DataTablesBundle\Adapter\Doctrine\ORM\SearchCriteriaProvider;
|
||||
|
@ -66,9 +67,11 @@ class LogDataTable implements DataTableTypeInterface
|
|||
protected EntityURLGenerator $entityURLGenerator;
|
||||
protected LogEntryRepository $logRepo;
|
||||
protected Security $security;
|
||||
protected UserAvatarHelper $userAvatarHelper;
|
||||
|
||||
public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator,
|
||||
UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, Security $security)
|
||||
UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager,
|
||||
Security $security, UserAvatarHelper $userAvatarHelper)
|
||||
{
|
||||
$this->elementTypeNameGenerator = $elementTypeNameGenerator;
|
||||
$this->translator = $translator;
|
||||
|
@ -76,6 +79,7 @@ class LogDataTable implements DataTableTypeInterface
|
|||
$this->entityURLGenerator = $entityURLGenerator;
|
||||
$this->logRepo = $entityManager->getRepository(AbstractLogEntry::class);
|
||||
$this->security = $security;
|
||||
$this->userAvatarHelper = $userAvatarHelper;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $optionsResolver): void
|
||||
|
@ -227,8 +231,11 @@ class LogDataTable implements DataTableTypeInterface
|
|||
);
|
||||
}
|
||||
|
||||
$img_url = $this->userAvatarHelper->getAvatarSmURL($user);
|
||||
|
||||
return sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
'<img src="%s" class="rounded" style="height: 1.2rem;"> <a href="%s">%s</a>',
|
||||
$img_url,
|
||||
$this->urlGenerator->generate('user_info', ['id' => $user->getID()]),
|
||||
htmlentities($user->getFullName(true))
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue