Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add some more mobile friendly templates

Roland Geiderbfde62603f4a
diff --git a/wger/config/templates/mobile/language/overview.html b/wger/config/templates/mobile/language/overview.html
new file mode 100644
index 000000000..4b20aa782
--- /dev/null
+++ b/wger/config/templates/mobile/language/overview.html
@@ -0,0 +1,48 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load i18n %}
+{% load staticfiles %}
+{% load wger_extras %}
+
+{% block title %}{% trans "Languages" %}{% endblock %}
+
+
+{% block content %}
+<table>
+<thead>
+ <tr>
+ <th>{% trans "Language short name" %}</th>
+ <th>{% trans "Language full name" %}</th>
+ </tr>
+</thead>
+<tbody>
+{% for language in language_list %}
+ <tr>
+ <td>{{language.short_name}}</td>
+ <td><a href="{% url 'config:language-view' language.id %}">{{language.full_name}}</a></td>
+ </tr>
+{% endfor %}
+</tbody>
+
+</table>
+{% endblock %}
+
+
+
+{% block sidebar %}
+<h3>{% trans "Options" %}</h3>
+<p>
+ <a href="{% url 'config:language-add' %}"
+ data-role="button">
+ <img src="{% static 'images/icons/folder-new.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Add' %}"
+ >
+ {% trans "Add" %}
+ </a>
+</p>
+<p>{% blocktrans %}After adding a new language here you need to add it to
+the global_settings.py file and make sure there is a corresponding flag icon
+in static/images/icons.{% endblocktrans %}</p>
+{% endblock %}
diff --git a/wger/config/templates/mobile/language/view.html b/wger/config/templates/mobile/language/view.html
new file mode 100644
index 000000000..8afde2bc4
--- /dev/null
+++ b/wger/config/templates/mobile/language/view.html
@@ -0,0 +1,102 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load i18n %}
+{% load staticfiles %}
+{% load wger_extras %}
+
+{% block title %}{{ view_language }}{% endblock %}
+
+
+{% block content %}
+<table>
+<thead>
+ <tr>
+ <th>{% trans "Language short name" %}</th>
+ <th>{% trans "Language full name" %}</th>
+ </tr>
+</thead>
+<tbody>
+ <tr>
+ <td>{{view_language.short_name}}</td>
+ <td>{{view_language.full_name}}</td>
+ </tr>
+</tbody>
+</table>
+
+
+<h3>{% trans "Configuration" %}</h3>
+<p>{% blocktrans %}Use the configuration to select in what languages the
+exercises and ingredients will be shown for the current language (for example
+the exercises should be shown in languages A, B and C; the ingredients only
+in A).{% endblocktrans %}</p>
+
+<table>
+<thead>
+ <tr>
+ <th>{% trans "Language full name" %}</th>
+ <th>{% trans "Show" %}</th>
+ </tr>
+</thead>
+<tbody>
+ {% for config in view_language.language_source.all %}
+ {% ifchanged config.get_item_display %}
+ <tr>
+ <td colspan="2" style="text-align:center; background-color:#eeeeec;">{{config.get_item_display}}</td>
+ </tr>
+ {% endifchanged %}
+ <tr>
+ <td>
+ <a href="{% url 'config:languageconfig-edit' config.id %}" data-role="button" data-inline="true" data-mini="true">
+ {{config.language_target.full_name}}
+ </a>
+ </td>
+ <td>
+ {% if config.show %}
+ <img src="{% static 'images/icons/status-on.svg' %}"
+ {% else %}
+ <img src="{% static 'images/icons/status-off.svg' %}"
+ {% endif %}
+ width="16"
+ height="16"
+ alt="">
+ </td>
+ </tr>
+ {% endfor %}
+</tbody>
+</table>
+
+
+
+
+{% endblock %}
+
+
+
+{% block sidebar %}
+<h3>{% trans "Options" %}</h3>
+
+<p>
+ <a href="{% url 'config:language-edit' view_language.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 'config:language-delete' view_language.id %}"
+ data-role="button">
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Delete' %}"
+ >
+ {% trans "Delete" %}
+ </a>
+</p>
+
+{% endblock %}
diff --git a/wger/exercises/templates/mobile/muscles/overview.html b/wger/exercises/templates/mobile/muscles/overview.html
new file mode 100644
index 000000000..327c00457
--- /dev/null
+++ b/wger/exercises/templates/mobile/muscles/overview.html
@@ -0,0 +1,188 @@
+{% extends "base_wide.html" %}
+{% load url from future %}
+{% load i18n %}
+{% load staticfiles %}
+{% load cache %}
+
+<!--
+ Title
+-->
+{% block title %}{% trans "Muscle overview" %}{% endblock %}
+
+
+{% block header %}
+<script>
+
+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+/);
+ var muscle_name = $(element).data('name');
+
+ // 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');
+
+ {% if perms.exercises %}
+ $('#muscle-edit-box').show();
+ $('.muscle-edit-name').html(muscle_name);
+ $('#muscle-edit-edit-link').attr("href", "/exercise/muscle/" + muscle_id + "/edit/");
+ $('#muscle-delete-edit-link').attr("href", "/exercise/muscle/" + muscle_id + "/delete/");
+ {% endif %}
+
+ // 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();
+}
+
+$(document).ready(function() {
+ //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());
+
+ // Highlight on hover
+ $('.muscle').hover(function(e) {
+ e.preventDefault();
+ highlight_muscle(this);
+ });
+});
+</script>
+{% endblock %}
+
+
+<!--
+ 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>
+ {% endfor %}
+ </div>
+ </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>
+ </div>
+</div>
+{% endcache %}
+
+{% 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 %}"
+ class="modal-dialog"
+ 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 %}"
+ class="modal-dialog"
+ 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/manager/templates/mobile/navigation.html b/wger/manager/templates/mobile/navigation.html
index 0217da9fd..c247ea02f 100644
--- a/wger/manager/templates/mobile/navigation.html
+++ b/wger/manager/templates/mobile/navigation.html
@@ -35,12 +35,10 @@
<li><a href="{% url 'exercise-add' %}">{% trans "Add new exercise" %}</a><li>
{% endif %}
- {% cache cache_timeout user-admin-exercises user.id language.id %}
{% if perms.exercises %}
- <li class="nav-header">{% trans "Administration" %}</li>
+ <li>{% trans "Administration" %}</li>
<li><a href="{% url 'exercise-pending' %}">{% trans "Exercises pending review" %}</a></li>
{% endif %}
- {% endcache %}
</ul>
</div>
diff --git a/wger/manager/templates/mobile/schedule/view.html b/wger/manager/templates/mobile/schedule/view.html
index 0accff287..7a03b78db 100644
--- a/wger/manager/templates/mobile/schedule/view.html
+++ b/wger/manager/templates/mobile/schedule/view.html
@@ -48,59 +48,64 @@ $(function() {
{% endblock %}
{% block content %}
+
+
+
<div id="schedule-table-container">
-<table id="schedule-table">
+<table id="schedule-table" data-role="table">
<thead>
<tr>
- <th>{% trans "Nr." %}</th>
- <th>{% trans "Actions" %}</th>
<th>{% trans "Workout" %}</th>
+ <th>{% trans "Nr." %}</th>
<th>{% trans "Weeks" %}</th>
+ <th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for step in schedule.schedulestep_set.select_related %}
<tr data-schedule-id="{{schedule.id}}" id="step-{{step.id}}">
+ <td>
+ <a href="{% url 'wger.manager.views.workout.view' step.workout.id %}"
+ data-role="button" data-mini="true" data-inline="true" >{{ step.workout }}</a>
+ {% if active_workout == step %}
+ <span class="label label-info">{% trans "active" %}</span>
+ {% endif %}
+ </td>
<td>
{{ forloop.counter }}
</td>
- <td style="min-width: 6em;">
+ <td>
+ {{ step.duration }}
+ </td>
+
+ <td >
<!-- {{ forloop.counter }} -->
<span class="editoptions">
+ <!--
<img src="{% static 'images/icons/move.svg' %}"
width="22"
height="22"
alt="{% trans 'Move me' %}"
title="{% trans 'Move me' %}"
class="dragndrop-handle">
+ -->
<a href="{% url 'step-edit' step.id %}"
title="{% trans 'Edit' %}"
- class="modal-dialog">
+ class="modal-dialog" data-role="button" data-mini="true" data-inline="true">
<img src="{% static 'images/icons/edit.svg' %}"
width="22"
height="22"
- alt="{% trans 'Edit' %}">
- </a>
+ alt="{% trans 'Edit' %}"></a>
<a href="{% url 'step-delete' step.id %}"
title="{% trans 'Delete' %}"
- class="modal-dialog">
+ class="modal-dialog" data-role="button" data-mini="true" data-inline="true">
<img src="{% static 'images/icons/trash.svg' %}"
width="22"
height="22"
- alt="{% trans 'Delete' %}">
- </a>
+ alt="{% trans 'Delete' %}"></a>
</span>
</td>
- <td>
- <a href="{% url 'wger.manager.views.workout.view' step.workout.id %}">{{ step.workout }}</a>
- {% if active_workout == step %}
- <span class="label label-info">{% trans "active" %}</span>
- {% endif %}
- </td>
- <td>
- {{ step.duration }}
- </td>
</tr>
{% empty %}
<tr>
diff --git a/wger/manager/templates/mobile/tags/pagination.html b/wger/manager/templates/mobile/tags/pagination.html
new file mode 100644
index 000000000..c593fd866
--- /dev/null
+++ b/wger/manager/templates/mobile/tags/pagination.html
@@ -0,0 +1,37 @@
+{% load i18n %}
+
+<div class="pagination" >
+
+ <div data-role="controlgroup" data-type="horizontal" style="text-align:center;">
+ {% if page.has_previous %}
+ <a href="?page={{ page.previous_page_number }}"
+ data-role="button">« {% trans "previous" %}</a>
+ {% else %}
+ <button disabled="">« {% trans "previous" %}</button>
+ {% endif %}
+
+ {% if page.has_next %}
+ <a href="?page={{ page.next_page_number }}"
+ data-role="button">{%trans "next" %} »</a>
+ {% else %}
+ <button disabled="">{%trans "next" %} »</button>
+ {% endif %}
+ </div>
+
+
+ <div data-role="controlgroup" data-type="horizontal" style="text-align:center;">
+ {% for i in page_range %}
+ {% if page.number != i %}
+ <a href="?page={{ i }}"
+ data-role="button">{{i}}</a>
+ {% else %}
+ <button disabled="">
+ {{i}}
+ </button>
+ {% endif %}
+ {% endfor %}
+ </div>
+
+</div>
+
+
diff --git a/wger/manager/templates/mobile/workout/overview.html b/wger/manager/templates/mobile/workout/overview.html
index 5a5a611ac..46c1f9cb7 100644
--- a/wger/manager/templates/mobile/workout/overview.html
+++ b/wger/manager/templates/mobile/workout/overview.html
@@ -20,7 +20,10 @@
{% for workout in workouts %}
<tr>
<td>
- <a href="{% url 'wger.manager.views.workout.view' workout.id %}">
+ <a href="{% url 'wger.manager.views.workout.view' workout.id %}"
+ data-role="button"
+ data-inline="true"
+ data-mini="true">
{% if workout.comment %}
{{ workout.comment }}
{% else %}
diff --git a/wger/nutrition/templates/mobile/units/list.html b/wger/nutrition/templates/mobile/units/list.html
new file mode 100644
index 000000000..40ecbb0d4
--- /dev/null
+++ b/wger/nutrition/templates/mobile/units/list.html
@@ -0,0 +1,76 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load i18n %}
+{% load staticfiles %}
+{% load wger_extras %}
+
+{% block title %}{% trans "Ingredient weight units" %}{% endblock %}
+
+
+{% block content %}
+
+<table>
+<thead>
+<tr>
+ <th>{% trans "Actions" %}</th>
+ <th>{% trans "Name" %}</th>
+</tr>
+</thead>
+<tbody>
+{% for unit in unit_list %}
+<tr>
+ <td class="no-hover">
+ <a href="{% url 'weight-unit-delete' unit.id %}"
+ data-role="button"
+ data-inline="true"
+ data-mini="true">
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="22"
+ height="22"
+ alt="{% trans 'Delete' %}"
+ title="{% trans 'Delete' %}">
+ </a>
+ <a href="{% url 'weight-unit-edit' unit.id %}"
+ data-role="button"
+ data-inline="true"
+ data-mini="true">
+ <img src="{% static 'images/icons/edit.svg' %}"
+ width="22"
+ height="22"
+ alt="{% trans 'Edit' %}"
+ title="{% trans 'Edit' %}">
+ </a>
+ </td>
+ <td>{{unit.name}}</td>
+</tr>
+{% empty %}
+<tr>
+ <td colspan="2">{% trans "No units found" %}</td>
+</tr>
+{% endfor %}
+</tbody>
+
+</table>
+<div style="padding-top:3em;"></div>
+{% pagination paginator page_obj %}
+{% endblock %}
+
+
+
+
+{% block sidebar %}
+{% if perms.exercises %}
+<h3>{% trans "Options" %}</h3>
+<p>
+ <a href="{% url 'weight-unit-add' %}"
+ data-role="button">
+ <img src="{% static 'images/icons/new.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Add new weight unit' %}"
+ title="{% trans 'Add new weight unit' %}">
+ {% trans "Add new weight unit" %}
+ </a>
+</p>
+{% endif %}
+{% endblock %}
diff --git a/wger/settings_global.py b/wger/settings_global.py
index e222a6783..17912d847 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -64,7 +64,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django_browserid.context_processors.browserid',
-
+
# Django mobile
'django_mobile.context_processors.flavour',
)
@@ -160,7 +160,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
-
+
# Django mobile
'django_mobile.middleware.MobileDetectionMiddleware',
'django_mobile.middleware.SetFlavourMiddleware',
diff --git a/wger/software/templates/mobile/contribute.html b/wger/software/templates/mobile/contribute.html
new file mode 100644
index 000000000..63552d6ae
--- /dev/null
+++ b/wger/software/templates/mobile/contribute.html
@@ -0,0 +1,111 @@
+{% extends "base_wide.html" %}
+{% load staticfiles %}
+{% load url from future %}
+{% load i18n %}
+
+
+{% block title %}{% trans "Contribute!" %}{% endblock %}
+
+{% block content %}
+<p>{% blocktrans %}wger Workout Manager is build by volunteers,
+the development process is open and freely accessible to anybody interested.
+If you are new to the free software world, we recommend to take a
+look <a href="http://schlitt.info/opensource/blog/0541_10_golden_rules_for_starting_with_open_source.html">this
+article</a> which summarizes they way open source projects work very well. {% endblocktrans %}</p>
+
+
+<p>{% blocktrans %}Any kind of contribution is appreciated and welcome.
+Use this opportunity and influence the direction of the
+project. {% endblocktrans %}</p>
+
+
+ <div class="box success">
+ <p style="text-align:center;"><strong>{% blocktrans %}The goal is to build an awesome
+and flexible fitness manager, along with a comprehensive and complete list of exercises and
+ingredients, all released under a free license.{% endblocktrans %}</strong></p>
+ </div>
+
+
+
+
+<div class="ym-grid linearize-level-1">
+ <div class="ym-g25 ym-gl">
+ <div class="ym-gbox-left">
+ <h3>{% trans "Use the site" %}</h3>
+ </div>
+ </div>
+ <div class="ym-g66 ym-gl">
+ <div class="ym-gbox-left">
+ <p>{% blocktrans %}Simply use the site and tell your friends
+how useful it is! ;) . When you find something that you specially liked,
+could need some improvements or just doesn't work, tell us! This might not sound
+like much, but is incredibly important!{% endblocktrans %}</p>
+<a data-role="button" href="{% url 'contact' %}">{% trans "Get in touch" %} »</a>
+
+ </div>
+
+ </div>
+</div>
+
+
+<div class="ym-grid linearize-level-1">
+ <div class="ym-g25 ym-gl">
+ <div class="ym-gbox-left">
+ <h3>{% trans "Submit exercises" %}</h3>
+ </div>
+ </div>
+ <div class="ym-g66 ym-gl">
+ <div class="ym-gbox-left">
+ <p>{% blocktrans %}Submit those cool exercises that you absolutely
+love and do every week but are not in the list yet. If you think some description
+is too short or some other detail is missing or could be improved, tell!{% endblocktrans %}</p>
+ {% if user.is_authenticated and not user.get_profile.is_temporary %}
+ <a data-role="button" href="{% url 'exercise-add' %}">{% trans "Add exercise" %} »</a>
+ {% else %}
+ <a data-role="button" class="ui-disabled" href="#">{% trans "Only registered users can do this" %} »</a>
+ {% endif %}
+ </div>
+ </div>
+</div>
+
+
+<div class="ym-grid linearize-level-1">
+ <div class="ym-g25 ym-gl">
+ <div class="ym-gbox-left">
+ <h3>{% trans "Translate" %}</h3>
+ </div>
+ </div>
+ <div class="ym-g66 ym-gl">
+ <div class="ym-gbox-left">
+ <p>{% blocktrans %}Do you want to use wger in your own language?
+Do you think the current translation could be improved?
+The translations are easily managed and edited online, if you are interested,
+go to the transifex site, request access and we will set everything
+up. {% endblocktrans %}</p>
+
+ <a data-role="button"
+ href="https://www.transifex.com/projects/p/wger-workout-manager/">{% trans "Translate with Transifex" %} »</a>
+ </div>
+ </div>
+</div>
+
+<div class="ym-grid linearize-level-1">
+ <div class="ym-g25 ym-gl">
+ <div class="ym-gbox-left">
+ <h3>{% trans "Code" %}</h3>
+ </div>
+ </div>
+ <div class="ym-g66 ym-gl">
+ <div class="ym-gbox-left">
+ <p>{% blocktrans %}Obviously, you are highly encouraged to clone the
+repo and start hacking! Once you are ready, send a pull request and we
+will show the world. Take a look at the developer guide for more details
+on this.{% endblocktrans %}</p>
+
+ <a data-role="button" href="{% url 'software:code' %}">{% trans "Get the code" %} »</a>
+ </div>
+ </div>
+</div>
+
+
+{% endblock %}