map view
This commit is contained in:
1
rowers/.#urls.py
Normal file
1
rowers/.#urls.py
Normal file
@@ -0,0 +1 @@
|
||||
E408191@CZ27LT9RCGN72.11300:1539016748
|
||||
@@ -230,7 +230,7 @@ xo
|
||||
{% 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
|
||||
<a class="small" href="/rowers/workout/{{ workout.id }}/delete">Delete
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "newbase.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block title %}{{ workout.name }} {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% block main %}
|
||||
|
||||
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
||||
<script async="true" type="text/javascript">
|
||||
@@ -12,58 +12,24 @@
|
||||
</script>
|
||||
|
||||
|
||||
<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, false, false);
|
||||
};
|
||||
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, #mymap {height: 100%; margin:5px;}
|
||||
</style>
|
||||
<h1>{{ workout.name }}</h1>
|
||||
|
||||
<ul class="main-content">
|
||||
|
||||
<div id="workouts" class="grid_12 alpha">
|
||||
|
||||
|
||||
|
||||
{% if user.is_authenticated and mayedit %}
|
||||
<div class="grid_2 alpha">
|
||||
<p>
|
||||
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/edit">Edit Workout</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid_2">
|
||||
<p>
|
||||
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/workflow">Workflow View</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<p>
|
||||
<a class="button gray small" href="/rowers/workout/{{ workout.id }}/advanced">Advanced Edit</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="height:100%;" id="theplot" class="grid_12 alpha flexplot">
|
||||
<li class="grid_4">
|
||||
<div style="height:100%;" id="theplot" class="flexplot mapdiv">
|
||||
{{ mapdiv|safe }}
|
||||
|
||||
|
||||
{{ mapscript|safe }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_workout.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
<i class="fas fa-chart-line fa-fw"></i> Flex Chart
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-map">
|
||||
<a href="/rowers/workout/{{ workout.id }}/map">
|
||||
<i class="fas fa-map-marked-alt fa-fw"></i> Map
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-children" id="chart">
|
||||
|
||||
@@ -9080,11 +9080,28 @@ def workout_map_view(request,id=0):
|
||||
request.session[translation.LANGUAGE_SESSION_KEY] = USER_LANGUAGE
|
||||
request.session['referer'] = absolute(request)['PATH']
|
||||
|
||||
row = get_workout(id)
|
||||
w = get_workout(id)
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/list-workouts',
|
||||
'name':'Workouts'
|
||||
},
|
||||
{
|
||||
'url':get_workout_default_page(request,id),
|
||||
'name': str(w.id)
|
||||
},
|
||||
{
|
||||
'url':reverse(workout_map_view,kwargs={'id':id}),
|
||||
'name': 'Map'
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
|
||||
# create interactive plot
|
||||
f1 = row.csvfilename
|
||||
u = row.user.user
|
||||
f1 = w.csvfilename
|
||||
u = w.user.user
|
||||
r = getrower(u)
|
||||
rowdata = rdata(f1)
|
||||
hascoordinates = 1
|
||||
@@ -9103,7 +9120,7 @@ def workout_map_view(request,id=0):
|
||||
if hascoordinates:
|
||||
mapscript,mapdiv = leaflet_chart2(rowdata.df[' latitude'],
|
||||
rowdata.df[' longitude'],
|
||||
row.name)
|
||||
w.name)
|
||||
else:
|
||||
mapscript = ""
|
||||
mapdiv = ""
|
||||
@@ -9114,12 +9131,15 @@ def workout_map_view(request,id=0):
|
||||
result = request.user.is_authenticated() and ispromember(request.user)
|
||||
if result:
|
||||
promember=1
|
||||
if request.user == row.user.user:
|
||||
if request.user == w.user.user:
|
||||
mayedit=1
|
||||
|
||||
return render(request, 'map_view.html',
|
||||
{'mapscript':mapscript,
|
||||
'workout':row,
|
||||
'workout':w,
|
||||
'rower':r,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'active':'nav-workouts',
|
||||
'mapdiv':mapdiv,
|
||||
'mayedit':mayedit,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user