Skip to content

Commit

Permalink
Fix sidebar for academy user
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayvented committed Nov 23, 2023
1 parent 8c564ff commit 23defde
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
40 changes: 22 additions & 18 deletions src/Service/MenuService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,30 @@ public function createMainMenu(array $options): ItemInterface
return $menu;
}

public function createElementsMenu(array $options): ItemInterface
public function createElementsMenu(array $options): ?ItemInterface
{
$menu = $this->factory->createItem('root');

$menu->addChild($this->trans('auditQuestions'), ['route' => 'audit_tom']);
$menu->addChild($this->trans('dataCategories'), ['route' => 'app_vvtdatenkategorie_index']);
$menu->addChild($this->trans('toms'), ['route' => 'tom']);
$menu->addChild($this->trans('processings'), ['route' => 'vvt']);
$menu->addChild($this->trans('deleteConcepts'), ['route' => 'app_loeschkonzept_index']);
$menu->addChild($this->trans('policies'), ['route' => 'policies']);
$menu->addChild($this->trans('contacts'), ['route' => 'kontakt']);
$menu->addChild($this->trans('dataTransfers'), ['route' => 'datenweitergabe']);
$menu->addChild($this->trans('orderProcessing'), ['route' => 'auftragsverarbeitung']);
$menu->addChild($this->trans('software'), ['route' => 'software']);
$menu->addChild($this->trans('forms'), ['route' => 'forms']);
$menu->addChild($this->trans('incidents'), ['route' => 'vorfall']);
$menu->addChild($this->trans('customerQuestions'), ['route' => 'client_requests']);
$menu->addChild($this->trans('activities'), ['route' => 'report']);

$this->handleCurrentItem($menu);

if (!$this->user->getTeams()->isEmpty()) {
$menu->addChild($this->trans('auditQuestions'), ['route' => 'audit_tom']);
$menu->addChild($this->trans('dataCategories'), ['route' => 'app_vvtdatenkategorie_index']);
$menu->addChild($this->trans('toms'), ['route' => 'tom']);
$menu->addChild($this->trans('processings'), ['route' => 'vvt']);
$menu->addChild($this->trans('deleteConcepts'), ['route' => 'app_loeschkonzept_index']);
$menu->addChild($this->trans('policies'), ['route' => 'policies']);
$menu->addChild($this->trans('contacts'), ['route' => 'kontakt']);
$menu->addChild($this->trans('dataTransfers'), ['route' => 'datenweitergabe']);
$menu->addChild($this->trans('orderProcessing'), ['route' => 'auftragsverarbeitung']);
$menu->addChild($this->trans('software'), ['route' => 'software']);
$menu->addChild($this->trans('forms'), ['route' => 'forms']);
$menu->addChild($this->trans('incidents'), ['route' => 'vorfall']);
$menu->addChild($this->trans('customerQuestions'), ['route' => 'client_requests']);
$menu->addChild($this->trans('activities'), ['route' => 'report']);

$this->handleCurrentItem($menu);

return $menu;
}

return $menu;
}
Expand Down
6 changes: 4 additions & 2 deletions templates/base/__sidenav.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

{{ knp_menu_render('main') }}

<div class="label">{% trans %}elements{% endtrans %}</div>
{{ knp_menu_render('elements') }}
{% if app.user.teams|length %}
<div class="label">{% trans %}elements{% endtrans %}</div>
{{ knp_menu_render('elements') }}
{% endif %}

{% if app.user.akademieUser %}
<div class="label">{% trans %}academy{% endtrans %}</div>
Expand Down

0 comments on commit 23defde

Please sign in to comment.