From c6f7124b1ed2d1eb66841196d6af8170eaa45b92 Mon Sep 17 00:00:00 2001 From: FK Date: Thu, 18 Feb 2021 16:55:37 +0100 Subject: [PATCH] Fixes - remove section in crud view (removes additional padding of c0ntent) - BackendNavigationService: restrict removing of root node in navigation tree to sidebar --- .../Services/BackendNavigationService.php | 8 +- .../Backend/CRUD/Components/ViewBase.twig | 4 +- Themes/Base/Backend/CRUD/Index.twig | 108 +++++++++--------- 3 files changed, 58 insertions(+), 62 deletions(-) diff --git a/Engine/Modules/AdminBackend/Core/Services/BackendNavigationService.php b/Engine/Modules/AdminBackend/Core/Services/BackendNavigationService.php index 7d4c1ac93..36fef316f 100644 --- a/Engine/Modules/AdminBackend/Core/Services/BackendNavigationService.php +++ b/Engine/Modules/AdminBackend/Core/Services/BackendNavigationService.php @@ -125,7 +125,7 @@ public function getNavigationTree(string $position) : array { /** @var BackendNavigation[] $entries */ $entries = $this->repository()->findBy(['position' => $position, 'visible' => true, 'active' => true], ['order' => 'ASC']); $tree = TreeHelper::modelArrayToTree($entries, 'parent', '0', 'name'); - $this->filterTreeByPermission($permissionService, $user, $tree); + $this->filterTreeByPermission($permissionService, $user, $tree, $position); return $tree; } catch (Exception $exception) { @@ -246,7 +246,7 @@ private function initActiveEndpointsData() { * @param array $user * @param array $array */ - private function filterTreeByPermission(PermissionService $permissionService, ?array $user, array &$array) { + private function filterTreeByPermission(PermissionService $permissionService, ?array $user, array &$array, string $position) { foreach ($array as $index => &$item) { $checkChildren = true; if ($item['parent'] !== '0' && !empty($item['path'])) { @@ -274,13 +274,13 @@ private function filterTreeByPermission(PermissionService $permissionService, ?a } if ($checkChildren && isset($item['children'])) { if ($checkChildren) { - $this->filterTreeByPermission($permissionService, $user, $item['children']); + $this->filterTreeByPermission($permissionService, $user, $item['children'], $position); } if (empty($item['children'])) { unset($array[$index]); } } - if ($item['parent'] === '0' && (!isset($item['children']) || empty($item['children']))) { + if ($item['parent'] === '0' && (!isset($item['children']) || empty($item['children'])) && $position === 'sidebar') { unset($array[$index]); } } diff --git a/Themes/Base/Backend/CRUD/Components/ViewBase.twig b/Themes/Base/Backend/CRUD/Components/ViewBase.twig index f4cccc81c..571e87cc3 100644 --- a/Themes/Base/Backend/CRUD/Components/ViewBase.twig +++ b/Themes/Base/Backend/CRUD/Components/ViewBase.twig @@ -18,7 +18,5 @@ {% endblock %} {% block pagecontent %} -
- {% include CRUD_path('Components/Form.twig') with { item: crud.item } %} -
+ {% include CRUD_path('Components/Form.twig') with { item: crud.item } %} {% endblock %} diff --git a/Themes/Base/Backend/CRUD/Index.twig b/Themes/Base/Backend/CRUD/Index.twig index 21e2ea746..9dc5a4b30 100644 --- a/Themes/Base/Backend/CRUD/Index.twig +++ b/Themes/Base/Backend/CRUD/Index.twig @@ -1,66 +1,64 @@ {% extends 'Backend/Master/Index.twig' %} {% block pagecontent %} -
-
-
-
-
+
+
+
+
+
+
+ {% block crud_actions_row %} +

+ {% block crud_actions_group_items %} + + + + {% endblock crud_actions_group_items %} +

+ {% endblock crud_actions_row %} +
+
+ {% include CRUD_path('Components/Index/FilterBar.twig') with { + crud: crud, + meta: meta + } %} + {% if crud.hasEditors %} +
+ {% endif %} + {# {% include CRUD_path('Components/Index/PaginationRow.twig') with { #} + {# pagination: crud.pagination, #} + {# queryKeys: crud.queryKeys, #} + {# route: meta.route #} + {# } only %} #}
-
- {% block crud_actions_row %} -

- {% block crud_actions_group_items %} - - - - {% endblock crud_actions_group_items %} -

- {% endblock crud_actions_row %} +
+ {% include CRUD_path('Components/Index/Table.twig') %}
- {% include CRUD_path('Components/Index/FilterBar.twig') with { - crud: crud, - meta: meta - } %} + {% include CRUD_path('Components/Index/PaginationRow.twig') with { + pagination: crud.pagination, + queryKeys: crud.queryKeys, + route: meta.route + } only %} {% if crud.hasEditors %} - - {% endif %} - {#{% include CRUD_path('Components/Index/PaginationRow.twig') with {#} - {# pagination: crud.pagination,#} - {# queryKeys: crud.queryKeys,#} - {# route: meta.route#} - {#} only %}#} -
-
- {% include CRUD_path('Components/Index/Table.twig') %} -
-
- {% include CRUD_path('Components/Index/PaginationRow.twig') with { - pagination: crud.pagination, - queryKeys: crud.queryKeys, - route: meta.route - } only %} - {% if crud.hasEditors %} -

-
-
-
- - -
+

+
+
+
+ +
- - {% endif %} -
{# /.box-body #} -
{# /.box #} -
+
+ + {% endif %} +
{# /.box-body #} +
{# /.box #}
-
+ {% endblock pagecontent %}