Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add a date picker to the workout log dialogs

Roland Geider9becbeb35994
diff --git a/manager/static/js/workout-manager.js b/manager/static/js/workout-manager.js
index f93afd18a..4bb21c459 100644
--- a/manager/static/js/workout-manager.js
+++ b/manager/static/js/workout-manager.js
@@ -437,6 +437,10 @@ function init_weight_datepicker()
$( "#id_creation_date" ).datepicker();
}
+function init_weight_log_datepicker()
+{
+ $( "#id_date" ).datepicker();
+}
/*
diff --git a/manager/templates/workout/log.html b/manager/templates/workout/log.html
index a1d8051fd..7ba4c3fb4 100644
--- a/manager/templates/workout/log.html
+++ b/manager/templates/workout/log.html
@@ -7,6 +7,18 @@
{% block header %}
<script src="{% static 'js/d3.js' %}"></script>
+
+{% if language.short_name == 'de' %}
+<script src="{% static 'js/jquery.ui.datepicker-de.js' %}"></script>
+{% endif %}
+
+<script type="text/javascript">
+// Initialise the datepicker for the modal dialog
+function custom_modal_init()
+{
+ init_weight_log_datepicker();
+}
+</script>
{% endblock %}
{% block content %}
@@ -85,4 +97,8 @@
This page shows the weight logs belonging to this workout only. Click on an
exercise to see all the historical data for it.
{% endblocktrans %}</p>
+
+<p>{% blocktrans %}
+Click on a value on a chart to edit the log entry.
+{% endblocktrans %}</p>
{% endblock %}
diff --git a/manager/views.py b/manager/views.py
index bc140a4a8..373220279 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -974,6 +974,9 @@ class WorkoutLogUpdateView(YamlFormMixin, UpdateView):
active_tab = WORKOUT_TAB
model = WorkoutLog
form_class = WorkoutLogForm
+ custom_js = '''$(document).ready(function () {
+ init_weight_log_datepicker();
+ });'''
def get_context_data(self, **kwargs):
context = super(WorkoutLogUpdateView, self).get_context_data(**kwargs)