From 932d0dd4ba841915abc10e1bcef1195b1fd057fa Mon Sep 17 00:00:00 2001 From: Guillaume AGNIERAY Date: Tue, 3 Oct 2023 10:31:27 +0200 Subject: [PATCH] New toggable compact rendering on navigation aside --- galette/lib/Galette/Core/Authentication.php | 11 +++ .../default/elements/logout.html.twig | 98 +++++++++++++------ .../navigation/navigation_aside.html.twig | 24 +++-- .../navigation/navigation_items.html.twig | 11 ++- .../navigation/navigation_topbar.html.twig | 2 +- .../default/elements/scripts.html.twig | 29 ++++++ galette/templates/default/macros.twig | 32 ++++-- galette/templates/default/page.html.twig | 2 +- ui/semantic/galette/globals/site.overrides | 46 +++++++++ 9 files changed, 202 insertions(+), 53 deletions(-) diff --git a/galette/lib/Galette/Core/Authentication.php b/galette/lib/Galette/Core/Authentication.php index 206c7e30e..da32eb55c 100644 --- a/galette/lib/Galette/Core/Authentication.php +++ b/galette/lib/Galette/Core/Authentication.php @@ -77,6 +77,7 @@ abstract class Authentication protected $uptodate = false; protected $managed_groups = []; protected $cron = false; + protected $compact_menu = false; /** * Logs in user. @@ -261,6 +262,16 @@ abstract class Authentication return $this->managed_groups; } + /** + * Get compact menu mode + * + * @return bool + */ + public function getCompactMenu(): bool + { + return ($this->logged && isset($_COOKIE['galette_compact_menu']) && $_COOKIE['galette_compact_menu']) ? true : false; + } + /** * Is user currently up to date? * An up to date member is active and either due free, or with up to date diff --git a/galette/templates/default/elements/logout.html.twig b/galette/templates/default/elements/logout.html.twig index f9b4ffbb3..16f9afd68 100644 --- a/galette/templates/default/elements/logout.html.twig +++ b/galette/templates/default/elements/logout.html.twig @@ -5,38 +5,72 @@ {% set component_classes = "ui text compact small fluid menu" %} {% endif %} {% endif %} - -{% if ui == 'item' %} -
-
- {{ login.loggedInAs()|raw }} -
- - - {% if login.isImpersonated() %}{{ _T("Unimpersonate") }}{% else %}{{ _T("Log off") }}{% endif %} - -
-{% else %} -
-
- - {{ login.loggedInAs()|raw }} -
-