From a1fc070bf72d5dc3edcc05fe928dc52485b5b27e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 6 Feb 2021 13:51:46 +0100 Subject: [PATCH] improve ux in admin configuration interface --- Controller/AdminController.php | 11 +++++-- .../{index.html.twig => layout.html.twig} | 6 ++-- Resources/views/Admin/menu.html.twig | 21 ++++++++++++++ Resources/views/ClosingMotive/edit.html.twig | 4 +-- Resources/views/ClosingMotive/index.html.twig | 4 +-- Resources/views/ClosingMotive/new.html.twig | 4 +-- Resources/views/MaritalStatus/edit.html.twig | 4 +-- Resources/views/MaritalStatus/index.html.twig | 4 +-- Resources/views/MaritalStatus/new.html.twig | 4 +-- config/routes.yaml | 29 ++++++++++++++++++- translations/messages.fr.yml | 2 ++ 11 files changed, 76 insertions(+), 17 deletions(-) rename Resources/views/Admin/{index.html.twig => layout.html.twig} (93%) create mode 100644 Resources/views/Admin/menu.html.twig diff --git a/Controller/AdminController.php b/Controller/AdminController.php index 015e06083..751beb7a8 100644 --- a/Controller/AdminController.php +++ b/Controller/AdminController.php @@ -18,7 +18,14 @@ class AdminController extends AbstractController */ public function indexAction($_locale) { - return $this->render('ChillPersonBundle:Admin:index.html.twig', []); + return $this->render('ChillPersonBundle:Admin:layout.html.twig', []); + } + + /** + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function redirectToAdminIndexAction() + { + return $this->redirectToRoute('chill_main_admin_central'); } - } diff --git a/Resources/views/Admin/index.html.twig b/Resources/views/Admin/layout.html.twig similarity index 93% rename from Resources/views/Admin/index.html.twig rename to Resources/views/Admin/layout.html.twig index 2853c491c..04398026a 100644 --- a/Resources/views/Admin/index.html.twig +++ b/Resources/views/Admin/layout.html.twig @@ -19,10 +19,12 @@ {% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} {% block vertical_menu_content %} - {{ chill_menu('admin_person') }} + {{ chill_menu('admin_person', { + 'layout': '@ChillPerson/Admin/menu.html.twig', + }) }} {% endblock %} -{% block admin_content %} +{% block layout_wvm_content %}

{{ 'Configuration of person bundle' |trans }}

diff --git a/Resources/views/Admin/menu.html.twig b/Resources/views/Admin/menu.html.twig new file mode 100644 index 000000000..2828b5240 --- /dev/null +++ b/Resources/views/Admin/menu.html.twig @@ -0,0 +1,21 @@ +{# + * 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 %}{{ 'Configuration of person bundle'|trans }}{% endblock %} + diff --git a/Resources/views/ClosingMotive/edit.html.twig b/Resources/views/ClosingMotive/edit.html.twig index 2d465f77e..d132847f2 100644 --- a/Resources/views/ClosingMotive/edit.html.twig +++ b/Resources/views/ClosingMotive/edit.html.twig @@ -1,10 +1,10 @@ -{% extends '@ChillMain/Admin/layout.html.twig' %} +{% extends '@ChillPerson/Admin/layout.html.twig' %} {% block title %} {% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% endblock %} -{% block admin_content %} +{% 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 %} diff --git a/Resources/views/ClosingMotive/index.html.twig b/Resources/views/ClosingMotive/index.html.twig index 7d2259901..fcf91dbec 100644 --- a/Resources/views/ClosingMotive/index.html.twig +++ b/Resources/views/ClosingMotive/index.html.twig @@ -1,6 +1,6 @@ -{% extends '@ChillMain/Admin/layout.html.twig' %} +{% extends '@ChillPerson/Admin/layout.html.twig' %} -{% block admin_content %} +{% block layout_wvm_content %} {% embed '@ChillMain/CRUD/_index.html.twig' %} {% block table_entities_thead_tr %} {{ 'Ordering'|trans }} diff --git a/Resources/views/ClosingMotive/new.html.twig b/Resources/views/ClosingMotive/new.html.twig index b430411a8..cc6021021 100644 --- a/Resources/views/ClosingMotive/new.html.twig +++ b/Resources/views/ClosingMotive/new.html.twig @@ -1,10 +1,10 @@ -{% extends '@ChillMain/Admin/layout.html.twig' %} +{% extends '@ChillPerson/Admin/layout.html.twig' %} {% block title %} {% include('@ChillMain/CRUD/_new_title.html.twig') %} {% endblock %} -{% block admin_content %} +{% block layout_wvm_content %} {% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% block content_form_actions_save_and_show %}{% endblock %} {% endembed %} diff --git a/Resources/views/MaritalStatus/edit.html.twig b/Resources/views/MaritalStatus/edit.html.twig index 2d465f77e..d132847f2 100644 --- a/Resources/views/MaritalStatus/edit.html.twig +++ b/Resources/views/MaritalStatus/edit.html.twig @@ -1,10 +1,10 @@ -{% extends '@ChillMain/Admin/layout.html.twig' %} +{% extends '@ChillPerson/Admin/layout.html.twig' %} {% block title %} {% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% endblock %} -{% block admin_content %} +{% 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 %} diff --git a/Resources/views/MaritalStatus/index.html.twig b/Resources/views/MaritalStatus/index.html.twig index 8de83f16a..65935aa96 100644 --- a/Resources/views/MaritalStatus/index.html.twig +++ b/Resources/views/MaritalStatus/index.html.twig @@ -1,6 +1,6 @@ -{% extends '@ChillMain/Admin/layout.html.twig' %} +{% extends '@ChillPerson/Admin/layout.html.twig' %} -{% block admin_content %} +{% block layout_wvm_content %} {% embed '@ChillMain/CRUD/_index.html.twig' %} {% block table_entities_thead_tr %} {{ 'Id'|trans }} diff --git a/Resources/views/MaritalStatus/new.html.twig b/Resources/views/MaritalStatus/new.html.twig index b430411a8..cc6021021 100644 --- a/Resources/views/MaritalStatus/new.html.twig +++ b/Resources/views/MaritalStatus/new.html.twig @@ -1,10 +1,10 @@ -{% extends '@ChillMain/Admin/layout.html.twig' %} +{% extends '@ChillPerson/Admin/layout.html.twig' %} {% block title %} {% include('@ChillMain/CRUD/_new_title.html.twig') %} {% endblock %} -{% block admin_content %} +{% block layout_wvm_content %} {% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% block content_form_actions_save_and_show %}{% endblock %} {% endembed %} diff --git a/config/routes.yaml b/config/routes.yaml index 0e3834f91..a9049840d 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -87,4 +87,31 @@ chill_person_timeline: chill_person_admin: path: "/{_locale}/admin/person" - controller: Chill\PersonBundle\Controller\AdminController::indexAction \ No newline at end of file + controller: Chill\PersonBundle\Controller\AdminController::indexAction + +chill_person_admin_redirect_to_admin_index: + path: /{_locale}/admin/person_redirect_to_main + controller: Chill\PersonBundle\Controller\AdminController::redirectToAdminIndexAction + options: + menus: + admin_person: + order: 0 + label: Main admin menu + +chill_person_closingmotive_admin: + path: /{_locale}/admin/closing-motive + controller: cscrud_closing_motive_controller:index + options: + menus: + admin_person: + order: 90 + label: 'person_admin.closing motives' + +chill_person_maritalstatus_admin: + path: /{_locale}/admin/marital-status + controller: cscrud_marital_status_controller:index + options: + menus: + admin_person: + order: 120 + label: 'person_admin.marital status' \ No newline at end of file diff --git a/translations/messages.fr.yml b/translations/messages.fr.yml index 2dab37bc0..08e1219e6 100644 --- a/translations/messages.fr.yml +++ b/translations/messages.fr.yml @@ -244,10 +244,12 @@ closing_motive: Configuration of person bundle: Configuration du module "Personnes" person_admin: What would you like to configure ?: Que souhaitez-vous configurer ? + closing motives: Motifs de clotûre closing motives list: Liste des motifs de clotûre closing motive explanation: > Les motifs de clotûre donnent des indications sur la fermeture d'une période d'accompagnement. + marital status: États civils marital status list: Liste des états civils marital status explanation: > Configurer la liste des états civils.