able to load scripts but cannot get them to go to the right place
Work in progress
This commit is contained in:
@@ -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,20 @@
|
|||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% include "monitorjobs.html" %}
|
{% include "monitorjobs.html" %}
|
||||||
|
<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');
|
||||||
|
$.each(json, function(index, element) {
|
||||||
|
console.log('adding thumbnail');
|
||||||
|
$("#id_thumbs").append(element.div);
|
||||||
|
$("#id_thumbscripts").append(element.script);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
14
rowers/templates/workflow_snippet.html
Normal file
14
rowers/templates/workflow_snippet.html
Normal file
@@ -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),
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user