Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Improve workout detail view by using list views instead of tables

Roland Geider417bc9514ba7
diff --git a/wger/manager/templates/mobile/tags/render_day.html b/wger/manager/templates/mobile/tags/render_day.html
index df32e9f98..62f0929e0 100644
--- a/wger/manager/templates/mobile/tags/render_day.html
+++ b/wger/manager/templates/mobile/tags/render_day.html
@@ -3,199 +3,168 @@
{% load manager_extras %}
-<table class="bordertable workout-table" id="table-day-{{ day.id }}" style="width:100%;">
-<thead>
- <tr id="day-{{ day.id }}">
- <th colspan="2">
-
- <h4><a href="#editoptions-day-{{ day.id }}"
- class="ui-icon-nodisc ui-icon-alt"
- data-rel="popup"
- data-role="button"
- data-inline="true"
- data-transition="slideup"
- data-icon="gear"
- data-theme="d"
- data-iconpos="notext"
- data-mini="true"
- data-iconshadow="false"></a>{{day.description}}</h4>
-
-
- {% for day_of_week in day.day.select_related %}
- {% trans day_of_week.day_of_week %}
- {% if not forloop.last %}, {% endif %}
- <!--{% if forloop.last %}–{% endif %}-->
- {% endfor %}
-
-
- <div data-role="popup" id="editoptions-day-{{ day.id }}" data-overlay-theme="a">
- <div>
- <h3>{{day.description}}</h3>
- <ul data-role="listview">
- <li>
- <a href="{% url 'wger.manager.views.day.delete' workout.id day.id %}"
- title="{% trans 'Delete' %}">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Delete' %}"
- class="ui-li-icon ui-corner-none">{% trans "Delete" %}</a>
- </li>
- <li>
- <a href="{% url 'day-edit' day.id %}"
- title="{% trans 'Edit' %}"
- class="modal-dialog">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Edit' %}"
- class="ui-li-icon ui-corner-none">
- {% trans 'Edit' %}
- </a>
- </li>
- <li>
- <a href="{% url 'day-log' day.id %}"
- title="{% trans 'Add weight log to this day' %}">
- <img src="{% static 'images/icons/statistics.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Add weight log to this day' %}"
- class="ui-li-icon ui-corner-none">
- {% trans 'Add weight log to this day' %}
- </a>
- </li>
- </ul>
- </div>
+<div data-role="popup" id="editoptions-day-{{ day.id }}" data-overlay-theme="a">
+ <div>
+ <h3>{{day.description}}</h3>
+ <ul data-role="listview">
+ <li>
+ <a href="{% url 'wger.manager.views.day.delete' workout.id day.id %}"
+ title="{% trans 'Delete' %}">
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Delete' %}"
+ class="ui-li-icon ui-corner-none">{% trans "Delete" %}</a>
+ </li>
+ <li>
+ <a href="{% url 'day-edit' day.id %}"
+ title="{% trans 'Edit' %}"
+ class="modal-dialog">
+ <img src="{% static 'images/icons/edit.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Edit' %}"
+ class="ui-li-icon ui-corner-none">
+ {% trans 'Edit' %}
+ </a>
+ </li>
+ <li>
+ <a href="{% url 'day-log' day.id %}"
+ title="{% trans 'Add weight log to this day' %}">
+ <img src="{% static 'images/icons/statistics.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Add weight log to this day' %}"
+ class="ui-li-icon ui-corner-none">
+ {% trans 'Add weight log to this day' %}
+ </a>
+ </li>
+ </ul>
+ </div>
+</div>
+
+
+<ul data-role="listview" id="table-day-{{ day.id }}" style="margin-top: 3em;">
+ <li data-role="list-divider">
+ <h4><a href="#editoptions-day-{{ day.id }}" data-rel="popup">{{day.description}}</a></h4>
+ {% for day_of_week in day.day.select_related %}
+ {% trans day_of_week.day_of_week %}
+ {% if not forloop.last %}, {% endif %}
+ {% endfor %}
+ </li>
+
+ {% for set in day.set_set.select_related %}
+
+ <li id="set-{{ set.id }}">
+ <div data-role="popup" id="editoptions-set-{{ set.id }}" data-overlay-theme="a">
+ <div>
+ <h3>{% trans "Options" %}</h3>
+ <ul data-role="listview">
+ <li>
+ <a href="{% url 'wger.manager.views.set.delete' set.id %}"
+ title="{% trans 'Delete' %}">
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Delete' %}"
+ class="ui-li-icon ui-corner-none">
+ {% trans "Delete" %}
+ </a>
+ </li>
+ <li>
+ <a href="{% url 'wger.manager.views.set.edit' set.id %}"
+ title="{% trans 'Delete' %}">
+ <img src="{% static 'images/icons/edit.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Edit' %}"
+ class="ui-li-icon ui-corner-none">
+ {% trans "Edit" %}
+ </a>
+ </li>
+ </ul>
</div>
- </th>
- </tr>
- </thead>
- <tbody>
- {% for set in day.set_set.select_related %}
- <tr id="set-{{ set.id }}">
- <td class="ym-g10"><!--{{ forloop.counter }}-->
+ </div>
+
+ <div class="exercise-list">
+ {% for exercise in set.exercises.select_related %}
+ <div id="exercise-{{ exercise.id }}" class="ajax-set-edit-target">
<a href="#editoptions-set-{{ set.id }}"
- class="ui-icon-nodisc ui-icon-alt"
- data-rel="popup"
- data-role="button"
- data-inline="true"
- data-transition="slideup"
- data-icon="gear"
- data-theme="c"
- data-iconpos="notext"
- data-mini="true"
- data-iconshadow="false"></a>
-
- <div data-role="popup" id="editoptions-set-{{ set.id }}" data-overlay-theme="a">
- <div>
- <h3>{% trans "Options" %}</h3>
- <ul data-role="listview">
- <li>
- <a href="{% url 'wger.manager.views.set.delete' set.id %}"
- title="{% trans 'Delete' %}">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Delete' %}"
- class="ui-li-icon ui-corner-none">
- {% trans "Delete" %}
- </a>
- </li>
- <li>
- <a href="{% url 'wger.manager.views.set.edit' set.id %}"
- title="{% trans 'Delete' %}">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Edit' %}"
- class="ui-li-icon ui-corner-none">
- {% trans "Edit" %}
- </a>
- </li>
+ data-rel="popup">
+ {{ exercise.name }}</a>
+<!--
+ <a href="{{ exercise.get_absolute_url }}">{{ exercise.name }}</a>:
+-->
+
+ {% comment %}
+ If there are more than 1 settings, don't output the repetitions
+ e.g. "4 x 8 8 10 10" is shown only as "8 8 10 10", after all
+ those 4 sets are not done four times! But "3 x 12" is stil shown
+ like that.
+ {% endcomment %}
+ {% if exercise|get_current_settings:set.id|length == 1 %}
+ {{ set.sets }} ×
+ {% endif %}
+
+ {% comment %}
+ get_current_settings only does a exercise.setting_set.filter(set_id=set_id)
+ {% endcomment %}
+
+ <span class="settings-list">
+ {% for setting in exercise|get_current_settings:set.id %}
+ <span id="setting-{{setting.id}}">
+
+
+ {% if setting.reps == 99 %}
+ ∞
+ {%else%}
+ {{setting.reps}}
+ {%endif%}
+ {% if not forloop.last %} – {% endif %}
+ </span>
+ {% empty %}
+ <a href="{% url 'set-edit' set.id %}"
+ class="modal-dialog"
+ data-role="button">
+ {% trans "This exercise has no repetitions." %}
+ {% trans "Edit them now."%}
+ </a>
+ {% endfor %} <!--for setting in exercise-->
+ </span>
+
+
+ <div class="dimmed">
+ <ul>
+ {% for comment in exercise.exercisecomment_set.all %}
+ <li>{{comment}}</li>
+ {% endfor %}
</ul>
</div>
- </div>
- <!--<img src="{% static 'images/icons/move.svg' %}"
- width="22"
- height="22"
- alt="{% trans 'Move me' %}"
- title="{% trans 'Move me' %}"
- class="dragndrop-handle">-->
- </span>
- </td>
- <td>
- <div class="exercise-list">
- {% for exercise in set.exercises.select_related %}
- <div id="exercise-{{ exercise.id }}" class="ajax-set-edit-target">
- <a href="{{ exercise.get_absolute_url }}">{{ exercise.name }}</a>:
-
- {% comment %}
- If there are more than 1 settings, don't output the repetitions
- e.g. "4 x 8 8 10 10" is shown only as "8 8 10 10", after all
- those 4 sets are not done four times! But "3 x 12" is stil shown
- like that.
- {% endcomment %}
- {% if exercise|get_current_settings:set.id|length == 1 %}
- {{ set.sets }} ×
- {% endif %}
-
- {% comment %}
- get_current_settings only does a exercise.setting_set.filter(set_id=set_id)
- {% endcomment %}
-
- <span class="settings-list">
- {% for setting in exercise|get_current_settings:set.id %}
- <span id="setting-{{setting.id}}">
-
-
- {% if setting.reps == 99 %}
- ∞
- {%else%}
- {{setting.reps}}
- {%endif%}
- {% if not forloop.last %} – {% endif %}
- </span>
- {% empty %}
- <a href="{% url 'set-edit' set.id %}"
- class="modal-dialog"
- data-role="button">
- {% trans "This exercise has no repetitions." %}
- {% trans "Edit them now."%}
- </a>
- {% endfor %} <!--for setting in exercise-->
- </span>
-
-
- <div class="exercise-comments dimmed">
- <ul>
- {% for comment in exercise.exercisecomment_set.all %}
- <li>{{comment}}</li>
- {% endfor %}
- </ul>
- </div>
-
-
-
- </div>
- {% endfor %} <!--for exercise in set-->
- </div>
- {% empty %}
- <tr>
- <td colspan="2">
- <a href="{% url 'set-add' day.id %}"
- class="modal-dialog"
- data-role="button">
- {% trans "No exercises selected for this day." %}<br>
- {% trans "Add one now." %}
- </a>
- {% endfor %} <!--for set in day-->
- </td>
- </tr>
- </tbody>
-</table>
-<a href="{% url 'set-add' day.id %}"
- data-role="button"
- data-mini="true">{% trans "Add exercises to this workout day" %}</a>
+
+
+ </div>
+ {% endfor %} <!--for exercise in set-->
+ </div>
+ </li>
+ {% empty %}
+ <li>
+ <a href="{% url 'set-add' day.id %}"
+ data-ajax="false">
+ {% trans "No exercises selected for this day." %}<br>
+ {% trans "Add one now." %}
+ </a>
+ </li>
+ {% endfor %} <!--for set in day-->
+
+ {% if day.set_set.select_related %}
+ <li>
+ <a href="{% url 'set-add' day.id %}"
+ data-ajax="false">{% trans "Add exercises to this workout day" %}</a>
+ </li>
+ {% endif %}
+
+</ul>
+
diff --git a/wger/manager/templates/mobile/workout/view.html b/wger/manager/templates/mobile/workout/view.html
index e974bad14..4ba6a6b61 100644
--- a/wger/manager/templates/mobile/workout/view.html
+++ b/wger/manager/templates/mobile/workout/view.html
@@ -13,7 +13,6 @@
{% if workout.comment %}
<p>
- <strong>{% trans "Goal" %}:</strong>
<span class="dimmed">{{workout.comment}}</span>
</p>
{% endif %}
@@ -32,7 +31,7 @@
{% endfor %}
-<p>
+<p style="margin-top:2em;">
<a href="{% url 'day-add' workout.id %}"
data-role="button"
data-mini="true">