Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Some improvements to exercise page for mobile

Roland Geiderf67b4cd1ec9e
diff --git a/wger/exercises/templates/exercise/view.html b/wger/exercises/templates/exercise/view.html
index 3c07cc569..9430da3cd 100644
--- a/wger/exercises/templates/exercise/view.html
+++ b/wger/exercises/templates/exercise/view.html
@@ -69,103 +69,78 @@ $(document).ready(function() {
{% endif %} {# end exercise is pending review #}
-
-<div class="row mt-4">
- <div class="col-md-3">
- <strong>{% trans "Category" %}:</strong>
- </div>
- <div class="col-9">
- {% trans exercise.category.name %}
- </div>
-</div>
+<h5>{% trans "Category" %}:</h5>
+{% trans exercise.category.name %}
{% if exercise.equipment.all %}
-<div class="row mt-4">
- <div class="col-md-3">
- <strong>{% trans "Equipment" %}:</strong>
- </div>
- <div class="col-9">
- {% for equipment in exercise.equipment.all %}
- {% trans equipment.name %}
- {% if not forloop.last %}, {% endif %}
- {% endfor %}
- </div>
-</div>
+ <h5>{% trans "Equipment" %}:</h5>
+ {% for equipment in exercise.equipment.all %}
+ {% trans equipment.name %}
+ {% if not forloop.last %}, {% endif %}
+ {% endfor %}
{% endif %}
-<div class="row mt-4">
- <div class="col-md-3">
- <strong>{% trans "Description" %}:</strong>
- </div>
- <div class="col-md-9">
- {{ exercise.description|safe }}
- </div>
-</div>
+<h5 class="mt-4">{% trans "Description" %}:</h5>
+{{ exercise.description|safe }}
{# Images #}
{% with images=exercise.exerciseimage_set.accepted %}
{% if images or perms.exercises.change_exerciseimage %}
-<div class="row mt-4">
- <div class="col-md-3">
- <strong>{% trans "Images" %}:</strong>
- </div>
- <div class="col-md-9">
- <div class="card-deck">
- {% with other_images=images %}
- {% for image in other_images %}
+ <h5 class="mt-4">{% trans "Images" %}:</h5>
+ <div class="card-deck">
+ {% with other_images=images %}
+ {% for image in other_images %}
- <div class="card">
- <img class="card-img-top" src="{{ image.image|thumbnail_url:'small' }}">
- <div class="card-body">
- <a href="{{ image.image.url }}"
- target="_blank"
- class=" no-hover"
- title="{% trans 'Download' %}">
- <span class="{% fa_class 'download' %}"></span>
- </a>
- {% if perms.exercises.change_exerciseimage %}
- |
- <a href="{% url 'exercise:image:delete' exercise.pk image.pk %}"
- class="wger-modal-dialog no-hover"
- title="{% trans 'Delete' %}">
- <span class="{% fa_class 'trash' %}"></span></a> |
- <a href="{% url 'exercise:image:edit' image.pk %}"
- class="no-hover"
- title="{% trans 'Edit' %}">
- <span class="{% fa_class 'edit' %}"></span></a>
- {% endif %}
+ <div class="card">
+ <img class="card-img-top" src="{{ image.image|thumbnail_url:'small' }}">
+ <div class="card-body">
+ <a href="{{ image.image.url }}"
+ target="_blank"
+ class=" no-hover"
+ title="{% trans 'Download' %}">
+ <span class="{% fa_class 'download' %}"></span>
+ </a>
+ {% if perms.exercises.change_exerciseimage %}
+ |
+ <a href="{% url 'exercise:image:delete' exercise.pk image.pk %}"
+ class="wger-modal-dialog no-hover"
+ title="{% trans 'Delete' %}">
+ <span class="{% fa_class 'trash' %}"></span></a> |
+ <a href="{% url 'exercise:image:edit' image.pk %}"
+ class="no-hover"
+ title="{% trans 'Edit' %}">
+ <span class="{% fa_class 'edit' %}"></span></a>
+ {% endif %}
- <p class="card-text">
- {{image.get_license_display}}
- {% if image.license_author %}
- – {{image.license_author}}
- {% endif %}
- </p>
- </div>
+ <p class="card-text">
+ {{image.get_license_display}}
+ {% if image.license_author %}
+ – {{image.license_author}}
+ {% endif %}
+ </p>
</div>
- {% endfor %}
- {% endwith %}
</div>
-
- {% if perms.exercises.change_exerciseimage %}
- <p>
- <a href="{% url 'exercise:image:add' exercise.id %}" class="btn btn-success btn-sm">
- {% trans "Add new image" %}
- </a>
- </p>
- {% endif %}
+ {% endfor %}
+ {% endwith %}
</div>
-</div>
+
+ {% if perms.exercises.change_exerciseimage %}
+ <p>
+ <a href="{% url 'exercise:image:add' exercise.id %}" >
+ {% trans "Add new image" %}
+ </a>
+ </p>
+ {% endif %}
{% endif %}
{% endwith %}
{% if perms.exercises.change_exerciseimage %}
{% with images=exercise.exerciseimage_set.pending %}
{% if images %}
-<h4>{% trans "Images pending review" %}</h4>
+<h5 class="mt-4">{% trans "Images pending review" %}</h5>
<div class="card-deck">
{% for image in images %}
<div class="card">
@@ -187,38 +162,32 @@ $(document).ready(function() {
{# Comments #}
{% with comments=exercise.exercisecomment_set.all %}
{% if comments or perms.exercises.change_exercisecomment %}
-<div class="row mt-4">
- <div class="col-md-3">
- <strong>{% trans "Comments for this exercise" %}:</strong>
- </div>
- <div class="col-md-9">
- <ul>
- {% for comment in comments %}
- <li>
- {{ comment }}
- {% if perms.exercises.change_exercisecomment %}
- <span class="editoptions">
- <a href="{% url 'exercise:comment:delete' comment.id %}"
- title="{% trans 'Delete' %}">
- <span class="{% fa_class 'trash' %}"></span></a>
- <a href="{% url 'exercise:comment:edit' comment.id %}"
- title="{% trans 'Edit' %}"
- class="wger-modal-dialog">
- <span class="{% fa_class 'edit' %}"></span></a>
- </span>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- {% if perms.exercises.change_exercisecomment %}
- <p>
- <a href="{% url 'exercise:comment:add' exercise.id %}" class="btn btn-success btn-sm wger-modal-dialog">
- {% trans "Add new comment" %}
- </a>
- </p>
- {% endif %}
- </div>
-</div>
+ <h5 class="mt-4">{% trans "Comments for this exercise" %}:</h5>
+ <ul>
+ {% for comment in comments %}
+ <li>
+ {{ comment }}
+ {% if perms.exercises.change_exercisecomment %}
+ <span class="editoptions">
+ <a href="{% url 'exercise:comment:delete' comment.id %}"
+ title="{% trans 'Delete' %}">
+ <span class="{% fa_class 'trash' %}"></span></a>
+ <a href="{% url 'exercise:comment:edit' comment.id %}"
+ title="{% trans 'Edit' %}"
+ class="wger-modal-dialog">
+ <span class="{% fa_class 'edit' %}"></span></a>
+ </span>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ {% if perms.exercises.change_exercisecomment %}
+ <p>
+ <a href="{% url 'exercise:comment:add' exercise.id %}" class="wger-modal-dialog">
+ {% trans "Add new comment" %}
+ </a>
+ </p>
+ {% endif %}
{% endif %}
{% endwith %}
@@ -231,81 +200,63 @@ $(document).ready(function() {
{% with muscles_secondary=exercise.muscles_secondary.all %}
{% if muscles %}
-<div class="row mt-4">
- <div class="col-md-3">
- <strong>{% trans "Muscles" %}:</strong>
- </div>
- <div class="col-md-9">
- <p>
- {% trans "The diagram shows the most used muscles on this exercise" %}
- </p>
- <div class="row">
- <div class="col-md">
- <div style="width:1em;height:1em;background-color:#cc0000;float:left;margin-right:0.5em;"></div>
- {% trans "Main muscles" %}
- </div>
- <div class="col-md">
- <div style="width:1em;height:1em;background-color:#f57900;float:left;margin-right:0.5em;"></div>
- {% trans "Secondary muscles" %}
+ <h5 class="mt-4">{% trans "Muscles" %}:</h5>
+ <p>
+ {% trans "The diagram shows the most used muscles on this exercise" %}
+ </p>
+ <p>
+ <div style="width:1em;height:1em;background-color:#cc0000;float:left;margin-right:0.5em;"></div>
+ {% trans "Main muscles" %}
+ </p>
+ <p>
+ <div style="width:1em;height:1em;background-color:#f57900;float:left;margin-right:0.5em;"></div>
+ {% trans "Secondary muscles" %}
+ </p>
+
+ <div class="row ">
+ <div class="col">
+ <div id="muscle-front" class="muscle-background mx-auto" style="background-image: {% for background in muscle_backgrounds_front %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
</div>
+ <ul class="list-unstyled">
+ {% for muscle in muscles %}
+ {% if muscle.is_front %}
+ <li>{{muscle.name}}</li>
+ {% endif %}
+ {% endfor %}
+
+ {% for muscle in muscles_secondary %}
+ {% if muscle.is_front %}
+ <li>{{muscle.name}}</li>
+ {% endif %}
+ {% endfor %}
+ </ul>
</div>
- <div class="row ">
- <div class="col-md ">
- <div id="muscle-front" class="muscle-background mx-auto" style="background-image: {% for background in muscle_backgrounds_front %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
- </div>
- <ul>
- {% for muscle in muscles %}
- {% if muscle.is_front %}
- <li>{{muscle.name}}</li>
- {% endif %}
- {% endfor %}
-
- {% for muscle in muscles_secondary %}
- {% if muscle.is_front %}
- <li>{{muscle.name}}</li>
- {% endif %}
- {% endfor %}
- </ul>
- </div>
- <div class="col-md">
- <div id="muscle-back" class="muscle-background mx-auto" style="background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
- </div>
- <ul>
- {% for muscle in muscles %}
- {% if not muscle.is_front %}
- <li>{{muscle.name}}</li>
- {% endif %}
- {% endfor %}
-
- {% for muscle in muscles_secondary %}
- {% if not muscle.is_front %}
- <li>{{muscle.name}}</li>
- {% endif %}
- {% endfor %}
- </ul>
+ <div class="col">
+ <div id="muscle-back" class="muscle-background mx-auto" style="background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
</div>
+ <ul class="list-unstyled">
+ {% for muscle in muscles %}
+ {% if not muscle.is_front %}
+ <li>{{muscle.name}}</li>
+ {% endif %}
+ {% endfor %}
+
+ {% for muscle in muscles_secondary %}
+ {% if not muscle.is_front %}
+ <li>{{muscle.name}}</li>
+ {% endif %}
+ {% endfor %}
+ </ul>
</div>
</div>
-</div>
{% endif %}
{% endwith %}
{% endwith %} {# end musclelist #}
{% endcache %}
{% if logs %}
-<div class="row mt-4">
- <div class="col-xs-3">
- <strong>{% trans "Weight log" %}:</strong>
- </div>
- <div class="col-xs-9">
- {% render_weight_log logs svg_uuid user %}
- </div>
-</div>
-
-
-<script>
-
-</script>
+ <h5 class="mt-4">{% trans "Weight log" %}:</h5>
+ {% render_weight_log logs svg_uuid user %}
{% endif %}
{% endblock %}
@@ -316,7 +267,7 @@ $(document).ready(function() {
{# #}
{% block sidebar %}
{% if user.is_authenticated and not user.userprofile.is_temporary and not perms.exercises %}
-<h4>{% trans "Options" %}</h4>
+<h5>{% trans "Options" %}</h5>
<p>
<a href="{% url 'exercise:exercise:correct' exercise.id %}">
<span class="{% fa_class 'edit' %}"></span>