Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Load first muscle on the overview page

Roland Geiderdcb55e79806b
diff --git a/exercises/templates/muscle_overview.html b/exercises/templates/muscle_overview.html
index 611ab6dab..dbbdfec41 100644
--- a/exercises/templates/muscle_overview.html
+++ b/exercises/templates/muscle_overview.html
@@ -10,30 +10,42 @@
{% block header %}
<script>
-$(document).ready(function() {
- $('.muscle').hover(function(e) {
- e.preventDefault();
- var div_id = $(this).data('target');
- var is_front = ($(this).data('isFront') == 'True') ? 'front' : 'back';
- var muscle_id = div_id.match(/\d+/);
- // Reset all other highlighted muscles
- $('.muscle').removeClass('muscle-active');
- $('.muscle').addClass('muscle-inactive');
+function highlight_muscle(element)
+{
+ var div_id = $(element).data('target');
+ var is_front = ($(element).data('isFront') == 'True') ? 'front' : 'back';
+ var muscle_id = div_id.match(/\d+/);
+
+ // Reset all other highlighted muscles
+ $('.muscle').removeClass('muscle-active');
+ $('.muscle').addClass('muscle-inactive');
+
+ // Hightligh the current one
+ $(element).removeClass('muscle-inactive');
+ $(element).addClass('muscle-active');
+
- // Hightligh the current one
- $(this).removeClass('muscle-inactive');
- $(this).addClass('muscle-active');
+ // Set the corresponding background
+ $('#muscle-system').css('background-image',
+ 'url(/static/images/muscles/main/muscle-' + muscle_id + '.svg),'
+ + 'url(/static/images/muscles/muscular_system_' + is_front + '.svg)');
+ // Show the corresponding exercises
+ $('.exercise-list').hide();
+ $('#' + div_id).show();
+}
- // Set the corresponding background
- $('#muscle-system').css('background-image',
- 'url(/static/images/muscles/main/muscle-' + muscle_id + '.svg),'
- + 'url(/static/images/muscles/muscular_system_' + is_front + '.svg)');
+$(document).ready(function() {
+
+
+ // Hightlight the first element
+ highlight_muscle($('.muscle').first());
- // Show the corresponding exercises
- $('.exercise-list').hide();
- $('#' + div_id).show();
+ // Highlight on hover
+ $('.muscle').hover(function(e) {
+ e.preventDefault();
+ highlight_muscle(this);
});
});
</script>
@@ -46,7 +58,7 @@ $(document).ready(function() {
{% block content %}
<h2>{% trans "Muscle overview" %} </h2>
-
+{% trans "Hover with the mouse over the muscles to show corresponding exercises." %}
<div class="ym-grid linearize-level-1">
<div class="ym-g33 ym-gl">
diff --git a/manager/static/css/workout-manager.css b/manager/static/css/workout-manager.css
index 659d38ecd..dee30c8b5 100644
--- a/manager/static/css/workout-manager.css
+++ b/manager/static/css/workout-manager.css
@@ -450,6 +450,7 @@ ul.pagination a:hover
line-height:2em;
margin-left: 0px;
padding-left: 0.3em;
+ cursor: pointer;
}
.muscle-inactive{
@@ -467,3 +468,5 @@ ul.pagination a:hover
box-shadow: inset 0 0 4px #d3d7cf;
border-radius: 3px;
}
+
+