Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add a silhouette of the human body with the muscles the workout will train.
Roland Geiderdf7238de1109
diff --git a/manager/templates/workout/view.html b/manager/templates/workout/view.htmlindex 63c9a1242..65763921c 100644--- a/manager/templates/workout/view.html+++ b/manager/templates/workout/view.html@@ -62,13 +62,40 @@ $(document).ready(function() {-->{% block sidebar %}<h3>{% trans "Steps" %}</h3>+<ol>- <li>{% trans "Days" %}</li>- <li>{% trans "Sets on days" %}</li>- <li>{% trans "Exercises on set" %}</li>- <li>{% trans "Settings for set" %}</li>+ <li>{% trans "Add training days" %}</li>+ <li>{% trans "Add working sets to days" %}</li>+ <li>{% trans "Edit exercise settings for sets" %}</li></ol>++<h3>{% trans "Muscles trained" %}</h3>++<p>+ {% trans "Image show combined muscles as trained by the exercises on the workout." %}+ {% trans "A darker colour indicates a higher number of exercises that train that specific part." %}+</p>++<div class="ym-grid linearize-level-1">+ <div class="ym-g50 ym-gl">+ <div class="ym-gbox-left">+ <div id="muscle-front"+ class="muscle-background"+ style="width: 120px; height: 220px; background-size: 120px; background-image: {% for background in muscle_backgrounds_front %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">+ </div>+ </div>+ </div>+ <div class="ym-g50 ym-gr">+ <div class="ym-gbox-right">+ <div id="muscle-front"+ class="muscle-background"+ style="width: 120px; height: 220px; background-size: 120px; background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">+ </div>+ </div>+ </div>+</div>+<h3>{% trans "Options" %}</h3><a href="{% url manager.views.pdf_workout workout.id %}"target="_blank">diff --git a/manager/views.py b/manager/views.pyindex f800e3ebc..ab1828c64 100644--- a/manager/views.py+++ b/manager/views.py@@ -130,6 +130,31 @@ def view_workout(request, id):workout = get_object_or_404(TrainingSchedule, pk=id, user=request.user)template_data['workout'] = workout++ # TODO: this can't be performant, see if it makes problems+ # Create the backgrounds that show what muscles the workout will work on+ backgrounds_front = []+ backgrounds_back = []+ is_front = True+ for day in workout.day_set.select_related():+ for set in day.set_set.select_related():+ for exercise in set.exercises.select_related():+ for muscle in exercise.muscles.all():+ logger.debug(exercise)++ if muscle.is_front:+ backgrounds_front.append('images/muscles/main/muscle-%s.svg' % muscle.id)+ else:+ backgrounds_back.append('images/muscles/main/muscle-%s.svg' % muscle.id)++ # Append the correct "main" background, with the silhouette of the human body+ backgrounds_front.append('images/muscles/muscular_system_front.svg')+ backgrounds_back.append('images/muscles/muscular_system_back.svg')++ template_data['muscle_backgrounds_front'] = backgrounds_front+ template_data['muscle_backgrounds_back'] = backgrounds_back++return render_to_response('workout/view.html',template_data,context_instance=RequestContext(request))