Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Make muscle overview page work for mobile

Roland Geiderf2c10628fb50
diff --git a/wger/exercises/templates/mobile/muscles/overview.html b/wger/exercises/templates/mobile/muscles/overview.html
index 327c00457..cbcfc84f6 100644
--- a/wger/exercises/templates/mobile/muscles/overview.html
+++ b/wger/exercises/templates/mobile/muscles/overview.html
@@ -45,7 +45,7 @@ function highlight_muscle(element)
$('#' + div_id).show();
}
-$(document).ready(function() {
+$(document).on('pageinit', function(){
//Prefetch the background images
{% for muscle in muscle_list|first %}
prefetch_images(['/static/images/muscles/main/muscle-' + {{muscle.id}} + '.svg']);
@@ -57,7 +57,7 @@ $(document).ready(function() {
highlight_muscle($('.muscle').first());
// Highlight on hover
- $('.muscle').hover(function(e) {
+ $('.muscle').on( "vmouseover", function(e) {
e.preventDefault();
highlight_muscle(this);
});
@@ -70,68 +70,63 @@ $(document).ready(function() {
Main Content
-->
{% block content %}
-{% cache cache_timeout muscle-overview language.id %}
{% 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">
- <div class="ym-gbox-left">
- <h3 style="padding-bottom:0.5em;">{% trans "Muscles" %}</h3>
- <div id="muscle-system"
- class="muscle-background"
- style="background-image: url('/static/images/muscles/muscular_system_front.svg');">
- </div>
- </div>
- </div>
- <div class="ym-g33 ym-gl">
- <div class="ym-gbox-left">
- {# Why do we need to use |first? #}
- {% regroup muscle_list|first by is_front as muscle_group %}
- {% for group in muscle_group %}
- {% if group.grouper %}
- <h3>{% trans "Front side" %}</h3>
- {% else %}
- <h3>{% trans "Back side" %}</h3>
- {% endif %}
-
- <ul class="muscle-list">
- {% for muscle in group.list %}
- <li class="muscle"
- data-target="muscle-{{muscle.id}}"
- data-is-front="{{muscle.is_front}}"
- data-name="{{muscle.name}}"
- itemscope itemtype="http://schema.org/Muscle">
- <span itemprop="name">{{muscle.name}}</span>
- </li>
- {% endfor %}
- </ul>
+
+
+<div class="ui-grid-a">
+ <div class="ui-block-a">
+ {# Why do we need to use |first? #}
+ {% regroup muscle_list|first by is_front as muscle_group %}
+ {% for group in muscle_group %}
+ {% if group.grouper %}
+ <h3>{% trans "Front side" %}</h3>
+ {% else %}
+ <h3>{% trans "Back side" %}</h3>
+ {% endif %}
+
+ <ul class="muscle-list">
+ {% for muscle in group.list %}
+ <li class="muscle"
+ data-target="muscle-{{muscle.id}}"
+ data-is-front="{{muscle.is_front}}"
+ data-name="{{muscle.name}}"
+ itemscope itemtype="http://schema.org/Muscle">
+ <span itemprop="name">{{muscle.name}}</span>
+ </li>
{% endfor %}
- </div>
+ </ul>
+ {% endfor %}
</div>
- <div class="ym-g33 ym-gr">
- <div class="ym-gbox-right">
- {% for muscle in muscle_list|first %}
- <div id="muscle-{{muscle.id}}" style="display:none;" class="exercise-list">
- <h3>{% trans "Exercises" %}</h3>
- <ul class="exercise-overview">
- {% for exercise in muscle.exercise_set.select_related %}
- {% if exercise.language in active_languages %}
- <li class="exercise">
- <a href="{{exercise.get_absolute_url}}">{{exercise}}</a>
- </li>
- {% endif %}
- {% empty %}
- <li>
- <em>{% trans "No exercises that mainly train this muscle" %}</em>
- </li>
- {% endfor %}
- </ul>
- </div>
- {% endfor %}
+ <div class="ui-block-b">
+ <h3 style="padding-bottom:0.5em;">{% trans "Muscles" %}</h3>
+ <div id="muscle-system"
+ class="muscle-background"
+ style="background-image: url('/static/images/muscles/muscular_system_front.svg');">
</div>
</div>
</div>
-{% endcache %}
+
+
+
+{% for muscle in muscle_list|first %}
+ <div id="muscle-{{muscle.id}}" style="display:none;" class="exercise-list">
+ <h3>{% trans "Exercises" %}</h3>
+ <ul class="exercise-overview">
+ {% for exercise in muscle.exercise_set.select_related %}
+ {% if exercise.language in active_languages %}
+ <li class="exercise">
+ <a href="{{exercise.get_absolute_url}}">{{exercise}}</a>
+ </li>
+ {% endif %}
+ {% empty %}
+ <li>
+ <em>{% trans "No exercises that mainly train this muscle" %}</em>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+{% endfor %}
{% if perms.exercises %}
<h3>{% trans "Options" %}</h3>
diff --git a/wger/manager/static/css/workout-manager-common.css b/wger/manager/static/css/workout-manager-common.css
index 4121b8f8f..d5e99c932 100644
--- a/wger/manager/static/css/workout-manager-common.css
+++ b/wger/manager/static/css/workout-manager-common.css
@@ -127,4 +127,44 @@ circle.color-bcbd22:hover
circle.color-17becf:hover
{
fill: #17becf;
+}
+
+
+/**************************************************************
+ * Muscle overview
+ **************************************************************/
+.muscle-list, .exercise-overview{
+ list-style-type: none;
+ margin-left: 0px;
+}
+
+.muscle-list .muscle, .exercise-overview .exercise{
+ line-height:2em;
+ margin-left: 0px;
+ padding-left: 0.3em;
+ cursor: pointer;
+}
+
+.muscle-list .muscle-inactive{
+ background-color: transparent;
+ font-weight: normal;
+ border: 1px solid transparent;
+ box-shadow: none;
+ border-radius: 0px;
+}
+
+.muscle-list .muscle-active{
+ font-weight: bold;
+ background-color: #eeeeec;
+ border: 1px solid #babdb6;
+ box-shadow: inset 0 0 4px #d3d7cf;
+ border-radius: 3px;
+}
+
+
+.muscle-list .muscle{
+ line-height:2em;
+ margin-left: 0px;
+ padding-left: 0.3em;
+ cursor: pointer;
}
\ No newline at end of file
diff --git a/wger/manager/static/css/workout-manager-mobile.css b/wger/manager/static/css/workout-manager-mobile.css
index a7518258d..0b595e186 100644
--- a/wger/manager/static/css/workout-manager-mobile.css
+++ b/wger/manager/static/css/workout-manager-mobile.css
@@ -158,4 +158,12 @@ div.muscle-background
width: 200px;
height: 369px;
background-repeat: no-repeat;
-}
\ No newline at end of file
+}
+
+
+/**************************************************************
+ * Muscle overview
+ **************************************************************/
+.muscle-list, .exercise-overview{
+ padding-left: 0px;
+}
diff --git a/wger/manager/static/css/workout-manager.css b/wger/manager/static/css/workout-manager.css
index 4bda996c2..65e5402f6 100644
--- a/wger/manager/static/css/workout-manager.css
+++ b/wger/manager/static/css/workout-manager.css
@@ -322,45 +322,6 @@ ul.pagination a:hover
}
-/**************************************************************
- * Muscle overview
- **************************************************************/
-.muscle-list, .exercise-overview{
- list-style-type: none;
- margin-left: 0px;
-}
-
-.muscle-list .muscle, .exercise-overview .exercise{
- line-height:2em;
- margin-left: 0px;
- padding-left: 0.3em;
- cursor: pointer;
-}
-
-.muscle-list .muscle-inactive{
- background-color: transparent;
- font-weight: normal;
- border: 1px solid transparent;
- box-shadow: none;
- border-radius: 0px;
-}
-
-.muscle-list .muscle-active{
- font-weight: bold;
- background-color: #eeeeec;
- border: 1px solid #babdb6;
- box-shadow: inset 0 0 4px #d3d7cf;
- border-radius: 3px;
-}
-
-
-.muscle-list .muscle{
- line-height:2em;
- margin-left: 0px;
- padding-left: 0.3em;
- cursor: pointer;
-}
-
/*
* Definition for extra-bold fonts
*/
diff --git a/wger/manager/templates/mobile/template.html b/wger/manager/templates/mobile/template.html
index 674332aa0..79136ee0b 100644
--- a/wger/manager/templates/mobile/template.html
+++ b/wger/manager/templates/mobile/template.html
@@ -28,6 +28,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="{% static 'css/jquery-mobile.css' %}">
+ <link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager-common.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager-mobile.css' %}">