From d7fc45a72d9b0d0853fc12732dd56d174522f93c Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 6 Jun 2020 07:17:09 +0200 Subject: [PATCH 1/2] Very first version of admin bar --- admin/template/template.php | 10 +++ index.php | 8 +++ system/templates/admin-bar.html.twig | 102 +++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 system/templates/admin-bar.html.twig diff --git a/admin/template/template.php b/admin/template/template.php index 6ca893fc..c2c1b745 100644 --- a/admin/template/template.php +++ b/admin/template/template.php @@ -199,6 +199,16 @@ echo $content; } ?> +display('admin-bar.html.twig', [ + 'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId() + ]); +} +?> diff --git a/index.php b/index.php index 32e8599c..4f334416 100644 --- a/index.php +++ b/index.php @@ -357,6 +357,14 @@ if($config['backward_support']) { $topic = $title; } +/** + * @var OTS_Account $account_logged + */ +if ($logged && admin()) { + $content .= $twig->render('admin-bar.html.twig', [ + 'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId() + ]); +} $title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName']; require $template_path . '/' . $template_index; diff --git a/system/templates/admin-bar.html.twig b/system/templates/admin-bar.html.twig new file mode 100644 index 00000000..2775ad50 --- /dev/null +++ b/system/templates/admin-bar.html.twig @@ -0,0 +1,102 @@ + + +
+ + +
From 78ae456b45d66e5db316e9962856966c9d621b80 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 4 Dec 2021 21:34:26 +0100 Subject: [PATCH 2/2] Finish admin-bar New ideas welcome. Please open an issue or contact me --- system/templates/admin-bar.html.twig | 41 +++++++++++++++++++++------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/system/templates/admin-bar.html.twig b/system/templates/admin-bar.html.twig index 2775ad50..0825dd27 100644 --- a/system/templates/admin-bar.html.twig +++ b/system/templates/admin-bar.html.twig @@ -29,7 +29,7 @@ html { margin-top: 32px !important; } clear: none; list-style: none; margin: 0; - padding: 0; + padding: 0 15px 0 0; position: relative; text-indent: 0; z-index: 99999; @@ -39,6 +39,10 @@ html { margin-top: 32px !important; } float: left; } +#ma-admin-bar li:hover { + color: lightskyblue; +} + #ma-admin-bar .ab-top-secondary>li { float: right; margin-right: 15px; @@ -58,13 +62,13 @@ html { margin-top: 32px !important; } } .dropdown-content a { - color: black; + color: #eee; padding: 12px 16px; text-decoration: none; display: block; } -.dropdown-content a:hover {background-color: #ddd;} +.dropdown-content a:hover {color: lightskyblue;} .dropdown:hover .dropdown-content {display: block;} @@ -72,20 +76,37 @@ html { margin-top: 32px !important; }