first cut at list_workouts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "newbase.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
@@ -41,65 +41,55 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% block main %}
|
||||
<style>
|
||||
#mypointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="grid_12">
|
||||
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
{% if team %}
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
<p>
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2 alpha">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
||||
</div>
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
<div class="grid_2 dropdown">
|
||||
<button class="grid_2 alpha button green small dropbtn">
|
||||
{{ rower.user.first_name }} {{ rower.user.last_name }}
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
{% for member in user|team_members %}
|
||||
<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>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{% if team %}
|
||||
<div class="grid_12 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id team=team %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="grid_12">
|
||||
|
||||
<div id="workouts_table" class="grid_8 alpha">
|
||||
<input name='daterange' type="submit" value="Submit">
|
||||
</form>
|
||||
</p>
|
||||
{% if team %}
|
||||
<p>
|
||||
<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 %}
|
||||
<input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search">
|
||||
<input type="submit">
|
||||
</input>
|
||||
</form>
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<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");
|
||||
</script>
|
||||
|
||||
{{ interactiveplot |safe }}
|
||||
|
||||
{{ the_div |safe }}
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
{% if team %}
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
{% else %}
|
||||
<h3>Workouts of {{ rower.user.first_name }} {{ rower.user.last_name }}</h3>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if workouts %}
|
||||
<table width="100%" class="listtable shortpadded">
|
||||
<thead>
|
||||
@@ -122,7 +112,7 @@
|
||||
</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for workout in workouts %}
|
||||
{% if workout.rankingpiece %}
|
||||
@@ -140,8 +130,8 @@
|
||||
</td>
|
||||
<td> {{ workout.date|date:"Y-m-d" }} </td>
|
||||
<td> {{ workout.starttime|date:"H:i" }} </td>
|
||||
{% if workout.user.user == user or user == team.manager %}
|
||||
{% if workout.name != '' %}
|
||||
{% if workout.user.user == user or user == team.manager %}
|
||||
{% if workout.name != '' %}
|
||||
<td>
|
||||
<a href={% url rower.defaultlandingpage id=workout.id %}>
|
||||
{{ workout.name }}
|
||||
@@ -170,17 +160,17 @@
|
||||
</td>
|
||||
{% else %}
|
||||
<td colspan="2">
|
||||
<a class="small" href="/rowers/{{ workout.user.id }}/list-workouts">
|
||||
{{ workout.user.user.first_name }}
|
||||
{{ workout.user.user.last_name }}
|
||||
</a>
|
||||
<a class="small" href="/rowers/{{ workout.user.id }}/list-workouts">
|
||||
{{ workout.user.user.first_name }}
|
||||
{{ workout.user.user.last_name }}
|
||||
</a>
|
||||
</td>
|
||||
{% endif %}
|
||||
<td> <a class="small" href="/rowers/workout/{{ workout.id }}/flexchart">Flex</a> </td>
|
||||
<td>
|
||||
<a class="small" href="/rowers/workout/{{ workout.id }}/deleteconfirm">Delete
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
@@ -189,140 +179,77 @@
|
||||
{% else %}
|
||||
<p> No workouts found </p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="grid_4 omega">
|
||||
{% if team %}
|
||||
<div class="grid_4" id="teambuttons">
|
||||
<div class="grid_3 alpha">
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</li>
|
||||
{% if announcements %}
|
||||
<li class="grid_4">
|
||||
<h2>What's New?</h2>
|
||||
</li>
|
||||
{% for a in announcements %}
|
||||
<li>
|
||||
<div class="site-announcement-box">
|
||||
<div class="site-announcement">
|
||||
<i>{{ a.created }}:</i>
|
||||
{{ a.announcement|urlize }}
|
||||
</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 %}
|
||||
<div class="grid_4" id="interactiveplot">
|
||||
<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");
|
||||
</script>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
{% if user|is_promember %}
|
||||
<a href="/rowers/workouts-join-select">Glue Workouts</a>
|
||||
{% 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 }}"><</a>
|
||||
{% else %}
|
||||
<a class="wh" href="?page={{ workouts.previous_page_number }}"><</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{{ interactiveplot |safe }}
|
||||
|
||||
<script>
|
||||
// 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.
|
||||
var plot_resize_setup = function () {
|
||||
var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot
|
||||
var plot = Bokeh.index[plotid];
|
||||
var plotresizer = function() {
|
||||
// arguments: use width, use height, maintain aspect ratio
|
||||
plot.resize_width_height(true, true, true);
|
||||
};
|
||||
window.addEventListener('resize', plotresizer);
|
||||
plotresizer();
|
||||
};
|
||||
window.addEventListener('load', plot_resize_setup);
|
||||
</script>
|
||||
<style>
|
||||
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
||||
html, body {height: 100%; margin:5px;}
|
||||
</style>
|
||||
{{ 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>
|
||||
<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 }}">></a>
|
||||
{% else %}
|
||||
<a class="wh" href="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}?page={{ workouts.next_page_number }}">></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
<button class="dropbtn">
|
||||
{{ rower.user.first_name }} {{ rower.user.last_name }}
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
{% for member in user|team_members %}
|
||||
<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>
|
||||
{% endfor %}
|
||||
<p> </p>
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid_4" id="about">
|
||||
<h3>About</h3>
|
||||
<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/">© 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> </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 }}"><</a>
|
||||
{% else %}
|
||||
<a class="wh" href="?page={{ workouts.previous_page_number }}"><</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 }}">></a>
|
||||
{% else %}
|
||||
<a class="wh" href="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}?page={{ workouts.next_page_number }}">></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_workouts.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -6469,6 +6469,7 @@ def workouts_view(request,message='',successmessage='',
|
||||
|
||||
return render(request, 'list_workouts.html',
|
||||
{'workouts': workouts,
|
||||
'active': 'nav-workouts',
|
||||
'rower':r,
|
||||
'dateform':dateform,
|
||||
'startdate':startdate,
|
||||
|
||||
Reference in New Issue
Block a user