User profile layout (#2402)

This commit is contained in:
Kevin Papst
2021-03-06 12:34:34 +01:00
committed by GitHub
parent d3099aca39
commit 5583caa9e4
30 changed files with 550 additions and 268 deletions

View File

@@ -24,6 +24,7 @@ final class IconExtension extends AbstractExtension
'audit' => 'fas fa-history',
'avatar' => 'fas fa-user',
'back' => 'fas fa-long-arrow-alt-left',
'barcode' => 'fas fa-barcode',
'calendar' => 'far fa-calendar-alt',
'clock' => 'far fa-clock',
'comment' => 'far fa-comment',
@@ -51,6 +52,7 @@ final class IconExtension extends AbstractExtension
'left' => 'fas fa-chevron-left',
'list' => 'fas fa-list',
'locked' => 'fas fa-lock',
'login' => 'fas fa-sign-in-alt',
'logout' => 'fas fa-sign-out-alt',
'mail' => 'fas fa-envelope-open',
'mail-sent' => 'fas fa-paper-plane',

View File

@@ -10,6 +10,7 @@
namespace App\Twig\Runtime;
use App\Entity\User;
use App\Event\PageActionsEvent;
use App\Event\ThemeEvent;
use App\Event\ThemeJavascriptTranslationsEvent;
use Symfony\Bridge\Twig\AppVariable;
@@ -51,6 +52,23 @@ final class ThemeExtension implements RuntimeExtensionInterface
return $themeEvent;
}
public function actions(User $user, string $action, array $payload): ThemeEvent
{
if (!\array_key_exists('actions', $payload)) {
$payload['actions'] = [];
}
$themeEvent = new PageActionsEvent($user, $payload, $action);
$eventName = 'actions.' . $action;
if ($this->eventDispatcher->hasListeners($eventName)) {
$this->eventDispatcher->dispatch($themeEvent, $eventName);
}
return $themeEvent;
}
public function getJavascriptTranslations(): array
{
$event = new ThemeJavascriptTranslationsEvent();

View File

@@ -28,6 +28,7 @@ class RuntimeExtensions extends AbstractExtension
{
return [
new TwigFunction('trigger', [ThemeExtension::class, 'trigger'], ['needs_environment' => true]),
new TwigFunction('actions', [ThemeExtension::class, 'actions']),
new TwigFunction('javascript_translations', [ThemeExtension::class, 'getJavascriptTranslations']),
new TwigFunction('timesheet_exporter', [ExporterExtension::class, 'getTimesheetExporter']),
new TwigFunction('active_timesheets', [TimesheetExtension::class, 'activeEntries']),