Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Work on some mobile pages in the exercise app

Roland Geider8625a4cb00fa
diff --git a/wger/core/management/commands/clear-cache.py b/wger/core/management/commands/clear-cache.py
index a4dbd96be..ef0301dc7 100644
--- a/wger/core/management/commands/clear-cache.py
+++ b/wger/core/management/commands/clear-cache.py
@@ -63,7 +63,6 @@ class Command(BaseCommand):
delete_template_fragment_cache('exercise-overview-mobile', language.id)
delete_template_fragment_cache('exercise-overview-search', language.id)
delete_template_fragment_cache('equipment-overview', language.id)
- delete_template_fragment_cache('equipment-overview-mobile', language.id)
for language in Language.objects.all():
for exercise in Exercise.objects.all():
diff --git a/wger/core/templates/mobile/template.html b/wger/core/templates/mobile/template.html
index 0aaa94e8e..eb8dcd8b8 100644
--- a/wger/core/templates/mobile/template.html
+++ b/wger/core/templates/mobile/template.html
@@ -29,7 +29,7 @@
<link rel="icon" href="{% static 'images/favicon.png' %}" type="image/png">
- {% compress tcss %}
+ {% compress css %}
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap-custom.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager-common.css' %}">
diff --git a/wger/exercises/models.py b/wger/exercises/models.py
index 25c59ac45..4b90ba7f3 100644
--- a/wger/exercises/models.py
+++ b/wger/exercises/models.py
@@ -228,7 +228,6 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):
delete_template_fragment_cache('exercise-detail-header', self.id, language.id)
delete_template_fragment_cache('exercise-detail-muscles', self.id, language.id)
delete_template_fragment_cache('equipment-overview', language.id)
- delete_template_fragment_cache('equipment-overview-mobile', language.id)
# Cached workouts
for set in self.set_set.all():
@@ -252,7 +251,6 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):
delete_template_fragment_cache('exercise-detail-header', self.id, language.id)
delete_template_fragment_cache('exercise-detail-muscles', self.id, language.id)
delete_template_fragment_cache('equipment-overview', language.id)
- delete_template_fragment_cache('equipment-overview-mobile', language.id)
# Cached workouts
for set in self.set_set.all():
@@ -391,7 +389,6 @@ class ExerciseImage(AbstractSubmissionModel, AbstractLicenseModel, models.Model)
delete_template_fragment_cache('exercise-overview-mobile', language.id)
delete_template_fragment_cache('exercise-overview-search', language.id)
delete_template_fragment_cache('equipment-overview', language.id)
- delete_template_fragment_cache('equipment-overview-mobile', language.id)
delete_template_fragment_cache('exercise-detail-header',
self.exercise.id,
language.id)
@@ -416,7 +413,6 @@ class ExerciseImage(AbstractSubmissionModel, AbstractLicenseModel, models.Model)
delete_template_fragment_cache('exercise-detail-header', self.exercise.id, language.id)
delete_template_fragment_cache('exercise-detail-muscles', self.exercise.id, language.id)
delete_template_fragment_cache('equipment-overview', language.id)
- delete_template_fragment_cache('equipment-overview-mobile', language.id)
# Make sure there is always a main image
if not ExerciseImage.objects.accepted() \
diff --git a/wger/exercises/templates/equipment/overview.html b/wger/exercises/templates/equipment/overview.html
index 6ebff5c7e..219931bde 100644
--- a/wger/exercises/templates/equipment/overview.html
+++ b/wger/exercises/templates/equipment/overview.html
@@ -105,7 +105,7 @@ $(function() {
<h3>{% trans "Add new exercise" %}</h3>
<p>
{% if user.is_authenticated and not user.userprofile.is_temporary %}
- <a href="{% url 'exercise-add' %}">
+ <a href="{% url 'exercise-add' %}" {% auto_link_css flavour %}>
<img src="{% static 'images/icons/new.svg' %}"
width="32"
height="32"
@@ -137,7 +137,7 @@ $(function() {
<input name="term"
type="search"
id="exercise-search"
- class="ajax-form-element"
+ class="ajax-form-element form-control"
placeholder="{% trans 'exercise name' %}"
style="width:100%;">
</form>
diff --git a/wger/exercises/templates/exercise/view.html b/wger/exercises/templates/exercise/view.html
index b4f359596..0bcf42bd8 100644
--- a/wger/exercises/templates/exercise/view.html
+++ b/wger/exercises/templates/exercise/view.html
@@ -245,8 +245,8 @@ included in the database.{% endblocktrans %}
-<div class="container-fluid" style="margin-top:1em;">
- <div class="col-md-6">
+<div class="row" style="margin-top:1em;">
+ <div class="col-md-6 col-xs-6">
<div id="muscle-front" class="muscle-background" style="background-image: {% for background in muscle_backgrounds_front %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
</div>
<ul>
@@ -263,7 +263,7 @@ included in the database.{% endblocktrans %}
{% endfor %}
</ul>
</div>
- <div class="col-md-6">
+ <div class="col-md-6 col-xs-6">
<div id="muscle-back" class="muscle-background" style="background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};">
</div>
<ul>
@@ -312,7 +312,7 @@ weight_log_chart({{json|safe}}, "{{svg_uuid}}", "{{reps}}")
<h3>{% trans "Back to overview" %}</h3>
<p>
- <a href="{% url 'exercise-overview' %}">
+ <a href="{% url 'exercise-overview' %}" {% auto_link_css flavour %}>
<img src="{% static 'images/icons/list.svg' %}"
width="32"
height="32"
@@ -326,7 +326,7 @@ weight_log_chart({{json|safe}}, "{{svg_uuid}}", "{{reps}}")
{% if perms.exercises %}
<h3>{% trans "Options" %}</h3>
<p>
- <a href="{% url 'exercise-edit' exercise.id %}">
+ <a href="{% url 'exercise-edit' exercise.id %}" {% auto_link_css flavour "wger-modal-dialog" %}>
<img src="{% static 'images/icons/edit.svg' %}"
width="32"
height="32"
@@ -336,7 +336,7 @@ weight_log_chart({{json|safe}}, "{{svg_uuid}}", "{{reps}}")
</p>
<p>
<a href="{% url 'exercise-delete' exercise.id %}"
- class="wger-modal-dialog">
+ {% auto_link_css flavour "wger-modal-dialog" %}>
<img src="{% static 'images/icons/trash.svg' %}"
width="32"
height="32"
diff --git a/wger/exercises/templates/mobile/equipment/overview.html b/wger/exercises/templates/mobile/equipment/overview.html
deleted file mode 100644
index 1b202aa4d..000000000
--- a/wger/exercises/templates/mobile/equipment/overview.html
+++ /dev/null
@@ -1,148 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load wger_extras %}
-{% load thumbnail %}
-{% load cache %}
-
-<!--
- Title
--->
-{% block title %}{% trans "Exercises" %}{% endblock %}
-
-
-<!--
- Main Content
--->
-{% block content %}
-{% cache cache_timeout equipment-overview-mobile language.id %}
-<div data-role="collapsible-set" data-theme="c" data-content-theme="c">
-{% for equipment in equipment_list %}
- <div data-role="collapsible">
- <h3>{% trans equipment.name %}</h3>
-
- <ul data-role="listview">
- {% for exercise in equipment.exercise_set.all %}
- {% if exercise.language in exercise_languages %}
- <li>
- <a href="{{ exercise.get_absolute_url }}" data-ajax="false">
- {% if exercise.main_image.image %}
- <img src="{{ exercise.main_image.image|thumbnail_url:'small' }}">
- {% endif %}
- {{ exercise.name }}</a>
- </li>
- {% endif %}
- {% empty %}
- <li>
- {% trans "No exercises for this equipment. Add or edit an exercise and set the equipment." %}
- </li>
- {% endfor %}
- </ul>
- </div>
-{% endfor %}
-</div>
-{% endcache %}
-{% endblock %}
-
-
-<!--
- Side bar
--->
-{% block sidebar %}
-<h3>{% trans "Search" %}</h3>
-<br>
-
-{% cache cache_timeout exercise-overview-search language.id %}
-<ul data-role="listview"
- data-theme="c"
- data-filter="true"
- data-filter-reveal="true"
- data-inset="true"
- data-filter-placeholder="{% trans 'exercise name' %}"
- id="exercise_search_form">
- {% for equipment in equipment_list %}
- {% for exercise in equipment.exercise_set.all %}
- <li>
- <a href="{{ exercise.get_absolute_url }}" data-ajax="false">
- {% if exercise.main_image.image %}
- <img src="{{ exercise.main_image.image|thumbnail_url:'small' }}">
- {% endif %}
- {{ exercise.name }}</a>
- </li>
- {% endfor %}
- {% endfor %}
-</ul>
-{% endcache %}
-
-<h3>{% trans "Add new exercise" %}</h3>
-<p>
- {% if user.is_authenticated and not user.userprofile.is_temporary %}
- <a href="{% url 'exercise-add' %}" data-role="button">
- <img src="{% static 'images/icons/new.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Add new exercise' %}"
- title="{% trans 'Add new exercise' %}">
- {% trans "Add new exercise" %}
- </a>
- {% else %}
- <span data-role="button" class="ui-disabled">
- <img src="{% static 'images/icons/new.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Add new exercise' %}"
- title="{% trans 'Add new exercise' %}">
- {% trans "Only registered users can do this" %}
- </span>
- {% endif %}
-</p>
-
-
-{% if perms.exercises %}
- <h3>{% trans "Options" %}</h3>
- {% if categories %}
- <p>
- {% with category=categories|first %}
- <a href="{% url 'exercisecategory-edit' category.id %}"
- data-role="button"
- id="current-category-edit">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Edit category' %}"
- title="{% trans 'Edit category' %}">
- {% trans "Edit category" %}:
- <span class="current-category-name">{{category.name}}</span>
- </a>
- </p>
- {% endwith %}
- <p>
- {% with category=categories|first %}
- <a href="{% url 'exercisecategory-delete' category.id %}"
- data-role="button"
- id="current-category-delete">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Delete category' %}"
- title="{% trans 'Delete category' %}">
- {% trans "Delete category" %}:
- <span class="current-category-name">{{category.name}}</span>
- </a>
- {% endwith %}
- </p>
- {% endif %}
-
- <p>
- <a href="{% url 'exercisecategory-add' %}"
- data-role="button">
- <img src="{% static 'images/icons/folder-new.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Add category' %}"
- title="{% trans 'Add category' %}">
- {% trans "Add category" %}
- </a>
- </p>
-{% endif %}
-{% endblock %}
diff --git a/wger/exercises/templates/mobile/exercise/view.html b/wger/exercises/templates/mobile/exercise/view.html
deleted file mode 100644
index 6c9f5c6e4..000000000
--- a/wger/exercises/templates/mobile/exercise/view.html
+++ /dev/null
@@ -1,373 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load wger_extras %}
-{% load thumbnail %}
-{% load cache %}
-
-{% block header %}
-<script src="{% static 'js/tinymce/tinymce.min.js' %}"></script>
-
-<script>
-function custom_modal_init()
-{
- // Set up the tinyMCE editor on modal dialogs
- init_tinymce();
-}
-</script>
-{% endblock %}
-<!--
- Title
--->
-{% block title %}{{ exercise.name }}{% endblock %}
-
-
-<!--
- Main Content
--->
-{% block content %}
-
-{% if exercise.status == exercise.STATUS_PENDING %}
-<div class="alert">
-<h3>{% trans "Exercise is pending review" %}</h3>
-<p>{% blocktrans %}This user submitted exercise is pending a decision to be
-included in the database.{% endblocktrans %}
-{% trans "Till then, it will not be shown in the overview or the search." %}
-{% if perms.exercises %}{% trans "Please select one of the options below." %}{% endif %}
-</p>
-
-{% if perms.exercises %}
-<div data-role="controlgroup">
- <a href="{% url 'exercise-decline' exercise.id %}"
- data-role="button">
- <img src="{% static 'images/icons/status-off.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Decline' %}">
- {% trans "Decline" %}
- </a>
- <a href="{% url 'exercise-accept' exercise.id %}"
- data-role="button">
- <img src="{% static 'images/icons/status-on.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Accept' %}">
- {% trans "Accept" %}
- </a>
-</div>
-{% endif %} {# end check permissions #}
-
-</div>
-{% endif %} {# end exercise is pending review #}
-
-
-<p><strong>{% trans "Category" %}:</strong> {% trans exercise.category.name %}</p>
-{% if exercise.equipment.all %}
- <p><strong>{% trans "Equipment" %}:</strong>
- {% for equipment in exercise.equipment.all %}
- {% trans equipment.name %}
- {% if not forloop.last %}, {% endif %}
- {% endfor %}
- </p>
-{% endif %}
-
-<div>{{ exercise.description|safe }}</div>
-
-{# #}
-{# Comments #}
-{# #}
-{% with comments=exercise.exercisecomment_set.all %}
-{% if comments %}
-<h4>{% trans "Comments for this exercise" %}</h4>
-
-<ul>
-{% for comment in comments %}
- <li>
- {{ comment }}
- {% if perms.exercises %}
- <span class="editoptions">
- <a href="{% url 'exercisecomment-delete' comment.id %}"
- title="{% trans 'Delete' %}">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Delete' %}"></a>
- <a href="{% url 'exercisecomment-edit' comment.id %}"
- title="{% trans 'Edit' %}">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Edit' %}"></a>
- </span>
- {% endif %}
- </li>
-{% endfor %}
-</ul>
-{% endif %}
-{% endwith %}
-
-{% if perms.exercises %}
-<p>
- <a href="{% url 'exercisecomment-add' exercise.id %}"
- title="{% trans 'Add' %}"
- data-role="button">
- <img src="{% static 'images/icons/add.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Add new comment' %}">
- {% trans "Add new comment" %}</a>
-</p>
-{% endif %}
-
-
-{# #}
-{# Images #}
-{# #}
-{% with images=exercise.exerciseimage_set.all %}
-{% if images %}
- <h4>{% trans "Images" %}</h4>
-
- <div class="image-gallery">
- {% for image in images %}
- <div data-role="popup"
- id="image-popup-{{image.pk}}"
- data-overlay-theme="a"
- class="ui-content">
- <h3>{% trans "Download" %}</h3>
-
- <a href="{{ image.image.url }}"
- target="_blank"
- class="image-link"
- data-role="button">
- {% trans "Full size" %}</a>
-
- <a href="{{ image.image|thumbnail_url:'large' }}"
- target="_blank"
- class="image-link"
- data-role="button">
- {% trans "Reduced size" %}</a>
-
- <h3>{% trans "License" %}</h3>
- <p>
- {{image.get_license_display}}
- {% if image.license_author %}
- – {{image.license_author}}
- {% endif %}
- </p>
-
- {% if perms.exercises.change_exerciseimage %}
- <h3>{% trans "Options" %}</h3>
- <a href="{% url 'exerciseimage-delete' exercise.pk image.pk %}"
- data-role="button">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="22"
- height="22"
- alt="{% trans 'Delete' %}">
- {% trans 'Delete' %}</a>
-
- <a href="{% url 'exerciseimage-edit' image.pk %}"
- data-role="button"
- data-ajax="false">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="22"
- height="22"
- alt="{% trans 'Edit' %}">
- {% trans 'Edit' %}</a>
- {% endif %}
- </div>
-
- <div class="image-box">
- <div class="boxInner">
- <a href="#image-popup-{{image.pk}}"
- data-rel="popup"
- data-position-to="window">
- <img src="{{ image.image|thumbnail_url:'medium' }}"
- alt=""
- class="gallery-image">
- </a>
- </div>
- </div>
- {% endfor %}
- </div>
-
-{% endif %}
-{% endwith %}
-
-{% if perms.exercises.change_exerciseimage %}
-{% with images=exercise.exerciseimage_set.pending %}
-{% if images %}
-<h3>{% trans "Pending images" %}</h3>
-<ul data-role="listview" data-inset="true">
- {% for image in images %}
- <li>
- <div style="width:60px;height:60px;" class="pull-left">
- <a href="{{image.image.url}}">
- <img alt="{{ image.exercise.name }}"
- class="media-object "
- style="max-width:100%; max-height:100%;"
- src="{{ image.image|thumbnail_url:'thumbnail' }}">
- </a>
- </div>
- <div class="media-body">
- <h4 class="media-heading">{{ image.image }}</h4>
- <a href="{% url 'exerciseimage-accept' image.pk %}" class="ui-btn ui-btn-inline">{% trans "Accept" %}</a>
- <a href="{% url 'exerciseimage-decline' image.pk %}" class="ui-btn ui-btn-inline">{% trans "Decline" %}</a>
- <a href="{% url 'exerciseimage-delete' exercise.pk image.pk %}" class="ui-btn ui-btn-inline ui-btn-f">{% trans "Delete" %}</a>
- </div>
- </li>
- {% endfor %}
-</ul>
-{% endif %}
-{% endwith %}
-{% endif %} {# end check permission #}
-
-
-
-{% if perms.exercises.add_exerciseimage %}
-<p>
- <a href="{% url 'exerciseimage-add' exercise.id %}"
- title="{% trans 'Add' %}"
- data-ajax="false">
- <img src="{% static 'images/icons/add.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Add new image' %}">
- {% trans "Add new image" %}</a>
-</p>
-{% endif %}
-
-
-{% with muscles=exercise.muscles.all %}
-{% with muscles_secondary=exercise.muscles_secondary.all %}
-
-{% if muscles %}
-<h3>{% trans "Muscles" %}</h3>
-<p>
- {% trans "The diagram shows the most used muscles on this exercise" %}
-</p>
-
-
-<div>
- <div style="width:1em;height:1em;background-color:#cc0000;float:left;margin-right:0.5em;"></div>
- {% trans "Main muscles" %}
-</div>
-
-<div>
- <div style="width:1em;height:1em;background-color:#f57900;float:left;margin-right:0.5em;"></div>
- {% trans "Secondary muscles" %}
-</div>
-
-
-<div class="ui-grid-a">
- <div class="ui-block-a">
- <div id="muscle-front" class="muscle-background" style="background-image: {% for background in muscle_backgrounds_front %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};"></div>
- </div>
- <div class="ui-block-b">
- <div id="muscle-back" class="muscle-background" style="background-image: {% for background in muscle_backgrounds_back %}url({% static background %}){% if not forloop.last %},{% endif %}{% endfor %};"></div>
- </div>
-</div>
-<div class="ui-grid-a">
- <div class="ui-block-a">
- <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="ui-block-b">
- <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>
-</div>
-
-
-{% endif %}
-{% endwith %}
-{% endwith %} {# end musclelist #}
-
-{% if logs %}
-<h3>{% trans "Weight log" %}</h3>
-
-{% render_weight_log logs svg_uuid %}
-<script>
-$(document).ready(function() {
-
- // Init the data toggle for the weight log tables
- toggle_weight_log_table();
-
- // Draw the user's weight log chart
- weight_log_chart({{json|safe}},
- "{{svg_uuid}}",
- "{{reps}}",
- $('#content').width() * 0.95)
-});
-</script>
-{% endif %}
-
-{% endblock %}
-
-
-<!--
- Side bar
--->
-{% block sidebar %}
-
-<h3>{% trans "Options" %}</h3>
-<p>
- <a href="{% url 'exercise-overview' %}"
- data-role="button">
- <img src="{% static 'images/icons/list.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Back to overview' %}"
- >
- {% trans "Back to exercise overview" %}
- </a>
-</p>
-{% if perms.exercises %}
-<p>
- <a href="{% url 'exercise-edit' exercise.id %}"
- data-role="button">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Edit' %}">
- {% trans "Edit" %}
- </a>
-</p>
-<p>
- <a href="{% url 'exercise-delete' exercise.id %}"
- data-role="button">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Delete' %}">
- {% trans "Delete" %}
- </a>
-</p>
-{% endif %}
-
-
-{% license_sidebar exercise.license exercise.license_author %}
-
-{% endblock %}
diff --git a/wger/exercises/templates/mobile/muscles/overview.html b/wger/exercises/templates/mobile/muscles/overview.html
deleted file mode 100644
index 09ef26417..000000000
--- a/wger/exercises/templates/mobile/muscles/overview.html
+++ /dev/null
@@ -1,159 +0,0 @@
-{% extends "base_wide.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load cache %}
-
-<!--
- Title
--->
-{% block title %}{% trans "Muscle overview" %}{% endblock %}
-
-
-{% block header %}
-{% endblock %}
-
-
-{% block scripts %}
-<script>
-$( document ).off("pageinit").on("pageinit", function() {
- console.log('Pageinit muscle list');
-
- //Prefetch the background images
- {% for muscle in muscle_list|first %}
- prefetch_images(['/static/images/muscles/main/muscle-' + {{muscle.id}} + '.svg']);
- {% endfor %}
- prefetch_images(['/static/images/muscles/muscular_system_back.svg']);
-
-
- // Hightlight the first element
- highlight_muscle($('.muscle').first(), {%if perms.exercises%}true{%else%}false{%endif%});
-
- // Highlight on tap
- $('.muscle').on( "tap", function(e) {
- e.preventDefault();
- highlight_muscle(this, {%if perms.exercises%}true{%else%}false{%endif%});
- });
-});
-</script>
-{% endblock %}
-
-
-<!--
- Main Content
--->
-{% block content %}
-{% trans "Hover with the mouse over the muscles to show corresponding exercises." %}
-
-
-<h3 style="margin-bottom:0px;">{% trans "Muscles" %}</h3>
-<div class="ui-grid-a">
- <div class="ui-block-a">
- {# Why do we need to use |first? #}
- <div data-role="collapsible-set">
- {% regroup muscle_list|first by is_front as muscle_group %}
- {% for group in muscle_group %}
- <div data-role="collapsible" data-content-theme="c">
- {% if group.grouper %}
- <h3>{% trans "Front side" %}</h3>
- {% else %}
- <h3>{% trans "Back side" %}</h3>
- {% endif %}
- <ul data-role="listview">
- {% 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">
- <a href="#"><span itemprop="name">{{muscle.name}}</span></a>
- </li>
- {% endfor %}
- </ul>
- </div>
- {% endfor %}
- </div>
- </div>
- <div class="ui-block-b">
- <div id="muscle-system"
- class="muscle-background"
- style="background-image: url('/static/images/muscles/muscular_system_front.svg');">
- </div>
- </div>
-</div>
-
-
-
-<h3>{% trans "Exercises" %} - <span class="muscle-edit-name"></span></h3>
-{% for muscle in muscle_list|first %}
- <div id="muscle-{{muscle.id}}"
- style="display:none;"
- class="exercise-list">
- <ul data-role="listview">
- {% for exercise in muscle.exercise_set.select_related %}
- {% if exercise.language in active_languages %}
- <li class="exercise">
- <a href="{{exercise.get_absolute_url}}" data-ajax="false">{{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>
-
-<p>
-<a href="{% url 'muscle-add' %}"
- title="{% trans 'Add muscle' %}"
- data-role="button">
- <img src="{% static 'images/icons/new.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Add muscle' %}"
- title="{% trans 'Add muscle' %}">
- {% trans 'Add muscle' %}
-</a>
-</p>
-
-<p>{% blocktrans %}<strong>Important:</strong> After adding a muscle, you need
-to create a new SVG image with the contours of the muscle and place it in the
-folder <em>images/muscles</em>.{% endblocktrans %}</p>
-
-
-<div id="muscle-edit-box" style="display:none;">
-<p>
- <a href="{% url 'muscle-edit' 1 %}"
- data-role="button"
- id="muscle-edit-edit-link">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Edit muscle' %}"
- title="{% trans 'Edit muscle' %}">{% trans 'Edit muscle' %}: <span class="muscle-edit-name"></span></a>
-</p>
-<p>
- <a href="{% url 'muscle-delete' 1 %}"
- data-role="button"
- id="muscle-edit-delete-link">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Delete muscle' %}"
- title="{% trans 'Delete muscle' %}">{% trans 'Delete muscle' %}: <span class="muscle-edit-name"></span></a>
-</p>
-</div>
-{% endif %}
-
-{% endblock %}
-
-
-<!--
- Side bar
--->
-{% block sidebar %}
-{% endblock %}
diff --git a/wger/exercises/templates/muscles/overview.html b/wger/exercises/templates/muscles/overview.html
index 57db741fe..41bc7c433 100644
--- a/wger/exercises/templates/muscles/overview.html
+++ b/wger/exercises/templates/muscles/overview.html
@@ -1,7 +1,5 @@
{% extends "base_wide.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load cache %}
+{% load i18n staticfiles cache wger_extras %}
<!--
Title
@@ -22,13 +20,16 @@ $(document).ready(function() {
// Hightlight the first element
- highlight_muscle($('.muscle').first(), {%if perms.exercises%}true{%else%}false{%endif%});
+ highlight_muscle($('.muscle').first(), {% if perms.exercises %}true{% else %}false{% endif %});
// Highlight on hover
$('.muscle').hover(function(e) {
e.preventDefault();
- highlight_muscle(this, {%if perms.exercises%}true{%else%}false{%endif%});
+ highlight_muscle(this, {% if perms.exercises %}true{% else %}false{% endif %});
});
+
+ // Highlight on click
+
});
</script>
{% endblock %}
@@ -42,14 +43,14 @@ $(document).ready(function() {
{% trans "Hover with the mouse over the muscles to show corresponding exercises." %}
<div class="row">
- <div class="col-md-4">
+ <div class="col-md-4 col-xs-6">
<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 class="col-md-4">
+ <div class="col-md-4 col-xs-6">
{# Why do we need to use |first? #}
{% regroup muscle_list|first by is_front as muscle_group %}
{% for group in muscle_group %}
@@ -101,7 +102,7 @@ $(document).ready(function() {
<p>
<a href="{% url 'muscle-add' %}"
title="{% trans 'Add muscle' %}"
- class="wger-modal-dialog">
+ {% auto_link_css flavour "wger-modal-dialog" %}>
<img src="{% static 'images/icons/new.svg' %}"
width="32"
height="32"
@@ -119,7 +120,7 @@ folder <em>images/muscles</em>.{% endblocktrans %}</p>
<div id="muscle-edit-box" style="display:none;">
<p>
<a href="{% url 'muscle-edit' 1 %}"
- class="wger-modal-dialog"
+ {% auto_link_css flavour "wger-modal-dialog" %}
id="muscle-edit-edit-link">
<img src="{% static 'images/icons/edit.svg' %}"
width="32"
@@ -129,7 +130,7 @@ folder <em>images/muscles</em>.{% endblocktrans %}</p>
</p>
<p>
<a href="{% url 'muscle-delete' 1 %}"
- class="wger-modal-dialog"
+ {% auto_link_css flavour "wger-modal-dialog" %}
id="muscle-edit-delete-link">
<img src="{% static 'images/icons/trash.svg' %}"
width="32"
diff --git a/wger/exercises/tests/test_equipment.py b/wger/exercises/tests/test_equipment.py
index 389698242..b910b3264 100644
--- a/wger/exercises/tests/test_equipment.py
+++ b/wger/exercises/tests/test_equipment.py
@@ -110,13 +110,8 @@ class EquipmentCacheTestCase(WorkoutManagerTestCase):
Test the equipment overview cache is correctly generated on visit
'''
if self.is_mobile:
- self.assertFalse(cache.get(get_template_cache_name('equipment-overview-mobile', 2)))
self.assertFalse(cache.get(get_template_cache_name('exercise-overview-search', 2)))
self.client.get(reverse('equipment-overview'))
- if self.is_mobile:
- self.assertTrue(cache.get(get_template_cache_name('equipment-overview-mobile', 2)))
- else:
- self.assertTrue(cache.get(get_template_cache_name('exercise-overview-search', 2)))
else:
self.assertFalse(cache.get(get_template_cache_name('equipment-overview', 2)))
self.client.get(reverse('equipment-overview'))
@@ -129,7 +124,6 @@ class EquipmentCacheTestCase(WorkoutManagerTestCase):
'''
self.assertFalse(cache.get(get_template_cache_name('equipment-overview', 2)))
- self.assertFalse(cache.get(get_template_cache_name('equipment-overview-mobile', 2)))
self.assertFalse(cache.get(get_template_cache_name('exercise-overview-search', 2)))
self.client.get(reverse('equipment-overview'))
@@ -137,7 +131,6 @@ class EquipmentCacheTestCase(WorkoutManagerTestCase):
old_exercise = cache.get(cache_mapper.get_exercise_key(2))
old_overview = cache.get(get_template_cache_name('equipment-overview', 2))
- old_overview_mobile = cache.get(get_template_cache_name('equipment-overview-mobile', 2))
old_search = cache.get(get_template_cache_name('exercise-overview-search', 2))
exercise = Exercise.objects.get(pk=2)
@@ -147,7 +140,6 @@ class EquipmentCacheTestCase(WorkoutManagerTestCase):
exercise.save()
self.assertFalse(cache.get(get_template_cache_name('equipment-overview', 2)))
- self.assertFalse(cache.get(get_template_cache_name('equipment-overview-mobile', 2)))
self.assertFalse(cache.get(get_template_cache_name('exercise-overview-search', 2)))
self.client.get(reverse('equipment-overview'))
@@ -155,14 +147,12 @@ class EquipmentCacheTestCase(WorkoutManagerTestCase):
new_exercise = cache.get(cache_mapper.get_exercise_key(2))
new_overview = cache.get(get_template_cache_name('equipment-overview', 2))
- new_overview_mobile = cache.get(get_template_cache_name('equipment-overview-mobile', 2))
new_search = cache.get(get_template_cache_name('exercise-overview-search', 2))
self.assertNotEqual(old_exercise.name, new_exercise.name)
if not self.is_mobile:
self.assertNotEqual(old_overview, new_overview)
else:
- self.assertNotEqual(old_overview_mobile, new_overview_mobile)
self.assertNotEqual(old_search, new_search)