Self hosted FLOSS fitness/workout, nutrition and weight tracker
Use listviews instead of tables for overviews and other lists
Roland Geider4a847c57c9c1
diff --git a/wger/manager/templates/mobile/schedule/overview.html b/wger/manager/templates/mobile/schedule/overview.htmlindex 240451fa5..3394f6a84 100644--- a/wger/manager/templates/mobile/schedule/overview.html+++ b/wger/manager/templates/mobile/schedule/overview.html@@ -18,41 +18,20 @@ function custom_modal_init(){% endblock %}{% block content %}-<table id="workout-table" data-role="table">- <thead>- <tr>- <th>{% trans "Description" %}</th>- <th>{% trans "Date" %}</th>- </tr>- </thead>- <tbody>+<ul data-role="listview" data-inset="false">+{% for schedule in schedules %}- <tr>- <td>- <a href="{% url 'schedule-view' schedule.id %}">- {{ schedule.name }}- </a>+ <li>+ <a href="{% url 'schedule-view' schedule.id %}">+ <h3>{{ schedule.name }}</h3>+ <p>{{ schedule.start_date }}</p>{% if schedule.is_active %}- <span class="label label-info">{% trans "active" %}</span>+ <p class="ui-li-aside"><em>{% trans "active" %}</em></p>{% endif %}- </td>- <td>- {{ schedule.start_date }}- </td>- </tr>- {% empty %}- <tr>- <td colspan="3">- <a href="{% url 'schedule-add' %}" data-role="button">- {% trans "No schedules found." %}<br>- {% trans "Add one now." %}</a>- </td>- </tr>+ </li>{% endfor %}- </tbody>-</table>-+</ul>{% endblock %}diff --git a/wger/manager/templates/mobile/schedule/view.html b/wger/manager/templates/mobile/schedule/view.htmlindex 897ce6176..67057e285 100644--- a/wger/manager/templates/mobile/schedule/view.html+++ b/wger/manager/templates/mobile/schedule/view.html@@ -48,86 +48,69 @@ $(function() {{% endblock %}{% block content %}+{% for step in schedule.schedulestep_set.select_related %}+<div data-role="popup"+ id="step-{{step.id}}"+ data-theme="d"+ data-overlay-theme="b"+ class="ui-content"+ >+ <h3>{%trans "Options" %}</h3>+ <a href="{% url 'step-edit' step.id %}"+ title="{% trans 'Edit' %}"+ class="modal-dialog"+ data-role="button">+ <img src="{% static 'images/icons/edit.svg' %}"+ width="22"+ height="22"+ alt="{% trans 'Edit' %}">{% trans 'Edit' %}</a>+ <a href="{% url 'step-delete' step.id %}"+ title="{% trans 'Delete' %}"+ class="modal-dialog"+ data-role="button">+ <img src="{% static 'images/icons/trash.svg' %}"+ width="22"+ height="22"+ alt="{% trans 'Delete' %}">{% trans 'Delete' %}</a>+</div>+{% endfor %}+<ul data-role="listview" data-inset="false" data-split-icon="gear" data-split-theme="d">+{% for step in schedule.schedulestep_set.select_related %}+ <li>+ <a href="{% url 'wger.manager.views.workout.view' step.workout.id %}">+ <h3>{{ forloop.counter }} - {{ step.workout }}</h3>+ <p>{{ workout.creation_date }}</p>+ <p>{% trans "Weeks" %}: {{ step.duration }}</p>-<div id="schedule-table-container">-<table id="schedule-table" data-role="table">- <thead>- <tr>- <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>+ <p class="ui-li-aside"><em>{% trans "active" %}</em></p>{% endif %}- </td>- <td>- {{ forloop.counter }}- </td>- <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" data-role="button" data-mini="true" data-inline="true">- <img src="{% static 'images/icons/edit.svg' %}"- width="22"- height="22"- alt="{% trans 'Edit' %}"></a>- <a href="{% url 'step-delete' step.id %}"- title="{% trans 'Delete' %}"- 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>- </span>- </td>- </tr>- {% empty %}- <tr>- <td colspan="4">- <a href="{% url 'step-add' schedule.id %}" data-role="button">- {% trans "No workouts found." %} {% trans "Add one now." %}- </a>- </td>- </tr>- {% endfor %}- {% if schedule.is_loop %}- <tr>- <td colspan="4">- <div class="alert alert-info" style="margin-bottom:0px;">- {% trans "This schedule is a loop and will go through the workouts above till you deactivate it" %}- </div>- </td>- </tr>+ </a>++ <a href="#step-{{step.id}}"+ data-rel="popup"+ data-position-to="window"+ data-transition="pop"></a>+ </a>+ </li>+{% empty %}+ <li>+ <a href="{% url 'step-add' schedule.id %}">+ {% trans "No workouts found." %}<br>{% trans "Add one now." %}+ </a>+ </li>+{% endfor %}+{% if schedule.is_loop %}+ <li>+ {% trans "This schedule is a loop and will go through the workouts above till you deactivate it" %}+ </li>{% endif %}- </tbody>-</table>-</div>+</ul>+++<p><a href="{% url 'step-add' schedule.id %}"diff --git a/wger/manager/templates/mobile/tags/render_day.html b/wger/manager/templates/mobile/tags/render_day.htmlindex 668d2a59c..8a7d483b6 100644--- a/wger/manager/templates/mobile/tags/render_day.html+++ b/wger/manager/templates/mobile/tags/render_day.html@@ -4,100 +4,104 @@-<div data-role="popup" id="editoptions-day-{{ day.id }}" data-overlay-theme="a">+<div data-role="popup"+ id="editoptions-day-{{ day.id }}"+ data-theme="d"+ data-overlay-theme="a"+ class="ui-content"><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>+ <a href="{% url 'day-log' day.id %}"+ title="{% trans 'Add weight log to this day' %}"+ data-role="button">+ <img src="{% static 'images/icons/statistics.svg' %}"+ width="22"+ height="22"+ alt="{% trans 'Add weight log to this day' %}">+ {% trans 'Add weight log to this day' %}+ </a>+ <a href="{% url 'day-edit' day.id %}"+ title="{% trans 'Edit' %}"+ data-role="button">+ <img src="{% static 'images/icons/edit.svg' %}"+ width="22"+ height="22"+ alt="{% trans 'Edit' %}">+ {% trans 'Edit' %}+ </a>+ <a href="{% url 'wger.manager.views.day.delete' workout.id day.id %}"+ title="{% trans 'Delete' %}"+ data-role="button">+ <img src="{% static 'images/icons/trash.svg' %}"+ width="22"+ height="22"+ alt="{% trans 'Delete' %}">+ {% trans "Delete" %}+ </a></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 set in day.set_set.select_related %}+<div data-role="popup"+ id="editoptions-set-{{ set.id }}"+ data-overlay-theme="a"+ class="ui-content">+ <div>+ <h3>{% trans "Options" %}</h3>+ <a href="{% url 'wger.manager.views.set.edit' set.id %}"+ title="{% trans 'Delete' %}"+ data-role="button">+ <img src="{% static 'images/icons/edit.svg' %}"+ width="16"+ height="16"+ alt="{% trans 'Edit' %}"+ class="ui-li-icon ui-corner-none">+ {% trans "Edit" %}+ </a>+ <a href="{% url 'wger.manager.views.set.delete' set.id %}"+ title="{% trans 'Delete' %}"+ data-role="button">+ <img src="{% static 'images/icons/trash.svg' %}"+ width="16"+ height="16"+ alt="{% trans 'Delete' %}"+ class="ui-li-icon ui-corner-none">+ {% trans "Delete" %}+ </a>+ </div>+</div>+{% endfor %}++<ul data-role="listview"+ id="table-day-{{ day.id }}"+ style="margin-top: 3em;"+ data-split-icon="grid"+ data-split-theme="b">+ <li data-theme="b">+ <a href="#editoptions-day-{{ day.id }}" data-rel="popup">+ <h4>{{day.description}}</h4>{% for day_of_week in day.day.select_related %}{% trans day_of_week.day_of_week %}{% if not forloop.last %}, {% endif %}{% endfor %}- </li>+ </a>- {% 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>- </div>+ <a href="{% url 'day-log' day.id %}"></a>+ </li>+ {% for set in day.set_set.select_related %}+ <li id="set-{{ set.id }}" data-icon="false">+ <a href="#editoptions-set-{{ set.id }}"+ data-rel="popup"+ data-position-to="window">- <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 }}"- data-rel="popup">- {{ exercise.name }}</a>-<!--- <a href="{{ exercise.get_absolute_url }}">{{ exercise.name }}</a>:--->+ <h3>{{ exercise.name }}</h3>+ <p><strong>{% comment %}If there are more than 1 settings, don't output the repetitionse.g. "4 x 8 8 10 10" is shown only as "8 8 10 10", after all@@ -115,8 +119,6 @@<span class="settings-list">{% for setting in exercise|get_current_settings:set.id %}<span id="setting-{{setting.id}}">--{% if setting.reps == 99 %}∞{%else%}@@ -133,21 +135,18 @@</a>{% endfor %} <!--for setting in exercise--></span>+ </strong></p>-- <div class="dimmed">- <ul>+ <p>{% for comment in exercise.exercisecomment_set.all %}- <li>{{comment}}</li>+ {{comment}}<br>{% endfor %}- </ul>- </div>-+ </p></div>{% endfor %} <!--for exercise in set-->- </div>+ </a></li>{% empty %}<li>@@ -160,9 +159,10 @@{% endfor %} <!--for set in day-->{% if day.set_set.select_related %}- <li>+ <li data-icon="arrow-r"><a href="{% url 'set-add' day.id %}"- data-ajax="false">{% trans "Add exercises to this workout day" %}</a>+ data-ajax="false"+ >{% trans "Add exercises to this workout day" %}</a></li>{% endif %}diff --git a/wger/manager/templates/mobile/workout/overview.html b/wger/manager/templates/mobile/workout/overview.htmlindex f88364508..e3f0b415b 100644--- a/wger/manager/templates/mobile/workout/overview.html+++ b/wger/manager/templates/mobile/workout/overview.html@@ -6,41 +6,25 @@{% block content %}++{% if workouts %}- <table id="workout-table" data-role="table" class="ui-responsive table-stroke table-stripe">- <thead>- <tr>- <th>{% trans "Description" %}</th>- <th>{% trans "Date" %}</th>- </tr>- </thead>- <tbody>+<ul data-role="listview" data-inset="false">{% for workout in workouts %}- <tr>- <td>- <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 %}- {% trans "Workout" %}- {% endif %}+ <li>+ <a href="{% url 'wger.manager.views.workout.view' workout.id %}">+ <h3>{{ workout.comment }}</h3>+ <p>{{ workout.creation_date }}</p></a>- </td>- <td>- {{ workout.creation_date }}- </td>- </tr>+ </li>{% endfor %}- </tbody>- </table>+</ul>{% else %}<a href="{% url 'wger.manager.views.workout.add' %}" data-role="button">{% trans "No workouts found." %}<br>{% trans "Add one now." %}</a>{% endif %}+{% endblock %}diff --git a/wger/nutrition/templates/mobile/plan/overview.html b/wger/nutrition/templates/mobile/plan/overview.htmlindex 65bef66e7..fc90dfaff 100644--- a/wger/nutrition/templates/mobile/plan/overview.html+++ b/wger/nutrition/templates/mobile/plan/overview.html@@ -7,41 +7,22 @@{% block content %}-{% if plans %}- <table id="nutrition-table" data-role="table" class="ui-responsive table-stroke table-stripe">- <thead>- <tr>- <th>{% trans "Description" %}</th>- <th>{% trans "Date" %}</th>- </tr>- </thead>- <tbody>+<ul data-role="listview" data-inset="false">{% for plan in plans %}- <tr>- <td>- <a href="{% url 'wger.nutrition.views.plan.view' plan.id %}">- {% if plan.description %}- {{ plan.description }}- {% else %}- {% trans "Nutrition plan" %}- {% endif %}- </a>- </td>- <td>- {{ plan.creation_date }}- </td>- </tr>- {% endfor %}- </tbody>- </table>-{% else %}- <p>+ <li>+ <a href="{% url 'wger.nutrition.views.plan.view' plan.id %}">+ <h3>{{plan}}</h3>+ <p>{{ plan.creation_date }}</p>+ </a>+ </li>+ {% empty %}+ <li><a href="{% url 'wger.nutrition.views.plan.add' %}" data-role="button">{% trans "No nutrition plans." %}<br> {% trans "Add one now." %}</a>- </p>-{% endif %}-+ </li>+ {% endfor %}+</ul>{% endblock %}