Private
Public Access
1
0

loads thumbnails asynchronously

loads thumbnails on workflow view asynchronously using jQuery and Ajax
This commit is contained in:
Sander Roosendaal
2017-11-04 20:28:58 +01:00
parent 80f4ca585b
commit 7fd17fb3b4
2 changed files with 30 additions and 7 deletions

View File

@@ -28,12 +28,35 @@
<script>
$(function($) {
console.log('loading script');
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/workout/{{ workout.id }}/get-testscript', function(json) {
console.log('script loaded');
var workoutid = {{ workout.id }};
var shownotes = true;
if("{{ rower.showfavoritechartnotes }}" == "False") {
shownotes = false;
}
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/workout/{{ workout.id }}/get-thumbnails', function(json) {
var counter=0;
$.each(json, function(index, element) {
console.log('adding thumbnail');
$("#id_thumbs").append(element.div);
var counter2 = counter+1;
if (shownotes) {
$("#id_thumbs").append(
"<div class=\"grid_3 alpha\">"+
"<big>"+counter2+"</big>"+
"<div class=\"grid_3 tooltip\">"+
"<a href=\"/rowers/workout/"+workoutid+"/flexchart?favoritechart="+counter+"\">"+element.div+"</a>"+
"<span class=\"tooltiptext\">"+element.notes+"</span>"+
"</div></div>");
} else {
$("#id_thumbs").append(
"<div class=\"grid_3 alpha\">"+
"<big>"+counter2+"</big>"+
"<div class=\"grid_3 tooltip\">"+
"<a href=\"/rowers/workout/"+workoutid+"/flexchart?favoritechart="+counter+"\">"+element.div+"</a>"+
"</div></div>");
}
$("#id_thumbscripts").append(element.script);
counter += 1;
});
});
});

View File

@@ -6675,10 +6675,10 @@ def workout_workflow_view(request,id):
charts = []
if favorites and 'flexthumbnails.html' in r.workflowmiddlepanel:
charts = thumbnails_set(r,id,favorites)
if charts[0]['script'] == '':
charts = []
# if favorites and 'flexthumbnails.html' in r.workflowmiddlepanel:
# charts = thumbnails_set(r,id,favorites)
# if charts[0]['script'] == '':
# charts = []
if 'panel_map.html' in r.workflowmiddlepanel and rowhascoordinates(row):
rowdata = rdata(row.csvfilename)