diff --git a/src/Bundle/ChillDocStoreBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillDocStoreBundle/Menu/AdminMenuBuilder.php new file mode 100644 index 000000000..ce86d7c19 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Menu/AdminMenuBuilder.php @@ -0,0 +1,49 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('Documents') + ->setAttribute('class', 'list-group-item-header') + ->setExtras(['order' => 4000, 'header' => true]); + + $menu->addChild('Document category list', [ + 'route' => 'chill_docstore_category_admin', + ])->setExtras(['order' => 4010]); + } + + public static function getMenuIds(): array + { + return ['admin_section']; + } +} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/edit.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/edit.html.twig index 2b8f82c0b..b3bcd154b 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/edit.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/edit.html.twig @@ -1,20 +1,4 @@ -{# - * Copyright (C) 2018, 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 "ChillDocStoreBundle:Admin:layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'Document category edit'|trans }}{% endblock title %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig index 1c19ab64c..ccb49b315 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig @@ -1,20 +1,4 @@ -{# - * Copyright (C) 2018, 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 "ChillDocStoreBundle:Admin:layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'Document category list' | trans }}{% endblock title %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/new.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/new.html.twig index ea8685762..9b7badf36 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/new.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/new.html.twig @@ -1,20 +1,4 @@ -{# - * Copyright (C) 2018, 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 "ChillDocStoreBundle:Admin:layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'Create new document category' | trans }}{% endblock title %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/show.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/show.html.twig index 89930df34..30a7d856b 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/show.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/show.html.twig @@ -1,20 +1,4 @@ -{# - * Copyright (C) 2018, 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 "ChillDocStoreBundle:Admin:layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'Document category show'|trans }}{% endblock title %} diff --git a/src/Bundle/ChillDocStoreBundle/config/routes.yaml b/src/Bundle/ChillDocStoreBundle/config/routes.yaml index 5821aafa5..7f04ebadb 100644 --- a/src/Bundle/ChillDocStoreBundle/config/routes.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/routes.yaml @@ -24,9 +24,4 @@ chill_docstore_admin_redirect_to_admin_index: chill_docstore_category_admin: path: /{_locale}/admin/document/category - controller: Chill\DocStoreBundle\Controller\DocumentCategoryController::indexAction - options: - menus: - admin_docstore: - order: 90 - label: "Documents categories" \ No newline at end of file + controller: Chill\DocStoreBundle\Controller\DocumentCategoryController::indexAction \ No newline at end of file diff --git a/src/Bundle/ChillDocStoreBundle/config/services/menu.yaml b/src/Bundle/ChillDocStoreBundle/config/services/menu.yaml index db16aef77..f0f1b3630 100644 --- a/src/Bundle/ChillDocStoreBundle/config/services/menu.yaml +++ b/src/Bundle/ChillDocStoreBundle/config/services/menu.yaml @@ -1,4 +1,6 @@ services: - Chill\DocStoreBundle\Menu\MenuBuilder: + Chill\DocStoreBundle\Menu\: autowire: true autoconfigure: true + resource: '../../Menu/' + tags: ['chill.menu_builder']