diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 99de70747..735546eba 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -4,6 +4,7 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\CRUD\Controller\AbstractCRUDController; use Chill\MainBundle\CRUD\Controller\CRUDController; +use Chill\MainBundle\Pagination\PaginatorInterface; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Form\FormInterface; @@ -84,26 +85,13 @@ class UserController extends CRUDController parent::onPrePersist($action, $entity, $form, $request); } - /** - * Finds and displays a User entity. - * - */ - public function showAction($id) + protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator) { - $em = $this->getDoctrine()->getManager(); + $query->addOrderBy('e.usernameCanonical', 'ASC'); - $user = $em->getRepository('ChillMainBundle:User')->find($id); - - if (!$user) { - throw $this->createNotFoundException('Unable to find User entity.'); - } - - return $this->render('@ChillMain/User/show.html.twig', array( - 'entity' => $user, - )); + return parent::orderQuery($action, $query, $request, $paginator); } - protected function generateTemplateParameter(string $action, $entity, Request $request, array $defaultTemplateParameters = []) { // add mini-forms for edit action diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index e8c43e02d..f196b8a2b 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -297,7 +297,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, 'class' => User::class, 'controller' => UserController::class, 'name' => 'admin_user', - 'base_path' => '/admin/main/user2', + 'base_path' => '/admin/main/user', 'base_role' => 'ROLE_ADMIN', 'form_class' => UserType::class, 'actions' => [ diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig index 38889cf72..0ea1d529c 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig @@ -51,5 +51,6 @@ {{ form_end(add_groupcenter_form) }} {% endblock %} + {% block content_form_actions_save_and_show %}{% endblock %} {% endembed %} {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig index 1f96cf4cb..c57d9ed5f 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig @@ -2,7 +2,7 @@ {% block admin_content -%} {% embed '@ChillMain/CRUD/_index.html.twig' %} - {% block table_entites_thead_tr %} + {% block table_entities_thead_tr %} {{ 'crud.admin_user.index.is_active'|trans }} {{ 'crud.admin_user.index.usernames'|trans }} {{ 'crud.admin_user.index.mains'|trans }} @@ -44,7 +44,7 @@
  • - +
  • {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
  • @@ -53,7 +53,6 @@ {% endif %} - {% endfor %} {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php index 64c9f857a..470930820 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php @@ -23,7 +23,7 @@ class PermissionMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilde 'order' => 300 ]); - $menu->addChild('List users', [ + $menu->addChild('crud.admin_user.index.title', [ 'route' => 'chill_crud_admin_user_index' ])->setExtras(['order' => 400]); diff --git a/src/Bundle/ChillMainBundle/config/routes.yaml b/src/Bundle/ChillMainBundle/config/routes.yaml index d75e91363..9a155f6e6 100644 --- a/src/Bundle/ChillMainBundle/config/routes.yaml +++ b/src/Bundle/ChillMainBundle/config/routes.yaml @@ -6,10 +6,6 @@ chill_main_admin_permissionsgroup: resource: "@ChillMainBundle/config/routes/permissionsgroup.yaml" prefix: "{_locale}/admin/permissionsgroup" -chill_main_admin_user: - resource: "@ChillMainBundle/config/routes/user.yaml" - prefix: "{_locale}/admin/user" - chill_main_admin_scope: resource: "@ChillMainBundle/config/routes/scope.yaml" prefix: "{_locale}/admin/scope" diff --git a/src/Bundle/ChillMainBundle/config/routes/user.yaml b/src/Bundle/ChillMainBundle/config/routes/user.yaml deleted file mode 100644 index aee1393f5..000000000 --- a/src/Bundle/ChillMainBundle/config/routes/user.yaml +++ /dev/null @@ -1,44 +0,0 @@ -#admin_user: -# path: / -# controller: Chill\MainBundle\Controller\UserController::indexAction -# -#admin_user_show: -# path: /{id}/show -# controller: Chill\MainBundle\Controller\UserController::showAction -# -#admin_user_new: -# path: /new -# controller: Chill\MainBundle\Controller\UserController::newAction -# -#admin_user_create: -# path: /create -# controller: Chill\MainBundle\Controller\UserController::createAction -# methods: POST -# -#admin_user_edit: -# path: /{id}/edit -# controller: Chill\MainBundle\Controller\UserController::editAction -# -#admin_user_edit_password: -# path: /{id}/edit_password -# controller: Chill\MainBundle\Controller\UserController::editPasswordAction -# -#admin_user_update: -# path: /{id}/update -# controller: Chill\MainBundle\Controller\UserController::updateAction -# methods: [POST, PUT] -# -#admin_user_update_password: -# path: /{id}/update_password -# controller: Chill\MainBundle\Controller\UserController::updatePasswordAction -# methods: [POST, PUT] -# -#admin_user_delete_group_center: -# path: /{uid}/delete_link_groupcenter/{gcid} -# controller: Chill\MainBundle\Controller\UserController::deleteLinkGroupCenterAction -# methods: [DELETE] -# -#admin_user_add_group_center: -# path: /{uid}/add_link_groupcenter -# controller: Chill\MainBundle\Controller\UserController::addLinkGroupCenterAction -# methods: [POST] diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index f799f20b6..d99a565c1 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -143,10 +143,8 @@ The role '%role%' has been removed: Le rôle "%role%" a été enlevé de ce grou The role '%role%' on circle '%scope%' has been removed: Le rôle "%role%" sur le cercle "%scope%" a été enlevé de ce groupe de permission #admin section for users -List users: Liste des utilisateurs user list: Liste des utilisateurs User edit: Modification d'un utilisateur -User creation: Créer un utilisateur User'status: Statut de l'utilisateur Disabled, the user is not allowed to login: Désactivé, l'utilisateur n'est pas autorisé à se connecter Enabled, the user is active: Actif, l'utilisateur peut se connecter @@ -281,6 +279,16 @@ crud: success: Les données ont été enregistrées view: link_duplicate: Dupliquer + ## admin for users + admin_user: + index: + title: Utilisateurs + add_new: "Créer" + is_active: "Actif ?" + usernames: "Identifiants" + mains: "Champs principaux" + title_new: "Nouvel utilisateur" + title_edit: Modifier un utilisateur No entities: Aucun élément CHILL_FOO_SEE: Voir un élément