Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Cleanup log form template, add date picker

Roland Geider70670d86f2a5
diff --git a/manager/static/css/workout-manager.css b/manager/static/css/workout-manager.css
index bc9e269b1..eefea9e4e 100644
--- a/manager/static/css/workout-manager.css
+++ b/manager/static/css/workout-manager.css
@@ -23,6 +23,10 @@
+/**************************************************************
+ * Font definitions
+ **************************************************************/
+
/* font-face kit by Fonts2u - http://www.fonts2u.com */
@font-face {
font-family:"Open Sans Light";
@@ -151,9 +155,9 @@ div.muscle-background
-/*
+/**************************************************************
* Styling for the SVG elements on the weight chart
- */
+ **************************************************************/
.axis path, .axis line {
fill: none;
@@ -187,9 +191,12 @@ circle{
}
-/*
+
+/**************************************************************
* Classes Error form
- *
+ **************************************************************/
+
+/*
* 'form-error' is inserted by the JQuery form validator and the styling
* is copied from the yaml ones, for consistency
*/
@@ -206,6 +213,19 @@ circle{
color: black;
}
+.workout-log-table .narrow-input
+{
+ width: 3em;
+}
+
+.ym-form .workout-log-table div.ym-fbox-text{
+ padding: 0em 0.3em;
+}
+
+
+/**************************************************************
+ * Header
+ **************************************************************/
/*
* Add a shadow to the application name
@@ -213,24 +233,24 @@ circle{
header h1{
text-shadow: 2px 3px 3px #292929;
font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;
- font-weight: 300;
+ font-weight: 300;
}
header span.name{
text-shadow: 2px 3px 3px #292929;
font-family: "Open Sans Bold", Arial, Helvetica, sans-serif;
- font-weight: 300;
- font-size: 350%;
- color: white;
+ font-weight: 300;
+ font-size: 350%;
+ color: white;
}
header span.regular{
text-shadow: 2px 3px 3px #292929;
font-family: "Open Sans Light", Arial, Helvetica, sans-serif;
- font-weight: 300;
- font-size: 350%;
- color: white;
+ font-weight: 300;
+ font-size: 350%;
+ color: white;
}
@@ -244,6 +264,10 @@ div.warning a, div.warning a:hover, div.warning a:active{
background-color: transparent;
}
+
+/**************************************************************
+ * Autocompleter
+ **************************************************************/
/*
* Category heading for the ajax autocompleter
*/
@@ -278,11 +302,9 @@ div.warning a, div.warning a:hover, div.warning a:active{
}
-/*
- *
+/**************************************************************
* Pagination styles
- *
- */
+ **************************************************************/
.pagination a:hover
{
color:black;
diff --git a/manager/templates/day/log.html b/manager/templates/day/log.html
index 2ea3706af..5b2cd32f0 100644
--- a/manager/templates/day/log.html
+++ b/manager/templates/day/log.html
@@ -3,42 +3,28 @@
{% load staticfiles %}
{% load manager_extras %}
-{% block title %}{% trans "Weight log for workout" %} – {{ workout.creation_date }}{% endblock %}
+{% block title %}{% trans "New weight log" %} – {{day.description}}{% endblock %}
{% block header %}
-<style type="text/css" media="screen">
-.workout-log-table .narrow-input
-{
- width: 3em;
-}
-
-.ym-form .workout-log-table div.ym-fbox-text{
- padding: 0em 0.3em;
-}
-</style>
+{% if language.short_name == 'de' %}
+<script src="{% static 'js/jquery.ui.datepicker-de.js' %}"></script>
+{% endif %}
+<script type="text/javascript" charset="utf-8">
+$(document).ready(function () {
+ $( "#id_date" ).datepicker({ dateFormat: "yy-mm-dd" });
+});
+</script>
{% endblock %}
{% block content %}
-<h2>{% trans "Weight log for workout" %} {{ workout.id }}</h2>
+<h2>{% trans "New weight log" %} – {{day.description}}</h2>
<form action="{{form_action}}" method="POST" class="ym-form">
{% csrf_token %}
{{formset.management_form}}
-
-
-
-
<table class="workout-log-table">
-
-<!--
-{% if formset.errors %}
- {% for error in formset.errors %}
- {{error}}
- {% endfor %}
-{% endif %}
--->
<tr>
<td>
{{dateform.date.label}}
@@ -47,11 +33,17 @@
<div class= "ym-fbox-text {% if dateform.date.errors %}ym-error{% endif %}">
{{dateform.date}}
</div>
+
+ <div class="ym-fbox-text {% if dateform.date.errors %}ym-error{% endif %}">
+ <span class="ym-message">{{dateform.date.errors}}</span>
+ </div>
</td>
</tr>
+</table>
-
-
+<h3>{% trans "Exercises" %}</h3>
+<table class="workout-log-table">
+<tr>
{% for key, value in exercises.items %}
<tr>
<td style="width:25%;">
@@ -61,24 +53,34 @@
<td>
<div class= "ym-fbox-text narrow-input {% if form.reps.errors %}ym-error{% endif %}">
- {{form.reps}} {% trans "Reps" %}
+ {{form.reps}}
</div>
+ <div class="ym-fbox-text {% if form.reps.errors %}ym-error{% endif %}">
+ <span class="ym-message">{% trans "Reps" %}</span>
+ </div>
</td>
<td>
<div class= "ym-fbox-text narrow-input {% if form.weight.errors %}ym-error{% endif %}">
- {{form.weight}} kg.
+ {{form.weight}}
</div>
+
+ <div class="ym-fbox-text {% if form.weight.errors %}ym-error{% endif %}">
+ <span class="ym-message">kg.</span>
+ </div>
</td>
{% endfor %}
</tr>
+{% empty %}
+ <div class="box warning" id="weight-box-warning">
+ {% trans "Add exercises to this training day before adding a log." %}
+
+ <a href="{% url workout-view day.training.id %}">
+ {% trans "Back to workout" %}
+ </a>
+
+ </div>
{% endfor %}
-
-{% comment %}
-{% for form in formset %}
- {{ form.as_table }}
-{% endfor %}
-{% endcomment %}
<tr>
<td colspan="{{max_sets}}">
<input type="submit" value="{% trans 'Save' %}" id="form-save">
@@ -88,3 +90,13 @@
</form>
{% endblock %}
+
+
+{% block sidebar %}
+<h3>{% trans "Options" %}</h3>
+<p>
+<a href="{% url workout-view day.training.id %}">
+ {% trans "Back to workout" %}
+</a>
+</p>
+{% endblock %}
\ No newline at end of file
diff --git a/manager/templates/tags/render_day.html b/manager/templates/tags/render_day.html
index f4c36def7..cce580f09 100644
--- a/manager/templates/tags/render_day.html
+++ b/manager/templates/tags/render_day.html
@@ -47,8 +47,7 @@ $(document).ready(function() {
alt="{% trans 'Edit' %}">
</a>
<a href="{% url day-log day.id %}"
- title="{% trans 'Add log' %}"
- class="modal-dialog">
+ title="{% trans 'Add log' %}">
<img src="{% static 'images/icons/statistics.svg' %}"
width="22"
height="22"
diff --git a/manager/views.py b/manager/views.py
index 5917ee891..00499aa1a 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -1058,8 +1058,8 @@ def workout_log_add(request, pk):
form_id_from = min(exercise_list[exercise]['form_ids'])
form_id_to = max(exercise_list[exercise]['form_ids'])
exercise_list[exercise]['forms'] = formset[form_id_from:form_id_to +1]
-
+ template_data['day'] = day
template_data['max_sets'] = max_sets
template_data['exercises'] = exercise_list
template_data['formset'] = formset