From 6f80bd0d37a3e7fac407203f79f50cc5e73b445a 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 | 30 ++++++++++++++++++ Controller/DocumentCategoryController.php | 2 +- Resources/views/Admin/layout.html.twig | 31 +++++++++++++++++++ Resources/views/Admin/menu.html.twig | 21 +++++++++++++ .../views/DocumentCategory/_form.html.twig | 2 +- .../views/DocumentCategory/edit.html.twig | 23 ++++++++++---- .../views/DocumentCategory/index.html.twig | 18 ++++++----- .../views/DocumentCategory/new.html.twig | 23 +++++++++++--- .../views/DocumentCategory/show.html.twig | 26 +++++++++------- config/routes.yaml | 29 +++++++++++++++++ translations/messages.fr.yml | 17 ++++++++++ 11 files changed, 190 insertions(+), 32 deletions(-) create mode 100644 Controller/AdminController.php create mode 100644 Resources/views/Admin/layout.html.twig create mode 100644 Resources/views/Admin/menu.html.twig diff --git a/Controller/AdminController.php b/Controller/AdminController.php new file mode 100644 index 000000000..3a24dfb99 --- /dev/null +++ b/Controller/AdminController.php @@ -0,0 +1,30 @@ +render('ChillDocStoreBundle:Admin:layout.html.twig'); + } + + /** + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function redirectToAdminIndexAction() + { + return $this->redirectToRoute('chill_main_admin_central'); + } + +} \ No newline at end of file diff --git a/Controller/DocumentCategoryController.php b/Controller/DocumentCategoryController.php index abbfbd1c0..4d2d3246e 100644 --- a/Controller/DocumentCategoryController.php +++ b/Controller/DocumentCategoryController.php @@ -100,7 +100,7 @@ class DocumentCategoryController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $this->getDoctrine()->getManager()->flush(); - return $this->redirectToRoute('document_category_edit', [ + return $this->redirectToRoute('document_category_index', [ 'bundleId' => $documentCategory->getBundleId(), 'idInsideBundle' => $documentCategory->getIdInsideBundle(),]); } diff --git a/Resources/views/Admin/layout.html.twig b/Resources/views/Admin/layout.html.twig new file mode 100644 index 000000000..eecfb1751 --- /dev/null +++ b/Resources/views/Admin/layout.html.twig @@ -0,0 +1,31 @@ +{# + * 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/Admin/layoutWithVerticalMenu.html.twig" %} + +{% block vertical_menu_content %} + {{ chill_menu('admin_docstore', { + 'layout': '@ChillDocStore/Admin/menu.html.twig', + }) }} +{% endblock %} + +{% block layout_wvm_content %} + {% block admin_content %} +

{{ 'Documents configuration' |trans }}

+ {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/Resources/views/Admin/menu.html.twig b/Resources/views/Admin/menu.html.twig new file mode 100644 index 000000000..319abc6f1 --- /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 %}{{ 'Documents configuration'|trans }}{% endblock %} + diff --git a/Resources/views/DocumentCategory/_form.html.twig b/Resources/views/DocumentCategory/_form.html.twig index e2a0a004d..d6e513458 100644 --- a/Resources/views/DocumentCategory/_form.html.twig +++ b/Resources/views/DocumentCategory/_form.html.twig @@ -16,5 +16,5 @@ #} {{ form_start(form) }} {{ form_widget(form) }} - + {{ form_end(form) }} diff --git a/Resources/views/DocumentCategory/edit.html.twig b/Resources/views/DocumentCategory/edit.html.twig index cc4d8223b..2b0556244 100644 --- a/Resources/views/DocumentCategory/edit.html.twig +++ b/Resources/views/DocumentCategory/edit.html.twig @@ -14,18 +14,29 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillMain/Admin/layout.html.twig" %} +{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %} {% block title %}{{ 'Document category edit'|trans }}{% endblock title %} {% block admin_content %}

{{ 'Document category edit'|trans }}

- {{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig', {'button_label': 'Update'}) }} + {# DISABLED + {{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig', {'button_label': 'Update'}) }} + #} - - {{ 'Back to the category list' | trans }} - + {{ form_start(form) }} + {{ form_widget(form) }} + + {{ form_end(form) }} - {{ include('ChillDocStoreBundle:DocumentCategory:_delete_form.html.twig') }} {% endblock %} diff --git a/Resources/views/DocumentCategory/index.html.twig b/Resources/views/DocumentCategory/index.html.twig index 612afb2fb..48512eff6 100644 --- a/Resources/views/DocumentCategory/index.html.twig +++ b/Resources/views/DocumentCategory/index.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillMain/Admin/layout.html.twig" %} +{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %} {% block title %}{{ 'Document category list' | trans }}{% endblock title %} @@ -40,12 +40,10 @@ {{ document_category.name | localize_translatable_string}} - - {{ 'show' | trans }} - - - {{ 'edit' | trans }} - + + {% else %} @@ -56,5 +54,9 @@ - {{ 'Create new' | trans }} + {% endblock %} diff --git a/Resources/views/DocumentCategory/new.html.twig b/Resources/views/DocumentCategory/new.html.twig index 8b3f55182..addf9922f 100644 --- a/Resources/views/DocumentCategory/new.html.twig +++ b/Resources/views/DocumentCategory/new.html.twig @@ -14,16 +14,29 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillMain/Admin/layout.html.twig" %} +{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %} {% block title %}{{ 'Create new document category' | trans }}{% endblock title %} {% block admin_content %}

{{ 'Create new DocumentCategory' | trans }}

- {{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig') }} + {# DISABLED + {{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig') }} + #} + + {{ form_start(form) }} + {{ form_widget(form) }} + + {{ form_end(form) }} - - {{ 'Back to the category list' | trans }} - {% endblock %} diff --git a/Resources/views/DocumentCategory/show.html.twig b/Resources/views/DocumentCategory/show.html.twig index 2ba2a301b..3e3470f12 100644 --- a/Resources/views/DocumentCategory/show.html.twig +++ b/Resources/views/DocumentCategory/show.html.twig @@ -14,12 +14,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillMain/Admin/layout.html.twig" %} +{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %} {% block title %}{{ 'Document category show'|trans }}{% endblock title %} {% block admin_content %} -

Document category

+

{{ 'Document category show'|trans }}

@@ -42,13 +42,17 @@
- - {{ 'Back to the category list' | trans }} - - - - {{ 'Edit' | trans }} - - - {{ include('ChillDocStoreBundle:DocumentCategory:_delete_form.html.twig') }} + {% endblock %} diff --git a/config/routes.yaml b/config/routes.yaml index c02dc76ab..5821aafa5 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,32 @@ app: resource: "@ChillDocStoreBundle/Controller/" type: annotation + +## ADMIN SECTION +chill_docstore_admin: + path: /{_locale}/admin/document + controller: Chill\DocStoreBundle\Controller\AdminController::indexAction + options: + menus: + admin_section: + order: 2200 + label: "Documents configuration menu" + icons: ['calendar'] + +chill_docstore_admin_redirect_to_admin_index: + path: /{_locale}/admin/document_redirect_to_main + controller: Chill\DocStoreBundle\Controller\AdminController::redirectToAdminIndexAction + options: + menus: + admin_docstore: + order: 0 + label: Main admin menu + +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 diff --git a/translations/messages.fr.yml b/translations/messages.fr.yml index aef34ce00..947471531 100644 --- a/translations/messages.fr.yml +++ b/translations/messages.fr.yml @@ -34,3 +34,20 @@ CHILL_PERSON_DOCUMENT_DELETE: Supprimer un document CHILL_PERSON_DOCUMENT_SEE: Voir un document CHILL_PERSON_DOCUMENT_SEE_DETAILS: Voir le détail d'un document CHILL_PERSON_DOCUMENT_UPDATE: Modifier un document + +# Admin +Documents configuration: Configuration des documents +Documents configuration menu: Documents +Documents categories: Catégories de documents + +Document category list: Catégories de documents +Document category show: Voir la catégorie de documents +Document category edit: Modifier la catégorie de documents +Creator bundle id: Module +Bundle id: Module +Internal id inside creator bundle: Identifiant +Id inside bundle: Identifiant +Document class: Classe de document +no records found: +Create new category: Créer une nouvelle catégorie +Back to the category list: Retour à la liste \ No newline at end of file