From 60d8b8bd1da54c4116a4d8f54c33ffed21e36c4b Mon Sep 17 00:00:00 2001 From: afornerot Date: Sat, 23 Nov 2024 16:06:38 +0100 Subject: [PATCH] svg --- .vscode/settings.json | 3 + assets/app.js | 8 +- assets/datatables.init.js | 30 +++ assets/jquery.js | 2 + assets/styles/app.css | 74 ++++++- importmap.php | 10 + src/Controller/HomeController.php | 15 +- src/Controller/UserController.php | 45 ++++ templates/base.html.twig | 192 ++++++------------ .../home/{index.html.twig => home.html.twig} | 0 templates/security/login.html.twig | 8 +- templates/user/list.html.twig | 8 + 12 files changed, 255 insertions(+), 140 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 assets/datatables.init.js create mode 100644 assets/jquery.js create mode 100644 src/Controller/UserController.php rename templates/home/{index.html.twig => home.html.twig} (100%) create mode 100644 templates/user/list.html.twig diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..cdbd9ed --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.fontSize": 14 +} \ No newline at end of file diff --git a/assets/app.js b/assets/app.js index 7e8e3a3..f9c3dca 100644 --- a/assets/app.js +++ b/assets/app.js @@ -1,9 +1,9 @@ +// Stimulus import './bootstrap.js'; // jQuery import $ from 'jquery'; window.$ = $; -window.jQuery = $; // Bootstrap import 'bootstrap' @@ -13,9 +13,11 @@ import 'bootstrap/dist/css/bootstrap.min.css'; import '@fortawesome/fontawesome-free' import '@fortawesome/fontawesome-free/css/all.min.css'; +// Datatable +import 'datatables.net'; +import 'datatables.net-dt/css/jquery.dataTables.css'; + // Local CSS import './styles/bootswatch.min.css' import './styles/app.css'; - -console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉'); diff --git a/assets/datatables.init.js b/assets/datatables.init.js new file mode 100644 index 0000000..18becb3 --- /dev/null +++ b/assets/datatables.init.js @@ -0,0 +1,30 @@ +$(document).ready(function() { + $.extend( $.fn.dataTable.defaults, { + responsive: true, + "iDisplayLength": 1000, + "oLanguage": { + "sThousands": " ", + "sProcessing": "Traitement en cours...", + "sSearch": "Rechercher :", + "sLengthMenu": "Afficher _MENU_ éléments", + "sInfo": "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments", + "sInfoEmpty": "Affichage de l'élement 0 à 0 sur 0 éléments", + "sInfoFiltered": "(filtré de _MAX_ éléments au total)", + "sInfoPostFix": "", + "sLoadingRecords": "Chargement en cours...", + "sZeroRecords": "Aucun élément à afficher", + "sEmptyTable": "Aucune donnĂ©e disponible dans le tableau", + "oPaginate": { + "sFirst": "Premier", + "sPrevious": "Précédent", + "sNext": "Suivant", + "sLast": "Dernier" + }, + "oAria": { + "sSortAscending": ": activer pour trier la colonne par ordre croissant", + "sSortDescending": ": activer pour trier la colonne par ordre dĂ©croissant" + } + }, + //"stateSave": true + }); +}); diff --git a/assets/jquery.js b/assets/jquery.js new file mode 100644 index 0000000..4d2b703 --- /dev/null +++ b/assets/jquery.js @@ -0,0 +1,2 @@ +import $ from 'jquery'; +window.$ = window.jQuery = $; \ No newline at end of file diff --git a/assets/styles/app.css b/assets/styles/app.css index 59709a8..dd6fe18 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -1,10 +1,78 @@ +html, +body { + height: 100% +} -.navbar-brand img { - width:40px; - margin-right:10px; +body { + display: flex; + flex-direction: column; + align-items: stretch; +} + +.form-group { + margin-bottom: 5px; +} + +.navbar-brand img { + width: 40px; + margin-right: 10px; } .navbar-toggler { border: none; box-shadow: none !important; +} + +main { + display: flex; + flex-grow: 1; + align-items: stretch; +} + +sidebar { + width: 300px; + padding: 15px; + background-color: rgba(var(--bs-dark-rgb)); + display: flex; + flex-direction: column; +} + +sidebar div { + display: flex; + flex-direction: column; + border-bottom: 1px solid var(--bs-body-color); + padding-bottom: 10px; +} + +sidebar a { + text-decoration: none; + color: var(--bs-body-color); + ; + opacity: 0.6; + margin: 5px 0px; +} + +sidebar a:hover { + text-decoration: none; + opacity: 1; +} + +content { + flex-grow: 1; + align-items: stretch; + padding: 15px; +} + +@media (max-width: 991px) { + sidebar { + width: 70px; + } + + sidebar i { + font-size: 200%; + } + + sidebar span { + display: none; + } } \ No newline at end of file diff --git a/importmap.php b/importmap.php index 4991d52..88f43cc 100644 --- a/importmap.php +++ b/importmap.php @@ -49,4 +49,14 @@ return [ '@popperjs/core' => [ 'version' => '2.11.8', ], + 'datatables.net' => [ + 'version' => '2.1.8', + ], + 'datatables.net-dt' => [ + 'version' => '2.1.8', + ], + 'datatables.net-dt/css/dataTables.dataTables.min.css' => [ + 'version' => '2.1.8', + 'type' => 'css', + ], ]; diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 5921c05..e838a6c 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -9,11 +9,20 @@ use Symfony\Component\Routing\Attribute\Route; class HomeController extends AbstractController { #[Route('/', name: 'app_home')] - public function index(): Response + public function home(): Response { - return $this->render('home/index.html.twig', [ + return $this->render('home/home.html.twig', [ + 'usemenu' => true, + 'usesidebar' => false, + ]); + } + + #[Route('/admin', name: 'app_admin')] + public function admin(): Response + { + return $this->render('home/home.html.twig', [ 'usemenu' => true, 'usesidebar' => true, ]); - } + } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php new file mode 100644 index 0000000..962dd80 --- /dev/null +++ b/src/Controller/UserController.php @@ -0,0 +1,45 @@ +render('user/list.html.twig', [ + 'usemenu' => true, + 'usesidebar' => true, + 'title' => 'Liste des Utilisateurs', + 'routesubmit' => 'app_admin_user_submit', + 'routeupdate' => 'app_admin_user_update', + ]); + } + + #[Route('/admin/user', name: 'app_admin_user_submit')] + public function submit(): Response + { + return $this->render('user/edit.html.twig', [ + 'title' => 'CrĂ©ation Utilisateur', + 'routecancel' => 'app_admin_user', + 'routedelete' => 'app_admin_user_delete', + ]); + } + + #[Route('/admin/user/update', name: 'app_admin_user_update')] + public function update(): Response + { + + + } + + #[Route('/admin/user/delete', name: 'app_admin_user_delete')] + public function delete(): Response + { + + } +} diff --git a/templates/base.html.twig b/templates/base.html.twig index 07fbfee..31b7ca7 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -7,145 +7,83 @@ {% block javascripts %} - {% block importmap %}{{ importmap('app') }}{% endblock %} + {% block importmap %}{{ importmap('app') }}{% endblock %} {% endblock %} + {% if usemenu is defined and usemenu %} - + + + + {% endif %}
- {% if usesidebar is defined and usesidebar %} - {% if is_granted('ROLE_ADMIN') %} - -
- GENERALE - - - Configurations - + {% if usesidebar is defined and usesidebar %} + {% if is_granted('ROLE_ADMIN') %} + + - - {% endif %} + + + Utilisateurs + +
+
+ {% endif %} {% endif %} diff --git a/templates/home/index.html.twig b/templates/home/home.html.twig similarity index 100% rename from templates/home/index.html.twig rename to templates/home/home.html.twig diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index d361c92..fd622db 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -35,11 +35,11 @@ {% endblock %} {% block localscript %} - diff --git a/templates/user/list.html.twig b/templates/user/list.html.twig new file mode 100644 index 0000000..46121ee --- /dev/null +++ b/templates/user/list.html.twig @@ -0,0 +1,8 @@ +{% extends 'base.html.twig' %} + +{% block title %} = {{title}}{% endblock %} + +{% block body %} +

{{title}}

+ Ajouter +{% endblock %}