From d18b77c83af9667080485f235e36e535cbed1857 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 18 May 2021 10:09:02 +0200 Subject: [PATCH] add link to tree in navigation index --- .../Site/NavigationAdminController.php | 1 + core/Entity/Site/Menu.php | 12 ++--- core/Entity/Site/Node.php | 40 ++++++++-------- core/Entity/Site/Page/Block.php | 8 ++-- .../views/admin/crud/index.html.twig | 48 ++++++++++--------- .../site/navigation_admin/index.html.twig | 7 +++ 6 files changed, 63 insertions(+), 53 deletions(-) create mode 100644 core/Resources/views/site/navigation_admin/index.html.twig diff --git a/core/Controller/Site/NavigationAdminController.php b/core/Controller/Site/NavigationAdminController.php index 0fb3bbf..340205a 100644 --- a/core/Controller/Site/NavigationAdminController.php +++ b/core/Controller/Site/NavigationAdminController.php @@ -83,6 +83,7 @@ class NavigationAdminController extends CrudController ->setForm('edit', Type::class, []) ->setForm('new', Type::class) + ->setView('index', '@Core/site/navigation_admin/index.html.twig') ->setView('show_entity', '@Core/site/navigation_admin/_show.html.twig') ->setView('form', '@Core/site/navigation_admin/_form.html.twig') diff --git a/core/Entity/Site/Menu.php b/core/Entity/Site/Menu.php index 963c2a0..7728c36 100644 --- a/core/Entity/Site/Menu.php +++ b/core/Entity/Site/Menu.php @@ -22,34 +22,34 @@ class Menu implements EntityInterface * @ORM\GeneratedValue * @ORM\Column(type="integer") */ - private $id; + protected $id; /** * @ORM\Column(type="string", length=255) */ - private $label; + protected $label; /** * @ORM\Column(type="string", length=255) */ - private $code; + protected $code; /** * @ORM\ManyToOne(targetEntity=Navigation::class, inversedBy="menus") * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ - private $navigation; + protected $navigation; /** * @ORM\OneToMany(targetEntity=Node::class, mappedBy="menu", orphanRemoval=true, cascade={"remove", "persist"}) */ - private $nodes; + protected $nodes; /** * @ORM\OneToOne(targetEntity=Node::class, cascade={"persist"}) * @ORM\JoinColumn(onDelete="CASCADE") */ - private $rootNode; + protected $rootNode; public function __construct() { diff --git a/core/Entity/Site/Node.php b/core/Entity/Site/Node.php index 4ca798f..134e870 100644 --- a/core/Entity/Site/Node.php +++ b/core/Entity/Site/Node.php @@ -26,112 +26,112 @@ class Node implements EntityInterface * @ORM\GeneratedValue * @ORM\Column(type="integer") */ - private $id; + protected $id; /** * @ORM\ManyToOne(targetEntity=Menu::class, inversedBy="nodes", cascade={"persist", "remove"}) * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ - private $menu; + protected $menu; /** * @ORM\Column(type="string", length=255, nullable=true) */ - private $label; + protected $label; /** * @ORM\Column(type="string", length=255, nullable=true) */ - private $url; + protected $url; /** * @ORM\Column(type="boolean", options={"default"=0}) */ - private $disableUrl = false; + protected $disableUrl = false; /** * @ORM\Column(type="boolean", options={"default"=0}) */ - private $isVisible = false; + protected $isVisible = false; /** * @Gedmo\TreeLeft * @ORM\Column(type="integer") */ - private $treeLeft; + protected $treeLeft; /** * @Gedmo\TreeLevel * @ORM\Column(type="integer") */ - private $treeLevel; + protected $treeLevel; /** * @Gedmo\TreeRight * @ORM\Column(type="integer") */ - private $treeRight; + protected $treeRight; /** * @Gedmo\TreeRoot * @ORM\ManyToOne(targetEntity="Node") * @ORM\JoinColumn(referencedColumnName="id", onDelete="CASCADE") */ - private $treeRoot; + protected $treeRoot; /** * @Gedmo\TreeParent * @ORM\ManyToOne(targetEntity="Node", inversedBy="children") * @ORM\JoinColumn(referencedColumnName="id", onDelete="CASCADE") */ - private $parent; + protected $parent; /** * @ORM\OneToMany(targetEntity="Node", mappedBy="parent") * @ORM\OrderBy({"treeLeft"="ASC"}) */ - private $children; + protected $children; /** * @ORM\ManyToOne(targetEntity=Page::class, inversedBy="nodes", cascade={"persist"}) * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") */ - private $page; + protected $page; /** * @ORM\Column(type="string", length=255, nullable=true) */ - private $code; + protected $code; /** * @ORM\Column(type="array", nullable=true) */ - private $parameters = []; + protected $parameters = []; /** * @ORM\Column(type="array", nullable=true) */ - private $attributes = []; + protected $attributes = []; /** * @ORM\Column(type="string", length=255, nullable=true) */ - private $controller; + protected $controller; /** * @ORM\Column(type="array", nullable=true) */ - private $sitemapParameters = []; + protected $sitemapParameters = []; /** * @ORM\ManyToOne(targetEntity=Node::class, inversedBy="aliasNodes") */ - private $aliasNode; + protected $aliasNode; /** * @ORM\OneToMany(targetEntity=Node::class, mappedBy="aliasNode") */ - private $aliasNodes; + protected $aliasNodes; public function __construct() { diff --git a/core/Entity/Site/Page/Block.php b/core/Entity/Site/Page/Block.php index 6180d75..978bd01 100644 --- a/core/Entity/Site/Page/Block.php +++ b/core/Entity/Site/Page/Block.php @@ -21,23 +21,23 @@ class Block * @ORM\GeneratedValue * @ORM\Column(type="integer") */ - private $id; + protected $id; /** * @ORM\Column(type="string", length=255) */ - private $name; + protected $name; /** * @ORM\Column(type="text", nullable=true) */ - private $value; + protected $value; /** * @ORM\ManyToOne(targetEntity=Page::class, inversedBy="blocks") * @ORM\JoinColumn(onDelete="CASCADE") */ - private $page; + protected $page; public function getId(): ?int { diff --git a/core/Resources/views/admin/crud/index.html.twig b/core/Resources/views/admin/crud/index.html.twig index 06ea73c..51b62af 100644 --- a/core/Resources/views/admin/crud/index.html.twig +++ b/core/Resources/views/admin/crud/index.html.twig @@ -150,32 +150,34 @@ {% endfor %} - {% if configuration.action('index', 'show', true) or configuration.action('index', 'edit', true) or configuration.action('index', 'delete', true) %} - - {% if configuration.action('index', 'show', true) %} - - - - {% endif %} + + {% block list_item_actions_before %}{% endblock %} - {% if configuration.action('index', 'edit', true) %} - - - - {% endif %} + {% if configuration.action('index', 'show', true) %} + + + + {% endif %} - {% if configuration.action('index', 'delete', true) %} - + {% if configuration.action('index', 'edit', true) %} + + + + {% endif %} -
- - -
- {% endif %} - - {% endif %} + {% if configuration.action('index', 'delete', true) %} + + +
+ + +
+ {% endif %} + + {% block list_item_actions_after %}{% endblock %} + {% endblock %} {% else %} diff --git a/core/Resources/views/site/navigation_admin/index.html.twig b/core/Resources/views/site/navigation_admin/index.html.twig new file mode 100644 index 0000000..29fb1be --- /dev/null +++ b/core/Resources/views/site/navigation_admin/index.html.twig @@ -0,0 +1,7 @@ +{% extends '@Core/admin/crud/index.html.twig' %} + +{% block list_item_actions_before %} + + + +{% endblock %}