mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
admin: document category menu
This commit is contained in:
parent
7cefce8305
commit
24794c1285
49
src/Bundle/ChillDocStoreBundle/Menu/AdminMenuBuilder.php
Normal file
49
src/Bundle/ChillDocStoreBundle/Menu/AdminMenuBuilder.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
|
|
||||||
|
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var AuthorizationCheckerInterface
|
||||||
|
*/
|
||||||
|
protected $authorizationChecker;
|
||||||
|
|
||||||
|
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
||||||
|
{
|
||||||
|
$this->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'];
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,4 @@
|
|||||||
{#
|
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
|
||||||
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
|
|
||||||
|
|
||||||
{% block title %}{{ 'Document category edit'|trans }}{% endblock title %}
|
{% block title %}{{ 'Document category edit'|trans }}{% endblock title %}
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
{#
|
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
|
||||||
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
|
|
||||||
|
|
||||||
{% block title %}{{ 'Document category list' | trans }}{% endblock title %}
|
{% block title %}{{ 'Document category list' | trans }}{% endblock title %}
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
{#
|
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
|
||||||
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
|
|
||||||
|
|
||||||
{% block title %}{{ 'Create new document category' | trans }}{% endblock title %}
|
{% block title %}{{ 'Create new document category' | trans }}{% endblock title %}
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
{#
|
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
|
||||||
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
#}
|
|
||||||
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
|
|
||||||
|
|
||||||
{% block title %}{{ 'Document category show'|trans }}{% endblock title %}
|
{% block title %}{{ 'Document category show'|trans }}{% endblock title %}
|
||||||
|
|
||||||
|
@ -25,8 +25,3 @@ chill_docstore_admin_redirect_to_admin_index:
|
|||||||
chill_docstore_category_admin:
|
chill_docstore_category_admin:
|
||||||
path: /{_locale}/admin/document/category
|
path: /{_locale}/admin/document/category
|
||||||
controller: Chill\DocStoreBundle\Controller\DocumentCategoryController::indexAction
|
controller: Chill\DocStoreBundle\Controller\DocumentCategoryController::indexAction
|
||||||
options:
|
|
||||||
menus:
|
|
||||||
admin_docstore:
|
|
||||||
order: 90
|
|
||||||
label: "Documents categories"
|
|
@ -1,4 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
Chill\DocStoreBundle\Menu\MenuBuilder:
|
Chill\DocStoreBundle\Menu\:
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
|
resource: '../../Menu/'
|
||||||
|
tags: ['chill.menu_builder']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user