admin: reorganising activity menu and submenus

This commit is contained in:
nobohan 2022-05-09 16:22:17 +02:00
parent 63bfd25acb
commit 0f319a1003
25 changed files with 71 additions and 259 deletions

View File

@ -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

View File

@ -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 %}

View File

@ -1,4 +1,4 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityPresence list'|trans }}</h1>

View File

@ -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 %}

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReason edit'|trans }}</h1>

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReason list'|trans }}</h1>
@ -45,7 +29,11 @@
</tbody>
</table>
<ul class="record_actions">
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('chill_activity_activityreason_new') }}" class="btn btn-new">
{{ 'Create a new activity reason'|trans }}

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReason creation'|trans }}</h1>

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReason'|trans }}</h1>

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReasonCategory edit'|trans }}</h1>

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReasonCategory list'|trans }}</h1>

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReasonCategory creation'|trans }}</h1>

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityReasonCategory'|trans }}</h1>

View File

@ -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') %}
{% 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 %}

View File

@ -1,20 +1,4 @@
{#
* Copyright (C) 2014, 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 "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityType list'|trans }}</h1>

View File

@ -1,10 +1,10 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}

View File

@ -1,12 +1,12 @@
{% 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 %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
<h1>{{ 'ActivityTypeCategory list'|trans }}</h1>

View File

@ -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 %}

View File

@ -1,5 +1,5 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* 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

View File

@ -1,20 +1,2 @@
{#
* 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 %}{{ 'Activity configuration menu'|trans }}{% endblock %}

View File

@ -10,48 +10,22 @@ chill_activity_activityreasoncategory:
resource: "@ChillActivityBundle/config/routes/activityreasoncategory.yaml"
prefix: /
chill_admin_activity_index:
chill_activity_admin_index:
path: /{_locale}/admin/activity
controller: Chill\ActivityBundle\Controller\AdminController::indexActivityAction
options:
menus:
admin_section:
label: Activities
order: 2000
icons: [tag]
chill_admin_activity_redirect_to_admin_index:
path: /{_locale}/admin/activity_redirect_to_main
controller: Chill\ActivityBundle\Controller\AdminController::redirectToAdminIndexAction
options:
menus:
admin_activity:
order: 0
label: Main admin menu
chill_activity_type_admin:
path: /{_locale}/admin/activity/type
controller: cscrud_activity_type_controller:index
options:
menus:
admin_activity:
order: 2020
label: 'Activity Types'
chill_activity_type_category_admin:
path: /{_locale}/admin/activity/type_category
controller: cscrud_activity_type_category_controller:index
options:
menus:
admin_activity:
order: 2999
label: 'Activity Types Categories'
chill_activity_presence_admin:
path: /{_locale}/admin/activity/presence
controller: cscrud_activity_presence_controller:index
options:
menus:
admin_activity:
order: 2021
label: 'Activity Presences'

View File

@ -1,11 +1,6 @@
chill_activity_activityreason:
path: /{_locale}/admin/activityreason/
controller: Chill\ActivityBundle\Controller\ActivityReasonController::indexAction
options:
menus:
admin_activity:
order: 2000
label: "Activity Reasons"
chill_activity_activityreason_show:
path: /{_locale}/admin/activityreason/{id}/show

View File

@ -1,11 +1,6 @@
chill_activity_activityreasoncategory:
path: /{_locale}/admin/activityreasoncategory/
controller: Chill\ActivityBundle\Controller\ActivityReasonCategoryController::indexAction
options:
menus:
admin_activity:
order: 2010
label: "Activity Reasons Category"
chill_activity_activityreasoncategory_show:
path: /{_locale}/admin/activityreasoncategory/{id}/show

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\DependencyInjection;
use Chill\CalendarBundle\Entity\CancelReason;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;

View File

@ -34,10 +34,11 @@
{% endblock %}
</div>
<div class="col-md-3">
{% block vertical_menu_content %}
{{ chill_menu('admin_section', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
</div>
</div>
{% endblock %}