mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Added node menu
This commit is contained in:
parent
368cbebbc1
commit
5c2a45b467
@ -40,6 +40,24 @@ class NodeController extends AbstractEntityController
|
|||||||
return $this->redirectToRouteById('app_law_show',$lawId);
|
return $this->redirectToRouteById('app_law_show',$lawId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/node/{id}/parents.{_format}", defaults={"_format"="html"})
|
||||||
|
*/
|
||||||
|
public function parents(int $id):Response{
|
||||||
|
/**
|
||||||
|
* @todo Implement
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/node/{id}/childs.{_format}", defaults={"_format"="html"})
|
||||||
|
*/
|
||||||
|
public function childs(int $id):Response{
|
||||||
|
/**
|
||||||
|
* @todo Implement
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
protected function setEntityName(): void
|
protected function setEntityName(): void
|
||||||
{
|
{
|
||||||
$this->entityName = Node::class;
|
$this->entityName = Node::class;
|
||||||
|
@ -61,7 +61,7 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getRequestId(Event $event): int
|
protected function getRequestId(Event $event): int
|
||||||
{
|
{
|
||||||
return $event->getRequest()->getCurrentRequest()->attributes->get('id');
|
return $event->getRequest()->getCurrentRequest()->attributes->get('id');
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
namespace App\Subscriber;
|
namespace App\Subscriber;
|
||||||
|
|
||||||
use App\DBAL\Types\MenuEventType;
|
use App\DBAL\Types\MenuEventType;
|
||||||
|
use App\Event\Menu\MenuEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -10,6 +11,39 @@ use App\DBAL\Types\MenuEventType;
|
|||||||
*/
|
*/
|
||||||
class NodeMenuSubscriber extends AbstractEntityMenuSubscriber
|
class NodeMenuSubscriber extends AbstractEntityMenuSubscriber
|
||||||
{
|
{
|
||||||
|
public function onNodeMenuConfigure(MenuEvent $event): void
|
||||||
|
{
|
||||||
|
$menu = $event->getItem();
|
||||||
|
$this->generateShowDropdown($menu, $event,'app_source_show');
|
||||||
|
$menu->addChild($this->translator->trans('law'), [
|
||||||
|
'route' => 'app_node_law',
|
||||||
|
'routeParameters' => [
|
||||||
|
'id' => $this->getRequestId($event),
|
||||||
|
],
|
||||||
|
'attributes' => [
|
||||||
|
'icon' => 'fa fa-gavel',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$menu->addChild($this->translator->trans('parents'), [
|
||||||
|
'route' => 'app_node_parents',
|
||||||
|
'routeParameters' => [
|
||||||
|
'id' => $this->getRequestId($event),
|
||||||
|
],
|
||||||
|
'attributes' => [
|
||||||
|
'icon' => 'fa fa-female',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$menu->addChild($this->translator->trans('childs'), [
|
||||||
|
'route' => 'app_node_childs',
|
||||||
|
'routeParameters' => [
|
||||||
|
'id' => $this->getRequestId($event),
|
||||||
|
],
|
||||||
|
'attributes' => [
|
||||||
|
'icon' => 'fa fa-child',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
public static function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -13,7 +13,7 @@ class SourceMenuSubscriber extends AbstractEntityMenuSubscriber
|
|||||||
$menu->addChild($this->translator->trans('edit'), [
|
$menu->addChild($this->translator->trans('edit'), [
|
||||||
'route' => 'app_source_edit',
|
'route' => 'app_source_edit',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'id' => $event->getRequest()->getCurrentRequest()->attributes->get('id'),
|
'id' => $this->getRequestId($event),
|
||||||
],
|
],
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'icon' => 'fas fa-edit',
|
'icon' => 'fas fa-edit',
|
||||||
@ -23,7 +23,7 @@ class SourceMenuSubscriber extends AbstractEntityMenuSubscriber
|
|||||||
$menu->addChild($this->translator->trans('node'), [
|
$menu->addChild($this->translator->trans('node'), [
|
||||||
'route' => 'app_source_node',
|
'route' => 'app_source_node',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'id' => $event->getRequest()->getCurrentRequest()->attributes->get('id'),
|
'id' => $this->getRequestId($event),
|
||||||
],
|
],
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'icon' => 'fas fa-globe',
|
'icon' => 'fas fa-globe',
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse"
|
||||||
|
data-target="#navbarSupportedContent"
|
||||||
|
aria-controls="navbarSupportedContent" aria-expanded="false"
|
||||||
|
aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
{{ knp_menu_render('nodeSubbar', {'currentClass': 'active', 'template': 'frames/structure/navbar/knp_menu.html.twig'}) }}
|
||||||
|
</div>
|
||||||
|
</nav>
|
@ -3,4 +3,7 @@
|
|||||||
{% trans %}
|
{% trans %}
|
||||||
Node
|
Node
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
|
{% endblock %}
|
||||||
|
{% block sub_navigation %}
|
||||||
|
{% include 'frames/structure/navbar/node_sub.html.twig'%}
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user