Private
Public Access
1
0

share a graph facebook

This commit is contained in:
Sander Roosendaal
2017-10-08 12:45:37 +02:00
parent c4ba492c51
commit 739f0889f6
3 changed files with 49 additions and 3 deletions

View File

@@ -1,8 +1,16 @@
{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block title %}{{ workout.name }}{% endblock %}
{% block og_title %}{{ workout.name }} {% endblock %}
{% block description %}{{ workout.name }}
{{ workout.date }} - {{ workout.distance }}m - {{ workout.duration |durationprint:"%H:%M:%S.%f" }}{% endblock %}
{% block og_description %}{{ workout.name }}
{{ workout.date }} - {{ workout.distance }}m - {{ workout.duration |durationprint:"%H:%M:%S.%f" }}{% endblock %}
{% block og_image %}
<meta property="og:image" content="http://rowsandall.com/{{ graph.filename }}" />
{% endblock %}
{% block content %}
<h1>{{ workout.name }}</h1>

View File

@@ -66,6 +66,12 @@
</pre>
</p>
{{ mapdiv|safe }}
{{ mapscript|safe }}
</div>
<div id="images" class="grid_6 omega">

View File

@@ -4598,7 +4598,35 @@ def workout_view(request,id=0):
res = interactive_chart(id)
script = res[0]
div = res[1]
# create map
f1 = row.csvfilename
u = row.user.user
r = getrower(u)
rowdata = rdata(f1)
hascoordinates = 1
if rowdata != 0:
try:
latitude = rowdata.df[' latitude']
if not latitude.std():
hascoordinates = 0
except KeyError,AttributeError:
hascoordinates = 0
else:
hascoordinates = 0
if hascoordinates:
mapscript,mapdiv = leaflet_chart(rowdata.df[' latitude'],
rowdata.df[' longitude'],
row.name)
else:
mapscript = ""
mapdiv = ""
# render page
if (len(g)<=3):
@@ -4609,6 +4637,8 @@ def workout_view(request,id=0):
'first_name':u.first_name,
'interactiveplot':script,
'aantalcomments':aantalcomments,
'mapscript':mapscript,
'mapdiv':mapdiv,
'teams':get_my_teams(request.user),
'the_div':div})
else:
@@ -4620,6 +4650,8 @@ def workout_view(request,id=0):
'first_name':u.first_name,
'teams':get_my_teams(request.user),
'aantalcomments':aantalcomments,
'mapscript':mapscript,
'mapdiv':mapdiv,
'interactiveplot':script,
'the_div':div})