admin: reorganize twig templates and admin menu

This commit is contained in:
nobohan 2022-05-04 17:34:44 +02:00
parent e50e68a52b
commit 16d74eaa0c
22 changed files with 112 additions and 403 deletions

View File

@ -23,19 +23,4 @@ class AdminController extends AbstractController
{
return $this->render('@ChillMain/Admin/index.html.twig');
}
public function indexLanguageCountryAction()
{
return $this->render('@ChillMain/Admin/layout_language_country.html.twig');
}
public function indexLocationsAction()
{
return $this->render('@ChillMain/Admin/layout_location.html.twig');
}
public function indexPermissionsAction()
{
return $this->render('@ChillMain/Admin/layout_permissions.html.twig');
}
}

View File

@ -179,7 +179,7 @@ div.banner {
div.vertical-menu {
border-radius: 0;
margin-top: 0.5rem;
a.list-group-item {
a.list-group-item, div.list-group-item {
background-color: $chill-yellow;
border: 0;
margin-bottom: 0.25rem;
@ -187,6 +187,9 @@ div.vertical-menu {
background-color: tint-color($chill-yellow, 20%)
}
}
div.list-group-item-header {
text-transform: uppercase;
}
}
footer.footer {

View File

@ -1,6 +1,7 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block content %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
@ -28,6 +29,11 @@
</tr>
{% endfor %}
{% endblock %}
{% endembed %}
{% endblock content %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@ -1,12 +1,13 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block content %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>name</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
@ -22,6 +23,12 @@
</tr>
{% endfor %}
{% endblock %}
{% endembed %}
{% endblock content %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@ -8,8 +8,4 @@
<p>{{ 'Welcome to the admin section !'|trans }}</p>
{{ chill_menu('admin_index', {
'layout': '@ChillMain/Admin/menu_admin_index.html.twig'
}) }}
{% endblock %}

View File

@ -1,12 +1,5 @@
{% extends "@ChillMain/layout.html.twig" %}
{% block navigation_search_bar %}{% endblock %}
{% block navigation_section_menu %}
{{ chill_menu('admin_section', {
'layout': '@ChillMain/Menu/admin.html.twig',
}) }}
{% endblock %}
{% block content %}
{% block admin_content %}<!-- block content empty -->
<div class="container-fluid">

View File

@ -1,14 +1,13 @@
{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %}
{% block navigation_search_bar %}{% endblock %}
{% block navigation_section_menu %}
{{ chill_menu('admin_section', {
{% block vertical_menu_content %}
{{ chill_menu('admin_section', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}
<!-- block admin content emty -->
<!-- block admin content empty -->
{% endblock %}
{% endblock %}

View File

@ -1,33 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <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 "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_language_country', {
'layout': '@ChillMain/Admin/menu_admin_language_country.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}
<h1>{{ 'Management of languages and countries' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@ -1,33 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <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 "@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 %}
<h1>{{ 'Management of location' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@ -1,31 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <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 "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_permissions', {
'layout': '@ChillMain/Admin/menu_admin_permissions.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'Permissions management of your chill installation' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@ -1,18 +0,0 @@
<div class="{{ 'menu-' ~ menus.name }}">
<ul>
{% for menu in menus %}
<li>
<a class=""
href="{{ menu.uri }}">
<h3>{{ menu.label|trans }}</h3>
{% if menu.extras.explain is defined %}
<div class="" >
{{ menu.extras.explain|trans }}
</div>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>

View File

@ -1,20 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <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 "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Language and countries menu'|trans }}{% endblock %}

View File

@ -1,20 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <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 "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Location Menu'|trans }}{% endblock %}

View File

@ -1,20 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <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 "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Permissions Menu'|trans }}{% endblock %}

View File

@ -1,41 +1,28 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <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/>.
#}
<div class="list-group vertical-menu">
{% for menu in menus %}
{% if 'header' in menu.extras %}
<div class="list-group-item list-group-item-action {% if 'class' in menu.attributes|keys %}{{ menu.attributes['class'] }}{% endif %}">
{{ menu.label|trans }}
{% apply spaceless %}
{% if menu.extras.icons is defined %}
{% for icon in menu.extras.icons %}
<span><i class="fa fa-{{ icon }}"></i></span>
{% endfor %}
{% endif %}
{% endapply %}
</div>
{% else %}
<a href="{{ menu.uri }}" class="list-group-item list-group-item-action {% if 'class' in menu.attributes|keys %}{{ menu.attributes['class'] }}{% endif %}">
{{ menu.label|trans }}
{% apply spaceless %}
{% if menu.extras.icons is defined %}
{% for icon in menu.extras.icons %}
<span><i class="fa fa-{{ icon }}"></i></span>
{% endfor %}
{% endif %}
{% endapply %}
</a>
{% endif %}
<li class="nav-link2">
<div class="li-content">
<a href="{{ path('chill_main_admin_central') }}" class="more">Admin Sections</a>
</div>
<ul class="submenu width-15-em" style="padding-left: 0; padding-right: 0; background-color:transparent;">
{% for menu in menus %}
<li style="display:block; background-color: #333333; padding-left:1.5em; border-bottom:1px; border-bottom: 1px solid #FFF;padding-top:0; padding-bottom:0;">
<div style="margin-bottom:2px;">
<div style="font-family: 'Open Sans'; font-weight:300; font-size: 0.75em; text-align:left; height: 46px; display:inline-block; width: calc(100% - 5em - 1px); vertical-align:top;">
<a href="{{ menu.uri }}">{{ menu.label|trans }}</a>
</div>
<div style="background-color: #333333; text-align:center;width: 2em; margin-left:-0.15em; font-size:1.5em; color:#FFF; height: 46px; display:inline-block; vertical-align:top;float:right">{% apply spaceless %}
{% if menu.extras.icons is defined %}
{% for icon in menu.extras.icons %}
<i class="fa fa-{{ icon }}"></i>
{% endfor %}
{% endif %}
{% endapply %}</div>
</div>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</div>

View File

@ -1,8 +1,13 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block content %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock content %}
{% endblock %}

View File

@ -34,32 +34,58 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
return;
}
$menu->addChild('Users and permissions', [
'route' => 'chill_main_admin_permissions',
])
->setExtras([
'icons' => ['key'],
'order' => 200,
'explain' => 'Configure permissions for users',
]);
$menu->addChild('Users and permissions')
->setAttribute('class', 'list-group-item-header')
->setExtras(['order' => 100, 'header' => true]);
$menu->addChild('Location and location type', [
'route' => 'chill_main_admin_locations',
])
->setExtras([
'icons' => ['key'],
'order' => 205,
'explain' => 'Configure location and location type',
]);
$menu->addChild('Center list', [
'route' => 'admin_center',
])->setExtras(['order' => 110]);
$menu->addChild('List circles', [
'route' => 'admin_scope',
])->setExtras(['order' => 120]);
$menu->addChild('Permissions group list', [
'route' => 'admin_permissionsgroup',
])->setExtras(['order' => 130]);
$menu->addChild('crud.admin_user.index.title', [
'route' => 'chill_crud_admin_user_index',
])->setExtras(['order' => 140]);
$menu->addChild('User jobs', [
'route' => 'chill_crud_admin_user_job_index',
])->setExtras(['order' => 150]);
$menu->addChild('Languages and countries')
->setAttribute('class', 'list-group-item-header')
->setExtras(['order' => 200, 'header' => 'true']);
$menu->addChild('Language list', [
'route' => 'chill_crud_main_language_index',
])->setExtras(['order' => 210]);
$menu->addChild('Country list', [
'route' => 'chill_crud_main_country_index',
])->setExtras(['order' => 220]);
$menu->addChild('Location and location type')
->setAttribute('class', 'list-group-item-header')
->setExtras(['order' => 300, 'header' => 'true']);
$menu->addChild('Location type list', [
'route' => 'chill_crud_main_location_type_index',
])->setExtras(['order' => 310]);
$menu->addChild('Location list', [
'route' => 'chill_crud_main_location_index',
])->setExtras(['order' => 320]);
$menu->addChild('Languages and countries', [
'route' => 'chill_main_admin_language_country',
])
->setExtras([
'icons' => ['key'],
'order' => 210,
'explain' => 'Configure languages and countries',
]);
}
public static function getMenuIds(): array

View File

@ -1,33 +0,0 @@
<?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\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
class LanguageCountryMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$menu->addChild('Language list', [
'route' => 'chill_crud_main_language_index',
])->setExtras(['order' => 205]);
$menu->addChild('Country list', [
'route' => 'chill_crud_main_country_index',
])->setExtras(['order' => 206]);
}
public static function getMenuIds(): array
{
return ['admin_language_country'];
}
}

View File

@ -1,33 +0,0 @@
<?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\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
class LocationMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$menu->addChild('Location type list', [
'route' => 'chill_crud_main_location_type_index',
])->setExtras(['order' => 205]);
$menu->addChild('Location list', [
'route' => 'chill_crud_main_location_index',
])->setExtras(['order' => 206]);
}
public static function getMenuIds(): array
{
return ['admin_location'];
}
}

View File

@ -1,47 +0,0 @@
<?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\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
class PermissionMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$menu->addChild('Permissions group list', [
'route' => 'admin_permissionsgroup',
])->setExtras([
'order' => 300,
]);
$menu->addChild('crud.admin_user.index.title', [
'route' => 'chill_crud_admin_user_index',
])->setExtras(['order' => 400]);
$menu->addChild('List circles', [
'route' => 'admin_scope',
])->setExtras(['order' => 200]);
$menu->addChild('Center list', [
'route' => 'admin_center',
])->setExtras(['order' => 100]);
$menu->addChild('User jobs', [
'route' => 'chill_crud_admin_user_job_index',
])->setExtras(['order' => 150]);
}
public static function getMenuIds(): array
{
return ['admin_permissions'];
}
}

View File

@ -62,17 +62,6 @@ chill_main_homepage:
# order: 0
# label: Main admin menu
#
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_admin_language_country:
path: /{_locale}/admin/language-country
controller: Chill\MainBundle\Controller\AdminController::indexLanguageCountryAction
chill_main_search:
path: /{_locale}/search.{_format}

View File

@ -120,6 +120,7 @@ Main admin menu: Menu d'administration principal
Actions: Actions
Users and permissions: Utilisateurs et permissions
Location and location type: Localisations et types de localisation
Back to the admin: Retour
#permissions
Permissions Menu: Gestion des droits