From 0f319a100331450387d464300a0c66dedebd234d Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 9 May 2022 16:22:17 +0200 Subject: [PATCH] admin: reorganising activity menu and submenus --- .../Menu/AdminMenuBuilder.php | 44 +++++++++++-------- .../views/ActivityPresence/edit.html.twig | 6 +-- .../views/ActivityPresence/index.html.twig | 2 +- .../views/ActivityPresence/new.html.twig | 12 ++--- .../views/ActivityReason/edit.html.twig | 18 +------- .../views/ActivityReason/index.html.twig | 24 +++------- .../views/ActivityReason/new.html.twig | 18 +------- .../views/ActivityReason/show.html.twig | 18 +------- .../ActivityReasonCategory/edit.html.twig | 18 +------- .../ActivityReasonCategory/index.html.twig | 18 +------- .../ActivityReasonCategory/new.html.twig | 18 +------- .../ActivityReasonCategory/show.html.twig | 18 +------- .../views/ActivityType/edit.html.twig | 4 +- .../views/ActivityType/index.html.twig | 18 +------- .../views/ActivityType/new.html.twig | 4 +- .../views/ActivityTypeCategory/edit.html.twig | 14 +++--- .../ActivityTypeCategory/index.html.twig | 2 +- .../views/ActivityTypeCategory/new.html.twig | 12 ++--- .../views/Admin/layout_activity.html.twig | 2 +- .../views/Admin/menu_activity.html.twig | 18 -------- .../ChillActivityBundle/config/routes.yaml | 28 +----------- .../config/routes/activityreason.yaml | 5 --- .../config/routes/activityreasoncategory.yaml | 5 --- .../ChillCalendarExtension.php | 1 - .../Admin/layoutWithVerticalMenu.html.twig | 3 +- 25 files changed, 71 insertions(+), 259 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index 13c3b3e6a..72f938c88 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -15,8 +15,6 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Security; -use function in_array; - final class AdminMenuBuilder implements LocalMenuBuilderInterface { private Security $security; @@ -32,23 +30,31 @@ final class AdminMenuBuilder implements LocalMenuBuilderInterface return; } - if (in_array($menuId, ['admin_index', 'admin_section'], true)) { - $menu->addChild('Activities', [ - 'route' => 'chill_admin_activity_index', - ]) - ->setExtras([ - 'order' => 2000, - 'explain' => 'Activity configuration', - ]); - } else { - $menu - ->addChild('Activities', [ - 'route' => 'chill_admin_activity_index', - ]) - ->setExtras([ - 'order' => '60', - ]); - } + $menu->addChild('Activities', [ + 'route' => 'chill_activity_admin_index', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras(['order' => 5000, 'header' => true]); + + $menu->addChild('Activity Reasons', [ + 'route' => 'chill_activity_activityreason', + ])->setExtras(['order' => 5010]); + + $menu->addChild('Activity Reasons Category', [ + 'route' => 'chill_activity_activityreasoncategory', + ])->setExtras(['order' => 5020]); + + $menu->addChild('Activity type', [ + 'route' => 'chill_activity_type_admin', + ])->setExtras(['order' => 5030]); + + $menu->addChild('Activity Presences', [ + 'route' => 'chill_crud_activity_presence_index', + ])->setExtras(['order' => 5040]); + + $menu->addChild('Activity Types Categories', [ + 'route' => 'chill_activity_type_category_admin', + ])->setExtras(['order' => 5050]); } public static function getMenuIds(): array diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/edit.html.twig index 16cf893e8..194aa8eea 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/edit.html.twig @@ -1,10 +1,10 @@ -{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} {% block title %} -{% include('@ChillMain/CRUD/_edit_title.html.twig') %} + {% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% endblock %} -{% block layout_wvm_content %} +{% block admin_content %} {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% block content_form_actions_view %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/index.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/index.html.twig index b3d1ec9f2..954b7c653 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/index.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/index.html.twig @@ -1,4 +1,4 @@ -{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} {% block admin_content %}

{{ 'ActivityPresence list'|trans }}

diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/new.html.twig index c95711529..00ebd2938 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/new.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityPresence/new.html.twig @@ -1,11 +1,11 @@ -{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} {% block title %} -{% include('@ChillMain/CRUD/_new_title.html.twig') %} + {% include('@ChillMain/CRUD/_new_title.html.twig') %} {% endblock %} -{% block layout_wvm_content %} -{% embed '@ChillMain/CRUD/_new_content.html.twig' %} - {% block content_form_actions_save_and_show %}{% endblock %} -{% endembed %} +{% block admin_content %} + {% embed '@ChillMain/CRUD/_new_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/edit.html.twig index 60089fa6f..04bb46ca2 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/edit.html.twig @@ -1,20 +1,4 @@ -{# - * Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block admin_content %}

{{ 'ActivityReason edit'|trans }}

diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig index 0dff9b5c4..7d9e5f71d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig @@ -1,20 +1,4 @@ -{# - * Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block admin_content %}

{{ 'ActivityReason list'|trans }}

@@ -45,7 +29,11 @@ -