diff --git a/rowers/templates/.#image_form.html b/rowers/templates/.#image_form.html new file mode 100644 index 00000000..7ae08c3c --- /dev/null +++ b/rowers/templates/.#image_form.html @@ -0,0 +1 @@ +E408191@CZ27LT9RCGN72.1800:1516641451 \ No newline at end of file diff --git a/rowers/templates/image_form.html b/rowers/templates/image_form.html index 0a77e5d2..32f7c725 100644 --- a/rowers/templates/image_form.html +++ b/rowers/templates/image_form.html @@ -162,42 +162,6 @@ }); }); - frm.submit(function() { - console.log("Form submission"); - $(data.values()).each(function(value) { - console.log(value); - }); - - $("#id_drop-files").replaceWith( - '
' - ); - $.ajax({ - data: data, - type: $(this).attr('method'), - url: '/rowers/workout/{{ workout.id }}/image', - contentType: false, - processData: false, - error: function(result) { - $("#id_waiting").replaceWith( - '
Your upload failed
' - ); - setTimeout(function() { - location.reload(); - },1000); - }, - success: function(result) { - console.log('got something back'); - console.log(result); - if (result.result == 1) { - window.location.href = result.url; - } else { - console.log(result," reloading"); - location.reload(); - }; - } - }); - return false; - }); $('#id_drop-files').bind({ diff --git a/rowers/templates/panel_uploadimage.html b/rowers/templates/panel_uploadimage.html new file mode 100644 index 00000000..f99652cc --- /dev/null +++ b/rowers/templates/panel_uploadimage.html @@ -0,0 +1,5 @@ +
+

+ Attach Image +

+
diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index d4e2985b..e0f87339 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -137,8 +137,12 @@

- -
+
+

+ Attach Image +

+
+

Power Pie Chart

diff --git a/rowers/utils.py b/rowers/utils.py index 300e95fa..108a670a 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -42,6 +42,7 @@ workflowleftpanel = ( ('panel_stats.html','Workout Statistics Button'), ('panel_flexchart.html','Flex Chart'), ('panel_staticchart.html','Create Static Charts Buttons'), + ('panel_uploadimage.html','Attach Image'), ('panel_geekyheader.html','Geeky Header'), ('panel_editwind.html','Edit Wind Data'), ('panel_editstream.html','Edit Stream Data'), @@ -57,6 +58,7 @@ defaultleft = [ 'panel_editintervals.html', 'panel_stats.html', 'panel_staticchart.html', + 'panel_uploadimage.html', ] coxes_calls = [ @@ -65,6 +67,9 @@ coxes_calls = [ "Almost there. Give me ten strokes on the legs!", "Let it run!", "Don't rush the slides!", + "Quick hands.", + "You are clearing the puddles.", + "Let's push through now. Get me that open water.", "We're going for the line now. Power ten on the next.", ] diff --git a/rowers/views.py b/rowers/views.py index 0429ecda..eabc67fe 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -8894,9 +8894,13 @@ def workout_uploadimage_view(request,id): filename = path_and_filename, width=width,height=height) i.save() + url = reverse(r.defaultlandingpage, kwargs = {'id':id}) - return HttpResponseRedirect(url) + if is_ajax: + return JSONResponse({'result':1,'url':0}) + else: + return HttpResponseRedirect(url) else: messages.error(request,'Something went wrong - no file attached') url = reverse(workout_uploadimage_view,