Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Improve the dashboard page for the mobile version

Roland Geider8bbf89119934
diff --git a/wger/manager/templates/mobile/index-mobile.html b/wger/manager/templates/mobile/index-mobile.html
deleted file mode 100644
index f97deeaf1..000000000
--- a/wger/manager/templates/mobile/index-mobile.html
+++ /dev/null
@@ -1,95 +0,0 @@
-{% extends "base.html" %}
-{% load url from future %}
-{% load i18n %}
-{% load staticfiles %}
-
-{% block title %}{% endblock %}
-
-
-{% block content %}
-<!--
-<a href="{% url 'wger.manager.views.user.preferences' %}" data-role="button">
- <img src="{% static 'images/icons/play.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Settings' %}"
- title="{% trans 'Settings' %}">
- <br>
- {% trans "Start current workout" %}
-</a>
--->
-<div class="ui-grid-a">
- <div class="ui-block-a">
- <a href="{% url 'workout-overview' %}" data-role="button">
- <img src="{% static 'images/icons/list.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Workouts' %}"
- title="{% trans 'Workouts' %}">
- <br>
- {% trans "Workouts" %}
- </a>
- </div>
- <div class="ui-block-b">
- <a href="{% url 'workout-calendar' %}" data-role="button" data-ajax="false">
- <img src="{% static 'images/icons/calendar.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Calendar' %}"
- title="{% trans 'Calendar' %}">
- <br>
- {% trans "Calendar" %}
- </a>
- </div>
- <div class="ui-block-a">
- <a href="{% url 'nutrition-overview' %}" data-role="button">
- <img src="{% static 'images/icons/list.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Nutrition' %}"
- title="{% trans 'Nutrition' %}">
- <br>
- {% trans "Nutrition" %}
- </a>
- </div>
- <div class="ui-block-b">
-
- <a href="{% url 'wger.weight.views.overview' %}" data-role="button" data-ajax="false">
- <img src="{% static 'images/icons/statistics.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Weight overview' %}"
- title="{% trans 'Weight overview' %}">
- <br>
- {% trans "Weight overview" %}
- </a>
- </div>
- <div class="ui-block-a">
- <a href="{% url 'wger.manager.views.user.preferences' %}" data-role="button">
- <img src="{% static 'images/icons/preferences.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Settings' %}"
- title="{% trans 'Settings' %}">
- <br>
- {% trans "Settings" %}
- </a>
- </div>
- <div class="ui-block-b">
- <a href="{% url 'contact' %}" data-role="button">
- <img src="{% static 'images/icons/mail.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Contact' %}"
- title="{% trans 'Contact' %}">
- <br>
- {% trans "Contact" %}
- </a>
- </div>
-</div>
-{% endblock %}
-
-
-
-{% block sidebar %}
-{% endblock %}
diff --git a/wger/manager/templates/mobile/index.html b/wger/manager/templates/mobile/index.html
index 881aa1883..e43361f3e 100644
--- a/wger/manager/templates/mobile/index.html
+++ b/wger/manager/templates/mobile/index.html
@@ -7,124 +7,194 @@
{% block content %}
-<h3>{% trans "Workout"%}</h3>
-{% if current_workout %}
-<p>
-<a href="{% url 'wger.manager.views.workout.view' current_workout.id %}"
- data-role="button"
- data-mini="true"
- data-ajax="false">
- {{ current_workout }}
-</a>
-</p>
- – {{ current_workout.creation_date }}
-
-<ul>
- {% for day, exercise, is_workout in weekdays %}
- <li>
- {% if not is_workout %}<span class="dimmed">{% endif%}
- {{ day }}:
-
- {{ exercise }}
- {% if not is_workout %}</span>{% endif%}
-
- </li>
- {% endfor %}
-</ul>
-
-{% if schedule %}
-<p>
- → {% trans "This workout is part of a schedule:" %}
- <a href="{{schedule.get_absolute_url}}">{{schedule.name}}</a>
-</p>
-{% endif %}
-
-{% else %}
- <p>
- <a href="{% url 'wger.manager.views.workout.add' %}" data-role="button">
- {% trans "No workouts found." %}<br>{% trans "Add one now." %}
- </a>
- </p>
+<div data-role="popup"
+ id="current-workout"
+ data-overlay-theme="a"
+ class="ui-content">
+ <div>
+ {% if current_workout %}
+ <h3>{% trans "Current workout" %}</h3>
+ <ul data-role="listview" data-inset="false" style="margin-bottom:1em;" data-theme="b">
+ <li>
+ <a href="{% url 'wger.manager.views.workout.view' current_workout.id %}"
+
+ data-mini="true"
+ data-ajax="false">
+ {{ current_workout }}
+ </a>
+ </li>
+ </ul>
+
+ <ul>
+ {% for day, exercises, is_workout in weekdays %}
+ <li>
+ <span {% if not is_workout %}class="dimmed"{% endif%}>
+ {{ day }}: {{ exercises }}
+ </span>
+ </li>
+ {% endfor %}
+ </ul>
+ {% if schedule %}
+ <p>
+ → {% trans "This workout is part of a schedule:" %}
+ <a href="{{schedule.get_absolute_url}}">{{schedule.name}}</a>
+ </p>
{% endif %}
+ {% endif %}
+ </div>
+</div>
+
+
+<div data-role="popup"
+ id="current-nutrition-plan"
+ data-overlay-theme="a"
+ class="ui-content">
+ <div>
+ {% if plan %}
+ <h4>{% trans "Current nutrition plan" %}</h4>
+ <ul data-role="listview" data-inset="false" style="margin-bottom:1em;" data-theme="b">
+ <li>
+ <a href="{% url 'wger.nutrition.views.plan.view' plan.id %}"
+ data-mini="true"
+ data-ajax="false">
+ {{ plan }}
+ </a>
+ </li>
+ </ul>
+
+ <ul>
+ <li>
+ {% trans "Energy" %}: {{nutritional_info.energy|floatformat}} kcal
+ </li>
+ <li>
+ {% trans "Protein" %}: {{nutritional_info.protein|floatformat}} g
+ </li>
+ <li>
+ {% trans "Carbohydrates" %}: {{nutritional_info.carbohydrates|floatformat}} g
+ </li>
+ <li>
+ {% trans "Fat" %}: {{nutritional_info.fat|floatformat}} g
+ </li>
+ </ul>
+
+ {% if weight %}
+ <p>
+ {% trans "Your current weight is: "%} <strong>{{weight.weight|floatformat}} kg.</strong>
+ </p>
+ {% endif %}
-<h3>{% trans "Nutrition plan"%}</h3>
+ {% endif %}
+ </div>
+</div>
-{% if plan %}
- <p>
- <a href="{% url 'wger.nutrition.views.plan.view' plan.id %}"
- data-role="button"
- data-mini="true">
- {% if plan.description %}
- {{ plan.description }}
+<!--
+<a href="{% url 'wger.manager.views.user.preferences' %}" data-role="button">
+ <img src="{% static 'images/icons/play.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Settings' %}"
+ title="{% trans 'Settings' %}">
+ <br>
+ {% trans "Start current workout" %}
+</a>
+-->
+<div class="ui-grid-a">
+ <div class="ui-block-a">
+ {% if current_workout %}
+ <a href="#current-workout"
+ data-role="button"
+ data-rel="popup"
+ data-position-to="window">
+ <img src="{% static 'images/icons/list.svg' %}"
+ width="32"
+ height="32"
+ alt="{{current_workout}}"
+ title="{{current_workout}}">
+ <br>
+ {{current_workout}}
+ </a>
{% else %}
- {% trans "Nutrition plan" %}
+ <a href="{% url 'workout-add' %}" data-role="button">
+ <img src="{% static 'images/icons/add.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Workout' %}"
+ title="{% trans 'Workout' %}">
+ <br>
+ {% trans "Workout" %}
+ </a>
{% endif %}
- </a>
- </p>
- – {{ plan.creation_date }}
-
- <ul>
- <li>
- {% trans "Energy" %}: {{nutritional_info.energy|floatformat}} kcal
- </li>
- <li>
- {% trans "Protein" %}: {{nutritional_info.protein|floatformat}} g
- </li>
- <li>
- {% trans "Carbohydrates" %}: {{nutritional_info.carbohydrates|floatformat}} g
- </li>
- <li>
- {% trans "Fat" %}: {{nutritional_info.fat|floatformat}} g
- </li>
- </ul>
-
-{% else %}
- <p>
- <a href="{% url 'wger.nutrition.views.plan.add' %}" data-role="button">
- {% trans "No nutrition plans." %}<br>{% trans "Add one now." %}
+ </div>
+ <div class="ui-block-b">
+ <a href="{% url 'workout-calendar' %}" data-role="button" data-ajax="false">
+ <img src="{% static 'images/icons/calendar.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Calendar' %}"
+ title="{% trans 'Calendar' %}">
+ <br>
+ {% trans "Calendar" %}
</a>
- </p>
-{% endif %}
-{% if weight %}
-<p>
- {% trans "Your current weight is: "%} <strong>{{weight.weight|floatformat}} kg.</strong>
-</p>
-{% endif %}
-
-{% endblock %}
-
-
-
-{% block sidebar %}
-<h3>{% trans "Info" %}</h3>
-<p>{% blocktrans %}The current workout is selected from your active schedule
-or, if you don't have one, simply by date.{% endblocktrans %}</p>
-
-<p>{% trans "After adding a workout or a nutritional plan, you can edit them to set a goal." %}
-</p>
-
-<h3>{% trans "Options" %}</h3>
-<a href="{% url 'wger.manager.views.workout.add' %}" data-role="button">
-<img src="{% static 'images/icons/new.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Add workout' %}"
- title="{% trans 'Add workout' %}">
-{% trans "Add workout" %}</a>
-
-<a href="{% url 'wger.nutrition.views.plan.add' %}" data-role="button">
-<img src="{% static 'images/icons/new.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Add nutrition plan' %}"
- title="{% trans 'Add nutrition plan' %}">
- {% trans "Add nutrition plan" %}</a>
-
-<a href="{% url 'wger.manager.views.user.preferences' %}" data-role="button">
-<img src="{% static 'images/icons/preferences.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'My preferences' %}"
- title="{% trans 'My preferences' %}">
-{% trans "My preferences" %}</a>
+ </div>
+ <div class="ui-block-a">
+ {% if plan %}
+ <a href="#current-nutrition-plan"
+ data-role="button"
+ data-rel="popup"
+ data-position-to="window">
+ <img src="{% static 'images/icons/list.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Nutrition' %}"
+ title="{% trans 'Nutrition' %}">
+ <br>
+ {{plan}}
+ </a>
+ {% else %}
+ <a href="{% url 'nutrition-add' %}" data-role="button">
+ <img src="{% static 'images/icons/add.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Workouts' %}"
+ title="{% trans 'Workouts' %}">
+ <br>
+ {% trans "Nutrition plan" %}
+ </a>
+ {% endif %}
+ </div>
+ <div class="ui-block-b">
+
+ <a href="{% url 'wger.weight.views.overview' %}" data-role="button" data-ajax="false">
+ <img src="{% static 'images/icons/statistics.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Weight overview' %}"
+ title="{% trans 'Weight overview' %}">
+ <br>
+ {% trans "Weight overview" %}
+ </a>
+ </div>
+ <div class="ui-block-a">
+ <a href="{% url 'wger.manager.views.user.preferences' %}" data-role="button">
+ <img src="{% static 'images/icons/preferences.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Preferences' %}"
+ title="{% trans 'Preferences' %}">
+ <br>
+ {% trans "Preferences" %}
+ </a>
+ </div>
+ <div class="ui-block-b">
+ <a href="{% url 'contact' %}" data-role="button">
+ <img src="{% static 'images/icons/mail.svg' %}"
+ width="32"
+ height="32"
+ alt="{% trans 'Get in touch' %}"
+ title="{% trans 'Get in touch' %}">
+ <br>
+ {% trans "Get in touch" %}
+ </a>
+ </div>
+</div>
{% endblock %}
diff --git a/wger/manager/templates/mobile/navigation.html b/wger/manager/templates/mobile/navigation.html
index c022f418e..a0c04853b 100644
--- a/wger/manager/templates/mobile/navigation.html
+++ b/wger/manager/templates/mobile/navigation.html
@@ -16,25 +16,29 @@
{# #}
{# Close button for panel #}
{# #}
-<ul data-role="listview" data-theme="a">
- <li data-icon="delete">
+<ul data-role="listview">
+ <li data-icon="delete" data-theme="a">
<a href="#" data-rel="close">{% trans "Close" %}</a>
</li>
+ <li data-theme="d" style="margin-top:1.5em;">
+ <a href="{% url 'index' %}">{% trans "Dashboard" %}</a>
+ </li>
</ul>
-<div data-role="collapsible-set" data-inset="false" style="margin-top:1.5em;">
+<div data-role="collapsible-set" data-inset="false" style="margin-top:1em;">
{# #}
{# User tab #}
{# #}
+ <!--
<div data-role="collapsible" data-content-theme="c">
<h3>{% trans "Dashboard" %}</h3>
<ul data-role="listview">
- <li><a href="{% url 'index-mobile' %}">{% trans "Main Menu" %}</a></li>
<li><a href="{% url 'index' %}">{% trans "Dashboard" %}</a></li>
</ul>
</div>
+ -->
{# #}
diff --git a/wger/manager/templates/navigation.html b/wger/manager/templates/navigation.html
index 3a0472f00..48a2fa511 100644
--- a/wger/manager/templates/navigation.html
+++ b/wger/manager/templates/navigation.html
@@ -27,6 +27,9 @@
data-toggle="dropdown">{% trans "Workouts" %} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{% url 'wger.manager.views.workout.overview' %}" rel="nofollow">{% trans "Workouts" %}</a></li>
+ {% if user.is_authenticated %}
+ <li><a href="{% url 'workout-calendar' %}" rel="nofollow">{% trans "Current workout" %}</a></li>
+ {% endif %}
<li><a href="{% url 'workout-calendar' %}" rel="nofollow">{% trans "Calendar" %}</a></li>
<li><a href="{% url 'schedule-overview' %}" rel="nofollow">{% trans "Workouts schedules" %}</a></li>
</ul>
diff --git a/wger/manager/urls.py b/wger/manager/urls.py
index a2cad8370..02772db1a 100644
--- a/wger/manager/urls.py
+++ b/wger/manager/urls.py
@@ -25,9 +25,6 @@ urlpatterns = patterns('wger.manager.views',
url(r'^$',
'misc.index',
name='index'),
- url(r'^dashboard-mobile$',
- TemplateView.as_view(template_name="index-mobile.html"),
- name='index-mobile'),
# The dashboard
url(r'^dashboard$',
diff --git a/wger/nutrition/urls.py b/wger/nutrition/urls.py
index aa860741c..8541cedd9 100644
--- a/wger/nutrition/urls.py
+++ b/wger/nutrition/urls.py
@@ -11,9 +11,11 @@ from wger.nutrition.views import unit_ingredient
urlpatterns = patterns('wger.nutrition.views',
# Plans
url(r'^overview/$',
- 'plan.overview',
+ plan.overview,
name='nutrition-overview'),
- url(r'^add/$', 'plan.add'),
+ url(r'^add/$',
+ plan.add,
+ name='nutrition-add'),
url(r'^(?P<id>\d+)/view/$',
'plan.view',
name='nutrition-view'),