Private
Public Access
1
0

first cut at list_workouts

This commit is contained in:
Sander Roosendaal
2018-09-27 18:42:44 +02:00
parent 7abf144e17
commit 8aa72c49f4
4 changed files with 140 additions and 209 deletions

View File

@@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "newbase.html" %}
{% load staticfiles %} {% load staticfiles %}
{% load rowerfilters %} {% load rowerfilters %}
@@ -41,65 +41,55 @@
{% endblock %} {% endblock %}
{% block content %} {% block main %}
<style> <style>
#mypointer { #mypointer {
cursor: pointer; cursor: pointer;
} }
</style> </style>
<div class="grid_12"> <ul class="main-content">
<li class="grid_2">
<div class="grid_4 alpha"> <p>
{% if team %}
<form enctype="multipart/form-data" method="post"> <form enctype="multipart/form-data" method="post">
{% else %}
<form enctype="multipart/form-data" method="post">
{% endif %}
<table> <table>
{{ dateform.as_table }} {{ dateform.as_table }}
</table> </table>
{% csrf_token %} {% csrf_token %}
</div> <input name='daterange' type="submit" value="Submit">
<div class="grid_2 alpha"> </form>
<input name='daterange' class="button green" type="submit" value="Submit"> </form> </p>
</div> {% if team %}
{% if user.is_authenticated and user|is_manager %} <p>
<div class="grid_2 dropdown"> <form id="searchform" action="/rowers/list-workouts/team/{{ team.id }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
<button class="grid_2 alpha button green small dropbtn"> method="get" accept-charset="utf-8">
{{ rower.user.first_name }} {{ rower.user.last_name }} {% else %}
</button> <form id="searchform" action="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
<div class="dropdown-content"> method="get" accept-charset="utf-8">
{% for member in user|team_members %} {% endif %}
<a class="button green small" href="/rowers/u/{{ member.id }}/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}">{{ member.first_name }} {{ member.last_name }}</a> <input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search">
{% endfor %} <input type="submit">
</div> </input>
</div> </form>
{% else %} </p>
&nbsp; </li>
<li>
{% endif %} <script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
<script async="true" type="text/javascript">
Bokeh.set_log_level("info");
</div> </script>
{% if team %} {{ interactiveplot |safe }}
<div class="grid_12 alpha">
{% include "teambuttons.html" with teamid=team.id team=team %} {{ the_div |safe }}
</div> </li>
{% endif %} <li class="grid_4">
<div class="grid_12">
<div id="workouts_table" class="grid_8 alpha">
{% if team %} {% if team %}
<h3>{{ team.name }} Team Workouts</h3> <h3>{{ team.name }} Team Workouts</h3>
{% else %} {% else %}
<h3>Workouts of {{ rower.user.first_name }} {{ rower.user.last_name }}</h3> <h3>Workouts of {{ rower.user.first_name }} {{ rower.user.last_name }}</h3>
{% endif %} {% endif %}
{% if workouts %} {% if workouts %}
<table width="100%" class="listtable shortpadded"> <table width="100%" class="listtable shortpadded">
<thead> <thead>
@@ -122,7 +112,7 @@
</th> </th>
{% endif %} {% endif %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for workout in workouts %} {% for workout in workouts %}
{% if workout.rankingpiece %} {% if workout.rankingpiece %}
@@ -140,8 +130,8 @@
</td> </td>
<td> {{ workout.date|date:"Y-m-d" }} </td> <td> {{ workout.date|date:"Y-m-d" }} </td>
<td> {{ workout.starttime|date:"H:i" }} </td> <td> {{ workout.starttime|date:"H:i" }} </td>
{% if workout.user.user == user or user == team.manager %} {% if workout.user.user == user or user == team.manager %}
{% if workout.name != '' %} {% if workout.name != '' %}
<td> <td>
<a href={% url rower.defaultlandingpage id=workout.id %}> <a href={% url rower.defaultlandingpage id=workout.id %}>
{{ workout.name }} {{ workout.name }}
@@ -170,17 +160,17 @@
</td> </td>
{% else %} {% else %}
<td colspan="2"> <td colspan="2">
<a class="small" href="/rowers/{{ workout.user.id }}/list-workouts"> <a class="small" href="/rowers/{{ workout.user.id }}/list-workouts">
{{ workout.user.user.first_name }} {{ workout.user.user.first_name }}
{{ workout.user.user.last_name }} {{ workout.user.user.last_name }}
</a> </a>
</td> </td>
{% endif %} {% endif %}
<td> <a class="small" href="/rowers/workout/{{ workout.id }}/flexchart">Flex</a> </td> <td> <a class="small" href="/rowers/workout/{{ workout.id }}/flexchart">Flex</a> </td>
<td> <td>
<a class="small" href="/rowers/workout/{{ workout.id }}/deleteconfirm">Delete <a class="small" href="/rowers/workout/{{ workout.id }}/deleteconfirm">Delete
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@@ -189,140 +179,77 @@
{% else %} {% else %}
<p> No workouts found </p> <p> No workouts found </p>
{% endif %} {% endif %}
</div> </li>
{% if announcements %}
<li class="grid_4">
<div class="grid_4 omega"> <h2>What's New?</h2>
{% if team %} </li>
<div class="grid_4" id="teambuttons"> {% for a in announcements %}
<div class="grid_3 alpha"> <li>
<p> <div class="site-announcement-box">
&nbsp; <div class="site-announcement">
</p> <i>{{ a.created }}:</i>
{{ a.announcement|urlize }}
</div> </div>
</div> </div>
</li>
{% endfor %}
{% endif %}
<li class="grid_2">
{% if rankingonly and not team %}
<a href="/rowers/list-workouts">All Workouts</a>
{% elif not team %}
<a href="/rowers/list-workouts/ranking">Ranking Pieces Only</a>
{% endif %} {% endif %}
<div class="grid_4" id="interactiveplot"> </li>
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script> <li class="grid_2">
<script async="true" type="text/javascript"> {% if user|is_promember %}
Bokeh.set_log_level("info"); <a href="/rowers/workouts-join-select">Glue Workouts</a>
</script> {% else %}
<a href="/rowers/promembership">Glue</a>
{% endif %}
</li>
<li class="grid_4">
<span>
{% if workouts.has_previous %}
{% if request.GET.q %}
<a class="wh" href="?page={{ workouts.previous_page_number }}&q={{ request.GET.q }}">&lt;</a>
{% else %}
<a class="wh" href="?page={{ workouts.previous_page_number }}">&lt;</a>
{% endif %}
{% endif %}
{{ interactiveplot |safe }} <span>
Page {{ workouts.number }} of {{ workouts.paginator.num_pages }}.
<script> </span>
// Set things up to resize the plot on a window resize. You can play with
// the arguments of resize_width_height() to change the plot's behavior. {% if workouts.has_next %}
var plot_resize_setup = function () { {% if request.GET.q %}
var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot <a class="wh" href="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}?page={{ workouts.next_page_number }}&q={{ request.GET.q }}">&gt;</a>
var plot = Bokeh.index[plotid]; {% else %}
var plotresizer = function() { <a class="wh" href="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}?page={{ workouts.next_page_number }}">&gt;</a>
// arguments: use width, use height, maintain aspect ratio {% endif %}
plot.resize_width_height(true, true, true); {% endif %}
}; </span>
window.addEventListener('resize', plotresizer); </li>
plotresizer(); <li>
}; {% if user.is_authenticated and user|is_manager %}
window.addEventListener('load', plot_resize_setup); <button class="dropbtn">
</script> {{ rower.user.first_name }} {{ rower.user.last_name }}
<style> </button>
/* Need this to get the page in "desktop mode"; not having an infinite height.*/ <div class="dropdown-content">
html, body {height: 100%; margin:5px;} {% for member in user|team_members %}
</style> <a href="/rowers/u/{{ member.id }}/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}">{{ member.first_name }} {{ member.last_name }}</a>
{{ the_div |safe }}
</div>
<div class="grid_4" id="announcements">
{% if announcements %}
<h3>What's New?</h3>
{% for a in announcements %}
<div class="site-announcement-box">
<div class="site-announcement">
<i>{{ a.created }}:</i>
{{ a.announcement|urlize }}
</div>
</div>
{% endfor %} {% endfor %}
<p>&nbsp;</p> {% else %}
&nbsp;
{% endif %} {% endif %}
</div> </div>
<div class="grid_4" id="about"> </li>
<h3>About</h3> </ul>
<p>This site is a beta site, pioneering rowing data
visualization and analysis. No warranties. The site's author is
Sander Roosendaal. A Masters rower.
Read his <a href="http://blog.rowsandall.com/">blog</a>
</p>
<p><a href="/rowers/email/">&copy; Rowsandall s.r.o.</a></p>
<div style="text-align: right; padding: 2em">
<a href="http://blog.rowsandall.com/">
<img src="/static/img/sander.jpg" width="80"></a>
</div>
</div>
</div>
</div>
</div>
<div class="grid_6 alpha">
{% if rankingonly and not team %}
<div class="grid_2 alpha">
<a class="button small green" href="/rowers/list-workouts">All Workouts</a>
</div>
{% elif not team %}
<div class="grid_2 alpha">
<a class="button small green" href="/rowers/list-workouts/ranking">Ranking Pieces Only</a>
</div>
{% endif %}
<div class="grid_2">
{% if user|is_promember %}
<a class="button small gray" href="/rowers/workouts-join-select">Glue Workouts</a>
{% else %}
<a class="button blue small" href="/rowers/promembership">Glue</a>
{% endif %}
</div>
<div class="grid_2 omega">
<a class="button small gray" href="/rowers/update_empower">Empower Repair</a>
</div>
<p>&nbsp;</p>
{% if team %}
<form id="searchform" action="/rowers/list-workouts/team/{{ team.id }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
method="get" accept-charset="utf-8">
{% else %}
<form id="searchform" action="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
method="get" accept-charset="utf-8">
{% endif %}
<div class="grid_3 prefix_1 alpha">
<input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search">
</div>
<div class="grid_1 omega">
<button class="button blue small" type="submit">
Search
</button>
</div>
</form>
</div>
<div class="grid_2 omega">
<span class="button gray small">
{% if workouts.has_previous %}
{% if request.GET.q %}
<a class="wh" href="?page={{ workouts.previous_page_number }}&q={{ request.GET.q }}">&lt;</a>
{% else %}
<a class="wh" href="?page={{ workouts.previous_page_number }}">&lt;</a>
{% endif %}
{% endif %}
<span>
Page {{ workouts.number }} of {{ workouts.paginator.num_pages }}.
</span>
{% if workouts.has_next %}
{% if request.GET.q %}
<a class="wh" href="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}?page={{ workouts.next_page_number }}&q={{ request.GET.q }}">&gt;</a>
{% else %}
<a class="wh" href="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}?page={{ workouts.next_page_number }}">&gt;</a>
{% endif %}
{% endif %}
</span>
{% endblock %} {% endblock %}
{% block sidebar %}
{% include 'menu_workouts.html' %}
{% endblock %}

