diff --git a/rowers/templates/.#image_form.html b/rowers/templates/.#image_form.html deleted file mode 100644 index 7ae08c3c..00000000 --- a/rowers/templates/.#image_form.html +++ /dev/null @@ -1 +0,0 @@ -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 32f7c725..0a77e5d2 100644 --- a/rowers/templates/image_form.html +++ b/rowers/templates/image_form.html @@ -162,6 +162,42 @@ }); }); + 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({