Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Move exercise menu to the workout one

Roland Geider21cde5efcceb
diff --git a/wger/core/templates/navigation.html b/wger/core/templates/navigation.html
index 976bfe0d0..4c799d2ec 100644
--- a/wger/core/templates/navigation.html
+++ b/wger/core/templates/navigation.html
@@ -22,22 +22,13 @@
<li><a class="dropdown-item" href="{% url 'manager:workout:overview' %}" rel="nofollow">{% trans "Workouts" %}</a></li>
<li><a class="dropdown-item" href="{% url 'manager:workout:calendar' user.username %}" rel="nofollow">{% trans "Calendar" %}</a></li>
<li><a class="dropdown-item" href="{% url 'manager:schedule:overview' %}" rel="nofollow">{% trans "Workouts schedules" %}</a></li>
- </ul>
- </li>
- {% endif %}
+ <li class="dropdown-divider"></li>
+ <li class="dropdown-header">{% trans "Exercises" %}</li>
+ <li><a class="dropdown-item" href="{% url 'exercise:exercise:overview' %}">{% trans "by category" context "as in sorted by category" %}</a></li>
+ <li><a class="dropdown-item" href="{% url 'exercise:muscle:overview' %}">{% trans "by muscle" context "as in sorted by muscle" %}</a></li>
+ <li><a class="dropdown-item" href="{% url 'exercise:equipment:overview' %}">{% trans "by equipment" context "as in sorted by equipment" %}</a></li>
- {# #}
- {# Exercises tab #}
- {# #}
- <li class="nav-item dropdown {% if active_tab == 'exercises' %}active{% endif %}">
- <a href="{% url 'exercise:exercise:overview' %}"
- class="dropdown-toggle nav-link"
- data-toggle="dropdown">{% trans "Exercises" %} <b class="caret"></b></a>
- <ul class="dropdown-menu">
- <li><a class="dropdown-item" href="{% url 'exercise:exercise:overview' %}">{% trans "Exercises" %}</a></li>
- <li><a class="dropdown-item" href="{% url 'exercise:muscle:overview' %}">{% trans "Muscle overview" %}</a></li>
- <li><a class="dropdown-item" href="{% url 'exercise:equipment:overview' %}">{% trans "Equipment overview" %}</a></li>
{% if user.is_authenticated and not user.userprofile.is_temporary and not trainer_identity %}
<li class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{% url 'exercise:exercise:add' %}">{% trans "Add new exercise" %}</a><li>
@@ -53,6 +44,7 @@
{% endif %}
</ul>
</li>
+ {% endif %}
{# #}
@@ -64,7 +56,7 @@
<a href="{% url 'weight:overview' user.username %}"
class="dropdown-toggle nav-link"
data-toggle="dropdown"
- rel="nofollow">{% trans "Weight" %} <b class="caret"></b></a>
+ rel="nofollow">{% trans "Body weight" %} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{% url 'weight:overview' user.username %}" rel="nofollow">{% trans "Weight overview" %}</a></li>
<li><a class="dropdown-item" href="{% url 'weight:add' %}" rel="nofollow">{% trans "Add weight entry" %}</a></li>
diff --git a/wger/exercises/tests/test_exercise.py b/wger/exercises/tests/test_exercise.py
index d26ac34aa..626e611d4 100644
--- a/wger/exercises/tests/test_exercise.py
+++ b/wger/exercises/tests/test_exercise.py
@@ -33,6 +33,7 @@ from wger.exercises.models import (
Muscle
)
from wger.utils.cache import cache_mapper
+from wger.utils.constants import WORKOUT_TAB
class ExerciseRepresentationTestCase(WorkoutManagerTestCase):
@@ -81,7 +82,7 @@ class ExerciseIndexTestCase(WorkoutManagerTestCase):
self.assertEqual(response.status_code, 200)
# Correct tab is selected
- self.assertEqual(response.context['active_tab'], 'exercises')
+ self.assertEqual(response.context['active_tab'], WORKOUT_TAB)
# Correct categories are shown
category_1 = response.context['exercises'][0].category
@@ -170,7 +171,7 @@ class ExerciseDetailTestCase(WorkoutManagerTestCase):
self.assertEqual(response.status_code, 200)
# Correct tab is selected
- self.assertEqual(response.context['active_tab'], 'exercises')
+ self.assertEqual(response.context['active_tab'], WORKOUT_TAB)
# Exercise loaded correct muscles
exercise_1 = response.context['exercise']
@@ -298,7 +299,7 @@ class ExercisesTestCase(WorkoutManagerTestCase):
self.assertEqual(response.status_code, 200)
# Navigation tab
- self.assertEqual(response.context['active_tab'], 'exercises')
+ self.assertEqual(response.context['active_tab'], WORKOUT_TAB)
exercise_1 = Exercise.objects.get(pk=exercise_id)
self.assertEqual(exercise_1.name, 'my Test Exercise')
diff --git a/wger/manager/tests/test_weight_log.py b/wger/manager/tests/test_weight_log.py
index 9ef637811..ddc71fc10 100644
--- a/wger/manager/tests/test_weight_log.py
+++ b/wger/manager/tests/test_weight_log.py
@@ -37,7 +37,7 @@ from wger.manager.models import (
WorkoutSession
)
from wger.utils.cache import cache_mapper
-
+from wger.utils.constants import WORKOUT_TAB
logger = logging.getLogger(__name__)
@@ -181,7 +181,7 @@ class WeightLogOverviewAddTestCase(WorkoutManagerTestCase):
# All access OK, since user 1 has ro_access = True
self.assertEqual(response.status_code, 200)
- self.assertEqual(response.context['active_tab'], 'workout')
+ self.assertEqual(response.context['active_tab'], WORKOUT_TAB)
self.assertEqual(response.context['workout'].id, 1)
# Open the log entry page
diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.py
index bfb82836e..11cac4480 100644
--- a/wger/utils/context_processor.py
+++ b/wger/utils/context_processor.py
@@ -81,7 +81,7 @@ def processor(request):
context['show_shariff'] = True
elif '/exercise/' in request.get_full_path():
- context['active_tab'] = constants.EXERCISE_TAB
+ context['active_tab'] = constants.WORKOUT_TAB
elif '/nutrition/' in request.get_full_path():
context['active_tab'] = constants.NUTRITION_TAB