View File

@@ -6469,6 +6469,7 @@ def workouts_view(request,message='',successmessage='',
return render(request, 'list_workouts.html', return render(request, 'list_workouts.html',
{'workouts': workouts, {'workouts': workouts,
'active': 'nav-workouts',
'rower':r, 'rower':r,
'dateform':dateform, 'dateform':dateform,
'startdate':startdate, 'startdate':startdate,

View File

@@ -450,15 +450,15 @@ a.button {
/* green */ /* green */
.green { .green {
color: #e8f0de; color: #e8f0de;
border: solid 1px #538312; border: solid 1px #538312;
background: #64991e; background: #64991e;
} }
.green:hover { .green:hover {
background: #538018; background: #538018;
} }
.green:active { .green:active {
color: #a9c08c; color: #a9c08c;
} }
/* palegreen */ /* palegreen */

View File

@@ -149,7 +149,7 @@
</li> </li>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<li> <li>
<a href="/rowers/new_profile" title="Profile"> <a href="/rowers/me/edit" title="Profile">
{% if user.rower.rowerplan == 'pro' %} {% if user.rower.rowerplan == 'pro' %}
<i class="fas fa-user-ninja "></i> <i class="fas fa-user-ninja "></i>
{% elif user.rower.rowerplan == 'coach' %} {% elif user.rower.rowerplan == 'coach' %}
@@ -157,7 +157,7 @@
{% elif user.rower.rowerplan == 'plan' %} {% elif user.rower.rowerplan == 'plan' %}
<i class="fas fa-user-tie "></i> <i class="fas fa-user-tie "></i>
{% else %} {% else %}
<a href="/rowers/new_profile" title="Profile"> <a href="/rowers/me/edit" title="Profile">
<i class="fas fa-user"></i> <i class="fas fa-user"></i>
{% endif %} {% endif %}
</a> </a>
@@ -189,27 +189,27 @@
<nav class="main-nav"> <nav class="main-nav">
<ul> <ul>
<li id="nav-workouts"> <li id="nav-workouts">
<a href="/rowers/new_workouts"> <a href="/rowers/list-workouts">
<i class="fas fa-clipboard-list"></i>&nbsp;Workouts <i class="fas fa-clipboard-list"></i>&nbsp;Workouts
</a> </a>
</li> </li>
<li id="nav-racing"> <li id="nav-racing">
<a href="/rowers/new_racing"> <a href="/rowers/virtualevents">
<i class="fas fa-flag-checkered"></i>&nbsp;Racing <i class="fas fa-flag-checkered"></i>&nbsp;Racing
</a> </a>
</li> </li>
<li id="nav-analysis"> <li id="nav-analysis">
<a href="/rowers/new_analysis"> <a href="/rowers/analysis">
<i class="fas fa-analytics"></i>&nbsp;Analysis <i class="fas fa-analytics"></i>&nbsp;Analysis
</a> </a>
</li> </li>
<li id="nav-plan"> <li id="nav-plan">
<a href="/rowers/new_plan"> <a href="/rowers/sessions">
<i class="fas fa-calendar-alt"></i>&nbsp;Plan <i class="fas fa-calendar-alt"></i>&nbsp;Plan
</a> </a>
</li> </li>
<li id="nav-teams"> <li id="nav-teams">
<a href="/rowers/new_teams"> <a href="/rowers/analysis">
<i class="fas fa-bullhorn"></i>&nbsp;Teams <i class="fas fa-bullhorn"></i>&nbsp;Teams
</a> </a>
</li> </li>
@@ -235,16 +235,16 @@
<footer class="main-footer"> <footer class="main-footer">
<p>Follow us on <p>Follow us on
<a href=""> <a href="https://twitter.com/rowsandall">
<i class="fab fa-twitter"></i> <i class="fab fa-twitter"></i>
</a>&nbsp; </a>&nbsp;
<a href=""> <a href="https://www.instagram.com/roosendaalsander/">
<i class="fab fa-instagram"></i> <i class="fab fa-instagram"></i>
</a>&nbsp; </a>&nbsp;
<a href=""> <a href="https://analytics.rowsandall.com/">
<i class="fab fa-wordpress-simple"></i> <i class="fab fa-wordpress-simple"></i>
</a>&nbsp; </a>&nbsp;
<a href=""> <a href="https://www.facebook.com/rowsandall">
<i class="fab fa-facebook"></i> <i class="fab fa-facebook"></i>
</a>&nbsp; </a>&nbsp;
</p> </p>
@@ -254,16 +254,19 @@
<h1>Help</h1> <h1>Help</h1>
<ul> <ul>
<li> <li>
<a href="">Help</a> <a href="/rowers/help">Help</a>
</li> </li>
<li> <li>
<a href="">Rowing Analytics Blog</a> <a href="https://analytics.rowsandall.com/">
Rowing Analytics Blog
</a>
</li> </li>
<li> <li>
<a href="">Rowing Data Facebook Group</a> <a href="https://www.facebook.com/rowsandall">
Rowing Data Facebook Group</a>
</li> </li>
<li> <li>
<a href="">Rowing Physics</a> <a href="/rowers/physics">Rowing Physics</a>
</li> </li>
</ul> </ul>
</li> </li>
@@ -271,19 +274,19 @@
<h1>About</h1> <h1>About</h1>
<ul> <ul>
<li> <li>
<a href="">Contact</a> <a href="/rowers/email/">Contact</a>
</li> </li>
<li> <li>
<a href="">Rowsandall s.r.o.</a> <a href="/rowers/email/">Rowsandall s.r.o.</a>
</li> </li>
<li> <li>
<a href="">Brochure</a> <a href="/rowers/brochure">Brochure</a>
</li> </li>
<li> <li>
<a href="">Partnering?</a> <a href="/rowers/partners">Partnering?</a>
</li> </li>
<li> <li>
<a href="">Developers Info</a> <a href="/rowers/develop">Developers Info</a>
</li> </li>
</ul> </ul>
</li> </li>
@@ -291,7 +294,7 @@
<h1>Paid Plans</h1> <h1>Paid Plans</h1>
<ul> <ul>
<li> <li>
<a href="">Paid Plans</a> <a href="/rowers/promembership">Paid Plans</a>
</li> </li>
</ul> </ul>
</li> </li>
@@ -299,10 +302,10 @@
<h1>Legal</h1> <h1>Legal</h1>
<ul> <ul>
<li> <li>
<a href="">Terms and Conditions</a> <a href="/rowers/legal">Terms and Conditions</a>
</li> </li>
<li> <li>
<a href="">Privacy Policy</a> <a href="/rowers/legal">Privacy Policy</a>
</li> </li>
</ul> </ul>
</ul> </ul>