Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Improvements to calendar view

Roland Geider4ffef94aaf36
diff --git a/wger/core/static/css/workout-manager-common.css b/wger/core/static/css/workout-manager-common.css
index 7c2d165cb..fce9831fe 100644
--- a/wger/core/static/css/workout-manager-common.css
+++ b/wger/core/static/css/workout-manager-common.css
@@ -330,41 +330,6 @@ table.month td.session-good:hover {
background-color: #449D44;
}
-@media only screen and (max-width : 480px) {
- /* Smartphone view: 1 tile */
- .calendar-log-data ul.grouper-list > li {
- width: 100%;
- }
-}
-@media only screen and (max-width : 650px) and (min-width : 481px) {
- /* Tablet view: 3 tiles */
- .calendar-log-data ul.grouper-list > li {
- width: 33.3%;
- /*height: 33.3%;*/
- }
-}
-@media only screen and (max-width : 1050px) and (min-width : 651px) {
- /* Small desktop: 4 tiles */
- .calendar-log-data ul.grouper-list > li {
- width: 25%;
- /*height: auto;*/
- }
-}
-@media only screen and (max-width : 1290px) and (min-width : 1051px) {
- /* Medium desktop: 5 tiles */
- .calendar-log-data ul.grouper-list > li {
- width: 20%;
- /*height: 20%;*/
- }
-}
-@media only screen and (min-width : 1290px) {
- /* Big desktop: 5 tiles */
- .calendar-log-data ul.grouper-list > li {
- width: 20%;
- /*height: 20%;*/
- }
-}
-
/* Timeline with years and months with logs */
diff --git a/wger/manager/templates/mobile/workout/calendar.html b/wger/manager/templates/mobile/workout/calendar.html
index 24b8cbf03..0c7da9df8 100644
--- a/wger/manager/templates/mobile/workout/calendar.html
+++ b/wger/manager/templates/mobile/workout/calendar.html
@@ -109,22 +109,26 @@ $(document).ready(function() {
{# #}
{# Logs #}
{# #}
- <ul class="grouper-list">
+ <div class="row" style="margin-top: 2em;">
{% for i in grouped_logs %}
- <li>
- {{i.grouper}}
- <ul>
- {% for log in i.list %}
- <li>
- <a href="#log-popup-{{log.pk}}" data-toggle="modal">
- {{log.reps}} × {{log.weight}}
- </a>
- </li>
- {% endfor %}
- </ul>
- </li>
+ <div class="col-sm-4">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{ i.grouper }}</div>
+ <div class="panel-body" style="min-height: 8em;">
+ <ul>
+ {% for log in i.list %}
+ <li>
+ <a href="#log-popup-{{log.pk}}" data-toggle="modal">
+ {{log.reps}} × {{log.weight}}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
+ </div>
{% endfor %}
- </ul>
+ </div>
</div>
{% endfor %}
{% endblock %}
diff --git a/wger/manager/templates/workout/calendar.html b/wger/manager/templates/workout/calendar.html
index e464b2475..15a9ebb38 100644
--- a/wger/manager/templates/workout/calendar.html
+++ b/wger/manager/templates/workout/calendar.html
@@ -21,27 +21,27 @@ $(document).ready(function() {
{% block content %}
{{calendar|safe}}
+
{% for date in logs %}
-<div id="log-{{date|date:'Y-m-d'}}" class="calendar-log-data">
- <h3>{{date}}</h3>
+ <div id="log-{{date|date:'Y-m-d'}}" class="calendar-log-data">
+ <h3>{{date}}</h3>
- {% regroup logs|get_item:date by exercise as grouped_logs %}
+ {% regroup logs|get_item:date by exercise as grouped_logs %}
- {# TODO: what if some of the entries don't belong to a workout? #}
- {% with tmp=grouped_logs|first %}
- {% with first_log=tmp.list|first %}
- {% with session=first_log.get_workout_session %}
- <div class="container-fluid">
+ {# TODO: what if some of the entries don't belong to a workout? #}
+ {% with tmp=grouped_logs|first %}
+ {% with first_log=tmp.list|first %}
+ {% with session=first_log.get_workout_session %}
<div class="row">
- <div class="col-md-4">
+ <div class="col-sm-4">
<a href="{{first_log.workout.get_absolute_url}}" class="btn btn-default btn-block">{{ first_log.workout }}</a>
</div>
- <div class="col-md-4">
+ <div class="col-sm-4">
<a href="{% url 'manager:log:log' first_log.workout.id %}" class="btn btn-default btn-block">{% trans "Log overview" %}</a>
</div>
- <div class="col-md-4">
+ <div class="col-sm-4">
{% if session %}
<a href="{% url 'manager:session:edit' session.pk %}" class="btn btn-default btn-block wger-modal-dialog">{% trans "Edit workout session" %}</a>
{% else %}
@@ -49,52 +49,58 @@ $(document).ready(function() {
{% endif %}
</div>
</div>
+ {% if session %}
+ <p>
+ <strong>{% trans "Time" %}:</strong>
+ {% if session.time_start %}
+ {{session.time_start|time:"H:i"}} - {{session.time_end|time:"H:i"}}
+ {% else %}
+ -/-
+ {% endif %}<br>
+ <strong>{% trans "General impression" %}: </strong> {% trans session.get_impression_display %}<br>
+ <strong>{% trans "Notes" %}:</strong> {{session.notes|default:'-/-'}}
+ </p>
+ {% endif %}
+ {% endwith %}
+ {% endwith %}
+ {% endwith %}
+
+
+ <div class="row" style="margin-top: 2em;">
+ {% for i in grouped_logs %}
+ <div class="col-sm-4">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{ i.grouper }}</div>
+ <div class="panel-body" style="min-height: 8em;">
+ <ul>
+ {% for log in i.list %}
+ <li>
+ {{log.reps}} × {{log.weight}}
+ <span class="editoptions">
+ <a href="{% url 'manager:log:delete' log.pk %}"
+ title="{% trans 'Delete' %}"
+ class="wger-modal-dialog">
+ <img src="{% static 'images/icons/trash.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Delete' %}"></a>
+ <a href="{% url 'manager:log:edit' log.pk %}"
+ title="{% trans 'Edit' %}"
+ class="wger-modal-dialog">
+ <img src="{% static 'images/icons/edit.svg' %}"
+ width="16"
+ height="16"
+ alt="{% trans 'Edit' %}"></a>
+ </span>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
+ </div>
+ {% endfor %}
</div>
- {% if session %}
- <p>
- <strong>{% trans "Time" %}:</strong>
- {% if session.time_start %}
- {{session.time_start|time:"H:i"}} - {{session.time_end|time:"H:i"}}
- {% else %}
- -/-
- {% endif %}<br>
- <strong>{% trans "General impression" %}: </strong> {% trans session.get_impression_display %}<br>
- <strong>{% trans "Notes" %}:</strong> {{session.notes|default:'-/-'}}
- </p>
- {% endif %}
- {% endwith %}
- {% endwith %}
- {% endwith %}
- <ul class="grouper-list">
- {% for i in grouped_logs %}
- <li>{{i.grouper}}
- <ul>
- {% for log in i.list %}
- <li>
- {{log.reps}} × {{log.weight}}
- <span class="editoptions">
- <a href="{% url 'manager:log:delete' log.pk %}"
- title="{% trans 'Delete' %}"
- class="wger-modal-dialog">
- <img src="{% static 'images/icons/trash.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Delete' %}"></a>
- <a href="{% url 'manager:log:edit' log.pk %}"
- title="{% trans 'Edit' %}"
- class="wger-modal-dialog">
- <img src="{% static 'images/icons/edit.svg' %}"
- width="16"
- height="16"
- alt="{% trans 'Edit' %}"></a>
- </span>
- </li>
- {% endfor %}
- </ul>
- </li>
- {% endfor %}
- </ul>
-</div>
+ </div>
{% endfor %}
{% endblock %}
diff --git a/wger/manager/views/log.py b/wger/manager/views/log.py
index 0e7f00bdf..6b78c0b27 100644
--- a/wger/manager/views/log.py
+++ b/wger/manager/views/log.py
@@ -18,7 +18,6 @@ import logging
import uuid
import datetime
from calendar import HTMLCalendar
-from itertools import groupby
from django.shortcuts import render
from django.shortcuts import get_object_or_404
@@ -312,8 +311,8 @@ class WorkoutCalendar(HTMLCalendar):
A calendar renderer, see this blog entry for details:
* http://uggedal.com/journal/creating-a-flexible-monthly-calendar-in-django/
'''
- def __init__(self, workout_logs):
- super(WorkoutCalendar, self).__init__()
+ def __init__(self, workout_logs, *args, **kwargs):
+ super(WorkoutCalendar, self).__init__(*args, **kwargs)
self.workout_logs = workout_logs
def formatday(self, day, weekday):
diff --git a/wger/settings_global.py b/wger/settings_global.py
index 415b377c8..88057f2f4 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -190,7 +190,7 @@ LANGUAGE_CODE = 'en'
# All translation files are in one place
LOCALE_PATHS = (
- fs2unicode(os.path.join(BASE_DIR, 'locale')),
+ fs2unicode(os.path.join(SITE_ROOT, 'locale')),
)
FLAVOURS_STORAGE_BACKEND = 'session'
diff --git a/wger/software/templates/changelog.html b/wger/software/templates/changelog.html
index bbc00ceb0..1b02ddb8d 100644
--- a/wger/software/templates/changelog.html
+++ b/wger/software/templates/changelog.html
@@ -11,6 +11,10 @@
<h4>2014-XX-XX</h4>
<ul>
+ <li>
+ Improvements to the workout calendar
+ <a href="https://github.com/rolandgeider/wger/issues/98">#98</a>
+ </li>
<li>
Other improvements and bugfixes
<a href="https://github.com/rolandgeider/wger/issues/99">#99</a>