From dd4587faf367b95df3194835bc08f57775185680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20H=C3=A1la?= Date: Sat, 16 Sep 2023 10:10:18 +0200 Subject: [PATCH] Top-level log in --- backend/menus.py | 14 ++++++-------- frontend/static/styles.sass | 5 ++++- frontend/templates/base/index.html | 8 +++++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/backend/menus.py b/backend/menus.py index 3102130..1cc1f1d 100644 --- a/backend/menus.py +++ b/backend/menus.py @@ -22,21 +22,19 @@ ) account_children = ( - MenuItem( - _("Log in"), - reverse("login"), - check=lambda request: not request.user.is_authenticated, - ), MenuItem( _("Logout"), reverse("logout"), - check=lambda request: request.user.is_authenticated, ), MenuItem( _("Change password"), reverse("password_change"), - check=lambda request: request.user.is_authenticated, ), ) -Menu.add_item("account", MenuItem(_("Account"), reverse("login"), children=account_children)) +Menu.add_item( + "account", + MenuItem( + _("Account"), reverse("login"), children=account_children, check=lambda request: request.user.is_authenticated + ), +) diff --git a/frontend/static/styles.sass b/frontend/static/styles.sass index 4090c96..fd5affc 100644 --- a/frontend/static/styles.sass +++ b/frontend/static/styles.sass @@ -154,4 +154,7 @@ p /* Set the fixed height of the footer here */ .footer height: 60px - background-color: #f5f5f5 \ No newline at end of file + background-color: #f5f5f5 + +.custom-link + color: $colDefault \ No newline at end of file diff --git a/frontend/templates/base/index.html b/frontend/templates/base/index.html index 3f52d6f..6a4a098 100644 --- a/frontend/templates/base/index.html +++ b/frontend/templates/base/index.html @@ -87,12 +87,14 @@ - {% if user.is_authenticated %} - {% trans "Logged as" %} {{ user.username }} - {% endif %} + {% if user.is_authenticated %} + {% trans "Logged as" %} {{ user.username }} + {% else %} + {% trans "Log in" %} + {% endif %}