Merge branch 'feature/loadthumbnails' into develop
This commit is contained in:
@@ -15,12 +15,28 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#id_file').on('change', function(evt) {
|
$('#id_file').on('change', function(evt) {
|
||||||
var f = this.files[0];
|
var f = this.files[0];
|
||||||
|
var istcx = false;
|
||||||
|
var isgzip = false;
|
||||||
|
var size1 = 10485760;
|
||||||
|
var size2 = 1048576;
|
||||||
|
if ((/\.(tcx|TCX)/i).test(f.name)) {
|
||||||
|
istcx = true;
|
||||||
|
console.log('tcx');
|
||||||
|
if ((/\.(gz|GZ)/i).test(f.name)) {
|
||||||
|
isgzip = true;
|
||||||
|
console.log('gzip');
|
||||||
|
size1 /= 5;
|
||||||
|
size2 /= 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
console.log(f);
|
console.log(f);
|
||||||
if (f.size > 4194304) {
|
console.log(size1)
|
||||||
alert("File Size must be smaller than 4 MB");
|
console.log(size2)
|
||||||
|
if (f.size > size1) {
|
||||||
|
alert("File Size must be smaller than 10 MB");
|
||||||
this.value = null;
|
this.value = null;
|
||||||
}
|
}
|
||||||
if (f.size > 1048576) {
|
if (f.size > size2) {
|
||||||
$('#id_offline').val('True');
|
$('#id_offline').val('True');
|
||||||
$('#id_offline').prop('checked','True');
|
$('#id_offline').prop('checked','True');
|
||||||
console.log("Set offline to True");
|
console.log("Set offline to True");
|
||||||
|
|||||||
@@ -1,17 +1,10 @@
|
|||||||
{% if charts %}
|
|
||||||
|
|
||||||
<h2>Flex Charts</h2>
|
<h2>Flex Charts</h2>
|
||||||
<p>Click on the thumbnails to view the full chart.</p>
|
<p>Click on the thumbnails to view the full chart.</p>
|
||||||
{% for chart in charts %}
|
<div id="id_thumbscripts">
|
||||||
<div class="grid_3 alpha">
|
|
||||||
<big>{{ forloop.counter }}</big>
|
</div>
|
||||||
<div class="grid_3 tooltip">
|
<div id="id_thumbs">
|
||||||
<a href="/rowers/workout/{{ workout.id }}/flexchart?favoritechart={{ forloop.counter |add:"-1" }}">
|
|
||||||
{{ chart.div | safe }}
|
</div>
|
||||||
</a>
|
|
||||||
{% if rower.showfavoritechartnotes %}
|
|
||||||
<span class="tooltiptext">{{ chart.notes }}</span>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|||||||
@@ -25,6 +25,43 @@
|
|||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% include "monitorjobs.html" %}
|
{% include "monitorjobs.html" %}
|
||||||
|
<script>
|
||||||
|
$(function($) {
|
||||||
|
console.log('loading script');
|
||||||
|
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');
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{% for chart in charts %}
|
||||||
|
<div class="grid_3 alpha">
|
||||||
|
<big>{{ forloop.counter }}</big>
|
||||||
|
<div class="grid_3 tooltip">
|
||||||
|
<a href="/rowers/workout/{{ workout.id }}/flexchart?favoritechart={{ forloop.counter |add:"-1" }}">
|
||||||
|
{{ chart.div | safe }}
|
||||||
|
</a>
|
||||||
|
{% if rower.showfavoritechartnotes %}
|
||||||
|
<span class="tooltiptext">{{ chart.notes }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
@@ -190,6 +190,7 @@ urlpatterns = [
|
|||||||
url(r'^graph/(?P<id>\d+)/deleteconfirm$',views.graph_delete_confirm_view),
|
url(r'^graph/(?P<id>\d+)/deleteconfirm$',views.graph_delete_confirm_view),
|
||||||
url(r'^graph/(?P<id>\d+)/delete$',views.graph_delete_view),
|
url(r'^graph/(?P<id>\d+)/delete$',views.graph_delete_view),
|
||||||
url(r'^workout/(?P<id>\d+)/get-thumbnails$',views.get_thumbnails),
|
url(r'^workout/(?P<id>\d+)/get-thumbnails$',views.get_thumbnails),
|
||||||
|
url(r'^workout/(?P<id>\d+)/get-testscript$',views.get_testscript),
|
||||||
url(r'^workout/upload/team/$',views.team_workout_upload_view),
|
url(r'^workout/upload/team/$',views.team_workout_upload_view),
|
||||||
url(r'^workout/upload/$',views.workout_upload_view,name='workout_upload_view'),
|
url(r'^workout/upload/$',views.workout_upload_view,name='workout_upload_view'),
|
||||||
url(r'^workout/(?P<id>\d+)/histo$',views.workout_histo_view),
|
url(r'^workout/(?P<id>\d+)/histo$',views.workout_histo_view),
|
||||||
|
|||||||
+31
-4
@@ -515,6 +515,33 @@ def get_thumbnails(request,id):
|
|||||||
|
|
||||||
return JSONResponse(charts)
|
return JSONResponse(charts)
|
||||||
|
|
||||||
|
@login_required()
|
||||||
|
def get_testscript(request,id):
|
||||||
|
try:
|
||||||
|
row = Workout.objects.get(id=id)
|
||||||
|
except Workout.DoesNotExist:
|
||||||
|
raise Http404("Workout doesn't exist")
|
||||||
|
if (checkworkoutuser(request.user,row)==False):
|
||||||
|
raise Http404("You are not allowed to edit this workout")
|
||||||
|
|
||||||
|
r = getrower(request.user)
|
||||||
|
|
||||||
|
object = {
|
||||||
|
"script":"""
|
||||||
|
<div id="id_script">
|
||||||
|
<script>alert("hi")</script>
|
||||||
|
</div>
|
||||||
|
""",
|
||||||
|
"div":"""
|
||||||
|
<div id="id_div">
|
||||||
|
Hoi
|
||||||
|
</div>
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return JSONResponse([object,object])
|
||||||
|
|
||||||
@login_required()
|
@login_required()
|
||||||
def session_jobs_view(request):
|
def session_jobs_view(request):
|
||||||
taskstatus = get_stored_tasks_status(request)
|
taskstatus = get_stored_tasks_status(request)
|
||||||
@@ -6648,10 +6675,10 @@ def workout_workflow_view(request,id):
|
|||||||
|
|
||||||
charts = []
|
charts = []
|
||||||
|
|
||||||
if favorites and 'flexthumbnails.html' in r.workflowmiddlepanel:
|
# if favorites and 'flexthumbnails.html' in r.workflowmiddlepanel:
|
||||||
charts = thumbnails_set(r,id,favorites)
|
# charts = thumbnails_set(r,id,favorites)
|
||||||
if charts[0]['script'] == '':
|
# if charts[0]['script'] == '':
|
||||||
charts = []
|
# charts = []
|
||||||
|
|
||||||
if 'panel_map.html' in r.workflowmiddlepanel and rowhascoordinates(row):
|
if 'panel_map.html' in r.workflowmiddlepanel and rowhascoordinates(row):
|
||||||
rowdata = rdata(row.csvfilename)
|
rowdata = rdata(row.csvfilename)
|
||||||
|
|||||||
Reference in New Issue
Block a user