Self hosted FLOSS fitness/workout, nutrition and weight tracker
Improve design of workout log page and charts
Roland Geider4a8e3695ba30
diff --git a/exercises/templates/view.html b/exercises/templates/view.htmlindex 466e4ceea..2b49edeb5 100644--- a/exercises/templates/view.html+++ b/exercises/templates/view.html@@ -83,7 +83,7 @@ function custom_modal_init()<script>$(document).ready(function() {-weight_log_chart({{json|safe}}, "{{svg_uuid}}")+weight_log_chart({{json|safe}}, "{{svg_uuid}}", "{{reps}}")});</script>diff --git a/exercises/views.py b/exercises/views.pyindex 4c6c93cb3..792d4b902 100644--- a/exercises/views.py+++ b/exercises/views.py@@ -202,6 +202,7 @@ def exercise_view(request, id, comment_id=None):template_data['logs'] = entry_logtemplate_data['json'] = chart_datatemplate_data['svg_uuid'] = str(uuid.uuid4())+ template_data['reps'] = _("Reps")# Renderreturn render_to_response('view.html',diff --git a/manager/static/css/workout-manager.css b/manager/static/css/workout-manager.cssindex 6bb8a147e..479cbd3b8 100644--- a/manager/static/css/workout-manager.css+++ b/manager/static/css/workout-manager.css@@ -16,7 +16,7 @@*//**************************************************************- *+ ** This file contains custom classes and styles***************************************************************/@@ -143,7 +143,7 @@ div.muscle-background{width: 200px;height: 369px;- background-repeat: no-repeat;+ background-repeat: no-repeat;}/*@@ -196,7 +196,7 @@ circle{* Classes Error form**************************************************************/-/*+/** 'form-error' is inserted by the JQuery form validator and the styling* is copied from the yaml ones, for consistency*/@@ -220,7 +220,7 @@ circle{.workout-log-table .narrow-input{width: 3em;-+}.ym-form .workout-log-table div.ym-fbox-text{@@ -268,7 +268,8 @@ header span.regular{* Links in warning boxes get a different style, the default blue doesn't match* well with orange*/-div.warning a, div.warning a:hover, div.warning a:active{+div.warning a, div.warning a:hover, div.warning a:active,+div.info a, div.info a:hover, div.info a:active{color: black;text-decoration: underline;background-color: transparent;@@ -368,5 +369,5 @@ ul.pagination a:visited {ul.pagination a:hover{border: 1px solid #2e3436;- box-shadow: 0 0 4px #3465a4 inset;+ box-shadow: 0 0 4px #3465a4 inset;}diff --git a/manager/static/css/yaml401/custom-yaml.css b/manager/static/css/yaml401/custom-yaml.cssindex f33374ba8..a92be0bbe 100644--- a/manager/static/css/yaml401/custom-yaml.css+++ b/manager/static/css/yaml401/custom-yaml.css@@ -17,7 +17,7 @@/**************************************************************- *+ ** This file contains slight modifications to the YAML theme* or other YAML elements*@@ -48,7 +48,7 @@ nav {}-tr:hover .editoptions, tbody tr:hover td .editoptions, ul:hover .editoptions+tr:hover .editoptions, tbody tr:hover td .editoptions, ul:hover .editoptions{visibility: visible;}@@ -58,7 +58,7 @@ tr:hover .editoptions, tbody tr:hover td .editoptions, ul:hover .editoptions* Deactivate the default background color on hover*/.editoptions a:hover,-.ui-tabs-nav a:hover,+.ui-tabs-nav a:hover,.ui-tabs-nav a:focus,.ajax-exercise-select a:hover,.no-hover a:hover,@@ -68,18 +68,18 @@ tr:hover .editoptions, tbody tr:hover td .editoptions, ul:hover .editoptions/*- * Use colour from the Tango palette for links+ * Use colour from the Tango palette for links*/a {color: #3465a4;}/*- * Use colours from the Tango palette for the info, warning and error boxes+ * Use colours from the Tango palette for the info, warning and error boxes*/.info {- background: #babdb6;+ background: #eeeeec;}.warning {@@ -96,7 +96,7 @@ a {/** Set the width of form elements to 100%- *+ ** Most forms will be edited on a JQuery dialog window and this makes it more readable*/.ym-form input, .ym-form input, .ym-form textarea, .ym-form select {diff --git a/manager/static/images/icons/toggle.svg b/manager/static/images/icons/toggle.svgnew file mode 100644index 000000000..ca4fae8cd--- /dev/null+++ b/manager/static/images/icons/toggle.svg@@ -0,0 +1,62 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<!-- Created with Inkscape (http://www.inkscape.org/) --><svg height="48" id="svg2" inkscape:export-filename="/home/lapo/Desktop/rotate.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:version="0.45" sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/actions" sodipodi:docname="object-flip-horizontal.svg" sodipodi:version="0.32" version="1.0" width="48" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">+ <metadata>+ <rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">+ <cc:Work rdf:about="">+ <dc:title>Lapo Calamandrei</dc:title>+ <dc:description></dc:description>+ <dc:subject>+ <rdf:Bag>+ <rdf:li>horizontally</rdf:li>+ <rdf:li>mirror</rdf:li>+ <rdf:li>flip</rdf:li>+ <rdf:li>arrows</rdf:li>+ </rdf:Bag>+ </dc:subject>+ <dc:publisher>+ <cc:Agent rdf:about="http://www.openclipart.org/">+ <dc:title>Open Clip Art Library, Source: GNOME Icon Theme, Source: GNOME Icon Theme, Source: GNOME Icon Theme, Source: GNOME Icon Theme</dc:title>+ </cc:Agent>+ </dc:publisher>+ <dc:creator>+ <cc:Agent>+ <dc:title>Lapo Calamandrei</dc:title>+ </cc:Agent>+ </dc:creator>+ <dc:rights>+ <cc:Agent>+ <dc:title>Lapo Calamandrei</dc:title>+ </cc:Agent>+ </dc:rights>+ <dc:date>2006-10-02</dc:date>+ <dc:format>image/svg+xml</dc:format>+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>+ <cc:license rdf:resource="http://creativecommons.org/licenses/GPL/2.0/"/>+ <dc:language>en</dc:language>+ </cc:Work>+ </rdf:RDF>+ </metadata>+ <defs id="defs4">+ <linearGradient id="linearGradient6918">+ <stop id="stop6920" offset="0" style="stop-color:#fcaf3e;stop-opacity:1"/>+ <stop id="stop6922" offset="1" style="stop-color:#ffffff;stop-opacity:1;"/>+ </linearGradient>+ <radialGradient cx="12.15625" cy="16.96875" fx="12.15625" fy="16.96875" gradientTransform="matrix(1,0,0,0.537849,0,7.842131)" gradientUnits="userSpaceOnUse" id="radialGradient3359" inkscape:collect="always" r="7.84375" xlink:href="#linearGradient3209"/>+ <linearGradient id="linearGradient3263" inkscape:collect="always">+ <stop id="stop3265" offset="0" style="stop-color:white;stop-opacity:1;"/>+ <stop id="stop3267" offset="1" style="stop-color:white;stop-opacity:0;"/>+ </linearGradient>+ <linearGradient id="linearGradient3209" inkscape:collect="always">+ <stop id="stop3211" offset="0" style="stop-color:black;stop-opacity:1;"/>+ <stop id="stop3213" offset="1" style="stop-color:black;stop-opacity:0;"/>+ </linearGradient>+ <linearGradient gradientTransform="matrix(0,1,-1,0,44.01386,-2.96967)" gradientUnits="userSpaceOnUse" id="linearGradient3854" inkscape:collect="always" x1="20.875" x2="52.219353" xlink:href="#linearGradient3263" y1="24.5625" y2="13.597429"/>+ <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient6924" inkscape:collect="always" x1="13.875" x2="13.875" xlink:href="#linearGradient6918" y1="44.381733" y2="-28.978821"/>+ </defs>+ <sodipodi:namedview bordercolor="#afafaf" borderlayer="true" borderopacity="1" gridempspacing="2" gridspacingx="0.5px" gridspacingy="0.5px" height="48px" id="base" inkscape:current-layer="layer1" inkscape:cx="38.391353" inkscape:cy="25.931582" inkscape:document-units="px" inkscape:grid-points="true" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:showpageshadow="false" inkscape:window-height="847" inkscape:window-width="872" inkscape:window-x="55" inkscape:window-y="24" inkscape:zoom="1" pagecolor="#ffffff" showborder="false" showgrid="false" showguides="true" width="48px"/>+ <g id="layer1" inkscape:groupmode="layer" inkscape:label="Livello 1" style="display:inline">+ <path d="M 20 16.96875 A 7.84375 4.21875 0 1 1 4.3125,16.96875 A 7.84375 4.21875 0 1 1 20 16.96875 z" id="path3323" inkscape:export-filename="/home/lapo/Desktop/rotate.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:cx="12.15625" sodipodi:cy="16.96875" sodipodi:rx="7.84375" sodipodi:ry="4.21875" sodipodi:type="arc" style="opacity:0.15;color:#000000;fill:url(#radialGradient3359);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.4;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" transform="matrix(2.8047804,0,0,2.133333,-10.095615,2.8)"/>+ <path d="M 29.34375,9.03125 C 28.83595,9.1090983 28.462869,9.5488006 28.46875,10.0625 L 28.46875,16.5 L 18.53125,16.5 L 18.53125,10.125 C 18.523927,9.7217437 18.282212,9.3597578 17.912551,9.1984511 C 17.54289,9.0371444 17.11312,9.1061188 16.8125,9.375 L 2.8125,22.28125 C 2.6060825,22.476094 2.4890941,22.747398 2.4890941,23.03125 C 2.4890941,23.315102 2.6060825,23.586406 2.8125,23.78125 L 16.8125,36.75 C 17.11312,37.018881 17.54289,37.087856 17.912551,36.926549 C 18.282212,36.765242 18.523927,36.403256 18.53125,36 L 18.53125,29.5625 L 28.46875,29.5625 L 28.46875,35.9375 C 28.476073,36.340756 28.717788,36.702742 29.087449,36.864049 C 29.45711,37.025356 29.88688,36.956381 30.1875,36.6875 L 44.1875,23.78125 C 44.393917,23.586406 44.510906,23.315102 44.510906,23.03125 C 44.510906,22.747398 44.393917,22.476094 44.1875,22.28125 L 30.1875,9.3125 C 29.963199,9.0960678 29.65305,8.9926846 29.34375,9.03125 z " id="path5945" inkscape:original="M 29.5 10.0625 L 29.5 16.53125 C 29.494978 17.081441 29.050191 17.526228 28.5 17.53125 L 18.5 17.53125 C 17.949809 17.526228 17.505022 17.081441 17.5 16.53125 L 17.5 10.125 L 3.5 23.03125 L 17.5 36 L 17.5 29.53125 C 17.505022 28.981059 17.949809 28.536272 18.5 28.53125 L 28.5 28.53125 C 29.050191 28.536272 29.494978 28.981059 29.5 29.53125 L 29.5 35.9375 L 43.5 23.03125 L 29.5 10.0625 z " inkscape:radius="1.03125" sodipodi:type="inkscape:offset" style="color:#000000;fill:url(#linearGradient6924);fill-opacity:1.0;fill-rule:nonzero;stroke:#ce5c00;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:1.4;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"/>+ <path d="M 29.5,10.03125 L 29.5,17.53125 L 17.5,17.53125 L 17.5,10.125 L 3.46875,23.0625 L 17.5,36.03125 L 17.5,28.53125 L 29.5,28.53125 L 29.5,35.9375 L 43.53125,23 L 29.5,10.03125 z " id="path3392" sodipodi:nodetypes="ccccccccccc" style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3854);stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:1.4;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"/>+ </g>+</svg>diff --git a/manager/static/js/workout-manager.js b/manager/static/js/workout-manager.jsindex c2a3b32b1..74b109e9d 100644--- a/manager/static/js/workout-manager.js+++ b/manager/static/js/workout-manager.js@@ -542,7 +542,7 @@ function weight_chart(data)}-function weight_log_chart(data, div_id)+function weight_log_chart(data, div_id, reps_i18n){var margin = {top: 20, right: 80, bottom: 30, left: 50},width = 700 - margin.left - margin.right,@@ -655,7 +655,7 @@ function weight_log_chart(data, div_id).attr("transform", function(d) { return "translate(" + x(d.value.date) + "," + y(d.value.weight) + ")"; }).attr("x", 3).attr("dy", ".35em")- .text(function(d) { return d.name; });+ .text(function(d) { return d.name + " " + reps_i18n; });}function toggle_weight_log_table()diff --git a/manager/templates/tags/render_weight_log.html b/manager/templates/tags/render_weight_log.htmlindex a1da5a537..ac07caf29 100644--- a/manager/templates/tags/render_weight_log.html+++ b/manager/templates/tags/render_weight_log.html@@ -4,6 +4,16 @@{% block header %}{% endblock %}+<div class="weight-chart-table-toggle" data-toggle-target="table-{{div_uuid}}">+<p>+ <a href="#">+ <img src="{% static 'images/icons/toggle.svg' %}"+ width="16"+ height="16"+ alt="{% trans 'Toggle data table' %}">+ {% trans "Toggle data table" %}</a>+</p>+</div><div style="overflow-x: auto;" class="weight-chart-table"><table class="noborder" style="border: 0 none; width: 7.5em; display:none;" id="table-{{div_uuid}}">@@ -26,9 +36,4 @@</table></div>-<div class="weight-chart-table-toggle" data-toggle-target="table-{{div_uuid}}">-<a href="#">{% trans "Toggle data table" %}</a>-</div>-<div id="svg-{{div_uuid}}"></div>-diff --git a/manager/templates/workout/log.html b/manager/templates/workout/log.htmlindex 98416f078..fd233321b 100644--- a/manager/templates/workout/log.html+++ b/manager/templates/workout/log.html@@ -21,7 +21,7 @@{% endif %}{% for day, exercise_log in workout_log.items %}-<h3 style="border-bottom: 1px solid rgb(224, 224, 224);">{{ day.description }}</h3>+<h3>{{ day.description }}</h3><p><a href="{% url day-log day.id %}"@@ -35,7 +35,9 @@</p>{% for exercise, date_list in exercise_log.items %}- <p><a href="{{ exercise.get_absolute_url }}">{{ exercise.name }}</a></p>+ <div class="box info" style="text-align: center;">+ <a href="{{ exercise.get_absolute_url }}">{{ exercise.name }}</a>+ </div>{% if date_list.log_by_date %}{% with list=date_list.log_by_date %}@@ -43,7 +45,7 @@<script>$(document).ready(function() {- weight_log_chart({{date_list.chart_data|safe}}, "{{date_list.div_uuid}}")+ weight_log_chart({{date_list.chart_data|safe}}, "{{date_list.div_uuid}}", "{{reps}}")});</script>{% endwith %}@@ -70,6 +72,10 @@<h3>{% trans "Options" %}</h3><p><a href="{% url workout-view workout.id %}">+ <img src="{% static 'images/icons/list.svg' %}"+ width="32"+ height="32"+ alt="{% trans 'Back to workout' %}">{% trans "Back to workout" %}</a></p>diff --git a/manager/views.py b/manager/views.pyindex 19372824e..6d3dbc2b8 100644--- a/manager/views.py+++ b/manager/views.py@@ -1133,5 +1133,7 @@ class WorkoutLogDetailView(DetailView):logger.debug(chart_data)context['workout_log'] = workout_log+ context['reps'] = _("Reps")+return context