Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Mark current active tab by underlining the name

Roland Geider626bf9627c7c
diff --git a/wger/core/templates/navigation.html b/wger/core/templates/navigation.html
index b806bb11a..3124b17cf 100644
--- a/wger/core/templates/navigation.html
+++ b/wger/core/templates/navigation.html
@@ -24,9 +24,8 @@
<li class="nav-item dropdown">
<a href="{% url 'manager:routine:overview' %}"
rel="nofollow"
- class="nav-link dropdown-toggle text-white {% if active_tab == 'workout' %}active{% endif %}"
- data-bs-toggle="dropdown">{% translate "Training" %} <b
- class="caret"></b></a>
+ class="nav-link dropdown-toggle text-white {% if active_tab == 'workout' %}text-decoration-underline{% endif %}"
+ data-bs-toggle="dropdown">{% translate "Training" %} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{% url 'manager:routine:overview' %}"
@@ -143,7 +142,7 @@
{# #}
<li class="nav-item dropdown">
<a href="{% url 'nutrition:plan:overview' %}"
- class="dropdown-toggle nav-link text-white {% if active_tab == 'nutrition' %}active{% endif %}"
+ class="dropdown-toggle nav-link text-white {% if active_tab == 'nutrition' %}text-decoration-underline{% endif %}"
data-bs-toggle="dropdown"
rel="nofollow">{% translate "Nutrition" %} <b class="caret"></b></a>
<ul class="dropdown-menu">
@@ -200,7 +199,7 @@
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a href="{% url 'weight:overview' %}"
- class="dropdown-toggle nav-link text-white {% if active_tab == 'weight' %}active{% endif %}"
+ class="dropdown-toggle nav-link text-white {% if active_tab == 'weight' %}text-decoration-underline{% endif %}"
data-bs-toggle="dropdown"
rel="nofollow">{% translate "Body weight" %} <b
class="caret"></b></a>
@@ -222,7 +221,7 @@
{# #}
<li class="nav-item dropdown">
<a href=""
- class="dropdown-toggle nav-link text-white {% if active_tab == 'software' %}active{% endif %}"
+ class="dropdown-toggle nav-link text-white {% if active_tab == 'software' %}text-decoration-underline{% endif %}"
data-bs-toggle="dropdown">{% translate "About this software" %} <b
class="caret"></b></a>
<ul class="dropdown-menu">
diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.py
index a19f95575..2632f75ee 100644
--- a/wger/utils/context_processor.py
+++ b/wger/utils/context_processor.py
@@ -69,23 +69,22 @@ def processor(request):
}
# Pseudo-intelligent navigation here
- if (
- '/software/' in request.get_full_path()
- or '/contact' in request.get_full_path()
- or '/api/v2' in request.get_full_path()
- ):
+ if '/software/' in full_path or '/contact' in full_path or '/api/v2' in full_path:
context['active_tab'] = constants.SOFTWARE_TAB
- elif '/exercise/' in request.get_full_path():
- context['active_tab'] = constants.WORKOUT_TAB
-
- elif '/nutrition/' in request.get_full_path():
+ elif '/nutrition/' in full_path:
context['active_tab'] = constants.NUTRITION_TAB
- elif '/weight/' in request.get_full_path():
+ elif '/weight/' in full_path:
context['active_tab'] = constants.WEIGHT_TAB
- elif '/workout/' in request.get_full_path():
+ elif (
+ '/routine/' in full_path
+ or '/measurement/' in full_path
+ or '/exercise/' in full_path
+ or '/gallery/' in full_path
+ or '/trophies/' in full_path
+ ):
context['active_tab'] = constants.WORKOUT_TAB
return context