diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Admin/layout_activity.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Admin/layout_activity.html.twig index 4b51457f6..4705ed4ce 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Admin/layout_activity.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Admin/layout_activity.html.twig @@ -20,7 +20,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_activity', { - 'layout': '@ChillActivity/Admin/menu_activity.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Admin/menu_activity.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Admin/menu_activity.html.twig deleted file mode 100644 index 0a9f7386a..000000000 --- a/src/Bundle/ChillActivityBundle/Resources/views/Admin/menu_activity.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} -{% block v_menu_title %}{{ 'Activity configuration menu'|trans }}{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Admin/index.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Admin/index.html.twig index a721a31a0..1c1e7a5f8 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Admin/index.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Admin/index.html.twig @@ -2,7 +2,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_calendar', { - 'layout': '@ChillCalendar/Admin/menu_calendar.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Admin/menu_calendar.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Admin/menu_calendar.html.twig deleted file mode 100644 index 52338e6fe..000000000 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Admin/menu_calendar.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} -{% block v_menu_title %}{{ 'Calendar configuration'|trans }}{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Admin/layout.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Admin/layout.html.twig index a9860a20d..293f4b1a5 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Admin/layout.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Admin/layout.html.twig @@ -2,7 +2,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_docstore', { - 'layout': '@ChillDocStore/Admin/menu.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Admin/menu.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Admin/menu.html.twig deleted file mode 100644 index 319abc6f1..000000000 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Admin/menu.html.twig +++ /dev/null @@ -1,21 +0,0 @@ -{# - * 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 %}{{ 'Documents configuration'|trans }}{% endblock %} - diff --git a/src/Bundle/ChillMainBundle/Controller/AdminController.php b/src/Bundle/ChillMainBundle/Controller/AdminController.php index de4420f68..ce2fc7cdc 100644 --- a/src/Bundle/ChillMainBundle/Controller/AdminController.php +++ b/src/Bundle/ChillMainBundle/Controller/AdminController.php @@ -23,4 +23,28 @@ class AdminController extends AbstractController { return $this->render('@ChillMain/Admin/index.html.twig'); } + + /** + * @Route("/{_locale}/admin/user", name="chill_main_user_admin") + */ + public function indexUserAction() + { + return $this->render('@ChillMain/Admin/indexUser.html.twig'); + } + + /** + * @Route("/{_locale}/admin/language", name="chill_main_language_admin") + */ + public function indexLanguageAction() + { + return $this->render('@ChillMain/Admin/indexLanguage.html.twig'); + } + + /** + * @Route("/{_locale}/admin/location", name="chill_main_location_admin") + */ + public function indexLocationAction() + { + return $this->render('@ChillMain/Admin/indexLocation.html.twig'); + } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/Permission/layout_crud_permission_index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/Permission/layout_crud_permission_index.html.twig deleted file mode 100644 index 76c1e2338..000000000 --- a/src/Bundle/ChillMainBundle/Resources/views/Admin/Permission/layout_crud_permission_index.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% extends '@ChillMain/Admin/layout_permissions.html.twig' %} - -{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %} - -{% block content %} -{% embed '@ChillMain/CRUD/_index.html.twig' %} -{% endembed %} -{% endblock content %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLanguage.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLanguage.html.twig new file mode 100644 index 000000000..6c7655686 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLanguage.html.twig @@ -0,0 +1,13 @@ +{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} + +{% block vertical_menu_content %} + {{ chill_menu('admin_language', { + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', + }) }} +{% endblock %} + +{% block layout_wvm_content %} + {% block admin_content %} +

{{ 'Language configuration' |trans }}

+ {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLocation.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLocation.html.twig new file mode 100644 index 000000000..aaafc28b0 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexLocation.html.twig @@ -0,0 +1,13 @@ +{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} + +{% block vertical_menu_content %} + {{ chill_menu('admin_location', { + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', + }) }} +{% endblock %} + +{% block layout_wvm_content %} + {% block admin_content %} +

{{ 'Location configuration' |trans }}

+ {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/indexUser.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexUser.html.twig new file mode 100644 index 000000000..5e0cdaaa3 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/indexUser.html.twig @@ -0,0 +1,13 @@ +{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} + +{% block vertical_menu_content %} + {{ chill_menu('admin_user', { + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', + }) }} +{% endblock %} + +{% block layout_wvm_content %} + {% block admin_content %} +

{{ 'User configuration' |trans }}

+ {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminLanguageMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminLanguageMenuBuilder.php new file mode 100644 index 000000000..525d79b80 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminLanguageMenuBuilder.php @@ -0,0 +1,56 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + // all the entries below must have ROLE_ADMIN permissions + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('Languages and countries', [ + 'route' => 'chill_main_language_admin', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras(['order' => 1200, 'header' => true]); + + $menu->addChild('Language list', [ + 'route' => 'chill_crud_main_language_index', + ])->setExtras(['order' => 1210]); + + $menu->addChild('Country list', [ + 'route' => 'chill_crud_main_country_index', + ])->setExtras(['order' => 1220]); + } + + public static function getMenuIds(): array + { + return ['admin_section', 'admin_language']; + } +} diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminLocationMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminLocationMenuBuilder.php new file mode 100644 index 000000000..95b9a7ff8 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminLocationMenuBuilder.php @@ -0,0 +1,56 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + // all the entries below must have ROLE_ADMIN permissions + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('Location and location type', [ + 'route' => 'chill_main_location_admin', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras(['order' => 1300, 'header' => true]); + + $menu->addChild('Location type list', [ + 'route' => 'chill_crud_main_location_type_index', + ])->setExtras(['order' => 1310]); + + $menu->addChild('Location list', [ + 'route' => 'chill_crud_main_location_index', + ])->setExtras(['order' => 1320]); + } + + public static function getMenuIds(): array + { + return ['admin_section', 'admin_location']; + } +} diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminUserMenuBuilder.php similarity index 62% rename from src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php rename to src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminUserMenuBuilder.php index 6347794a8..5f7e5fc23 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminUserMenuBuilder.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; -class AdminSectionMenuBuilder implements LocalMenuBuilderInterface +class AdminUserMenuBuilder implements LocalMenuBuilderInterface { /** * @var AuthorizationCheckerInterface @@ -34,7 +34,9 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface return; } - $menu->addChild('Users and permissions') + $menu->addChild('Users and permissions', [ + 'route' => 'chill_main_user_admin', + ]) ->setAttribute('class', 'list-group-item-header') ->setExtras(['order' => 1000, 'header' => true]); @@ -57,34 +59,10 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface $menu->addChild('User jobs', [ 'route' => 'chill_crud_admin_user_job_index', ])->setExtras(['order' => 1050]); - - $menu->addChild('Languages and countries') - ->setAttribute('class', 'list-group-item-header') - ->setExtras(['order' => 1200, 'header' => true]); - - $menu->addChild('Language list', [ - 'route' => 'chill_crud_main_language_index', - ])->setExtras(['order' => 1210]); - - $menu->addChild('Country list', [ - 'route' => 'chill_crud_main_country_index', - ])->setExtras(['order' => 1220]); - - $menu->addChild('Location and location type') - ->setAttribute('class', 'list-group-item-header') - ->setExtras(['order' => 1300, 'header' => true]); - - $menu->addChild('Location type list', [ - 'route' => 'chill_crud_main_location_type_index', - ])->setExtras(['order' => 1310]); - - $menu->addChild('Location list', [ - 'route' => 'chill_crud_main_location_index', - ])->setExtras(['order' => 1320]); } public static function getMenuIds(): array { - return ['admin_section', 'admin_index']; + return ['admin_section', 'admin_user']; } } diff --git a/src/Bundle/ChillMainBundle/config/services/menu.yaml b/src/Bundle/ChillMainBundle/config/services/menu.yaml index 1a66153f8..a4eab4e77 100644 --- a/src/Bundle/ChillMainBundle/config/services/menu.yaml +++ b/src/Bundle/ChillMainBundle/config/services/menu.yaml @@ -17,9 +17,3 @@ services: autoconfigure: true tags: - { name: 'chill.menu_builder' } - - Chill\MainBundle\Routing\MenuBuilder\AdminSectionMenuBuilder: - arguments: - $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface' - tags: - - { name: 'chill.menu_builder' } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexAccompanyingCourse.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexAccompanyingCourse.html.twig index 7b1ab3a95..34bf00c10 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexAccompanyingCourse.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexAccompanyingCourse.html.twig @@ -2,7 +2,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_accompanying_course', { - 'layout': '@ChillPerson/Admin/menu.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexHousehold.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexHousehold.html.twig index 66bf63a7e..1ac12d28f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexHousehold.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexHousehold.html.twig @@ -2,7 +2,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_household', { - 'layout': '@ChillPerson/Admin/menu.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexPerson.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexPerson.html.twig index 98fe28d53..584703de8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexPerson.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexPerson.html.twig @@ -2,7 +2,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_person', { - 'layout': '@ChillPerson/Admin/menu.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexSocialWork.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexSocialWork.html.twig index a16f49f94..4cdd83bd8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexSocialWork.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Admin/indexSocialWork.html.twig @@ -2,7 +2,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_social_work', { - 'layout': '@ChillPerson/Admin/menu.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Admin/menuPerson.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Admin/menuPerson.html.twig deleted file mode 100644 index 3a534b81f..000000000 --- a/src/Bundle/ChillPersonBundle/Resources/views/Admin/menuPerson.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} -{% block v_menu_title %}{{ 'Third party configuration'|trans }}{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/menu.yaml b/src/Bundle/ChillPersonBundle/config/services/menu.yaml index a9f566466..198f5fe99 100644 --- a/src/Bundle/ChillPersonBundle/config/services/menu.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/menu.yaml @@ -12,12 +12,6 @@ services: # tags: # - { name: 'chill.menu_builder' } # - # Chill\PersonBundle\Menu\AdminMenuBuilder: - # arguments: - # $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface' - # tags: - # - { name: 'chill.menu_builder' } - # Chill\PersonBundle\Menu\PersonMenuBuilder: autowire: true autoconfigure: true diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/Admin/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/Admin/index.html.twig index 4511d722e..60f39ddeb 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/Admin/index.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/Admin/index.html.twig @@ -2,7 +2,7 @@ {% block vertical_menu_content %} {{ chill_menu('admin_thirdparty', { - 'layout': '@ChillThirdParty/Admin/menu.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig' }) }} {% endblock %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/Admin/menu.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/Admin/menu.html.twig deleted file mode 100644 index 3a534b81f..000000000 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/Admin/menu.html.twig +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} -{% block v_menu_title %}{{ 'Third party configuration'|trans }}{% endblock %} \ No newline at end of file