From b991ae8d00f8bf845db3a2e835889ab137928571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P?= Date: Wed, 30 Oct 2024 15:24:26 +0100 Subject: [PATCH] Draft admin + crude JS for notices --- src/Controller/AdminController.php | 25 ++++++++++++++ templates/admin/index.html.twig | 34 ++++++++++++++++++++ templates/profile/index.html.twig | 2 +- templates/vocab_func_context/index.html.twig | 25 ++++++++++---- 4 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 src/Controller/AdminController.php create mode 100644 templates/admin/index.html.twig diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php new file mode 100644 index 0000000..1c14695 --- /dev/null +++ b/src/Controller/AdminController.php @@ -0,0 +1,25 @@ +getRepository(User::class); + $users = $repo->findAll(); + + return $this->render('admin/index.html.twig', [ + 'controller_name' => 'AdminController', + 'users' => $users, + ]); + } +} diff --git a/templates/admin/index.html.twig b/templates/admin/index.html.twig new file mode 100644 index 0000000..36f435f --- /dev/null +++ b/templates/admin/index.html.twig @@ -0,0 +1,34 @@ + +{% extends 'data_entry.html.twig' %} + +{% block title %}Admin | ArCOA{% endblock %} + +{% block rightpanel %} +
+

Administration

+ +
+

Manage users

+ + + {% for user in users %} + + + + + + + + + {% endfor %} +
User nameRoleFirst nameLast nameEmailActions
{{ loop.index }}{{ user.username }} + {% for role in user.roles %} + {% if role != 'ROLE_USER' %} + {{ role|replace({"ROLE_": ""})|lower() }} + {% endif %} + {% endfor %} + {{ user.firstname }}{{ user.lastname }}{{ user.email }}Actions
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/templates/profile/index.html.twig b/templates/profile/index.html.twig index 89eccbc..72f1f83 100644 --- a/templates/profile/index.html.twig +++ b/templates/profile/index.html.twig @@ -21,7 +21,7 @@ - {{ app.user.email }} + {{ app.user.email ?? 'no email' }}

diff --git a/templates/vocab_func_context/index.html.twig b/templates/vocab_func_context/index.html.twig index d866846..724bea8 100644 --- a/templates/vocab_func_context/index.html.twig +++ b/templates/vocab_func_context/index.html.twig @@ -9,13 +9,14 @@
- + {% for message in app.flashes('notice') %} -
-
{{ message }}
-
+
+ + {{ message }} +
{% endfor %}
@@ -66,6 +67,13 @@