From 82a679c233b17f0741a7f53d877572e21f7ba1ec Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 25 Oct 2021 11:16:17 +0200 Subject: [PATCH] improve location: admin menu --- .../Controller/AdminController.php | 5 +++ .../views/Admin/layout_location.html.twig | 33 +++++++++++++++++++ .../views/Admin/menu_admin_location.html.twig | 20 +++++++++++ .../Resources/views/Location/index.html.twig | 2 +- .../views/LocationType/index.html.twig | 2 +- .../MenuBuilder/AdminSectionMenuBuilder.php | 15 ++------- .../MenuBuilder/LocationMenuBuilder.php | 29 ++++++++++++++++ src/Bundle/ChillMainBundle/config/routes.yaml | 4 +++ 8 files changed, 96 insertions(+), 14 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Admin/layout_location.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Admin/menu_admin_location.html.twig create mode 100644 src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php diff --git a/src/Bundle/ChillMainBundle/Controller/AdminController.php b/src/Bundle/ChillMainBundle/Controller/AdminController.php index 1c6569eea..1fe10ef08 100644 --- a/src/Bundle/ChillMainBundle/Controller/AdminController.php +++ b/src/Bundle/ChillMainBundle/Controller/AdminController.php @@ -41,4 +41,9 @@ class AdminController extends AbstractController return $this->render('@ChillMain/Admin/layout_permissions.html.twig'); } + public function indexLocationsAction() + { + return $this->render('@ChillMain/Admin/layout_location.html.twig'); + } + } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/layout_location.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/layout_location.html.twig new file mode 100644 index 000000000..fc0708af9 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/layout_location.html.twig @@ -0,0 +1,33 @@ +{# + * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, + / + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . +#} + +{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} + +{% block vertical_menu_content %} + {{ chill_menu('admin_location', { + 'layout': '@ChillMain/Admin/menu_admin_location.html.twig', + }) }} +{% endblock %} + + + +{% block layout_wvm_content %} + {% block admin_content %} +

{{ 'Management of location' |trans }}

+ {% endblock %} +{% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/menu_admin_location.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/menu_admin_location.html.twig new file mode 100644 index 000000000..b4112ff60 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/menu_admin_location.html.twig @@ -0,0 +1,20 @@ +{# + * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, + / + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . +#} + +{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} +{% block v_menu_title %}{{ 'Location Menu'|trans }}{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig index a57e1653e..cc35be33a 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig @@ -1,4 +1,4 @@ -{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} +{% extends "@ChillMain/Admin/layout_location.html.twig" %} {% block admin_content %}

{{ 'Location list'|trans }}

diff --git a/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig index 84010d721..ec617c6c0 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig @@ -1,4 +1,4 @@ -{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} +{% extends "@ChillMain/Admin/layout_location.html.twig" %} {% block admin_content %}

{{ 'Location type list'|trans }}

diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php index 288c4a81f..7f41dbf67 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php @@ -55,22 +55,13 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface 'explain' => "Configure permissions for users" ]); - $menu->addChild('Location', [ - 'route' => 'chill_crud_main_location_index' + $menu->addChild('Location and location type', [ + 'route' => 'chill_main_admin_locations' ]) ->setExtras([ 'icons' => ['key'], 'order' => 205, - 'explain' => "Configure location" - ]); - - $menu->addChild('Location type', [ - 'route' => 'chill_crud_main_location_type_index' - ]) - ->setExtras([ - 'icons' => ['key'], - 'order' => 205, - 'explain' => "Configure location type" + 'explain' => "Configure location and location type" ]); } diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php new file mode 100644 index 000000000..966dce57d --- /dev/null +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php @@ -0,0 +1,29 @@ +addChild('Location list', [ + 'route' => 'chill_crud_main_location_index' + ])->setExtras(['order' => 205]); + + $menu->addChild('Location type list', [ + 'route' => 'chill_crud_main_location_type_index' + ])->setExtras(['order' => 206]); + + } +} diff --git a/src/Bundle/ChillMainBundle/config/routes.yaml b/src/Bundle/ChillMainBundle/config/routes.yaml index 9a155f6e6..bebdf8f52 100644 --- a/src/Bundle/ChillMainBundle/config/routes.yaml +++ b/src/Bundle/ChillMainBundle/config/routes.yaml @@ -66,6 +66,10 @@ chill_main_admin_permissions: path: /{_locale}/admin/permissions controller: Chill\MainBundle\Controller\AdminController::indexPermissionsAction +chill_main_admin_locations: + path: /{_locale}/admin/locations + controller: Chill\MainBundle\Controller\AdminController::indexLocationsAction + chill_main_search: path: /{_locale}/search.{_format} controller: Chill\MainBundle\Controller\SearchController::searchAction