added image attach buttons to edit and workflow
This commit is contained in:
1
rowers/templates/.#image_form.html
Normal file
1
rowers/templates/.#image_form.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
E408191@CZ27LT9RCGN72.1800:1516641451
|
||||||
@@ -162,42 +162,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.submit(function() {
|
|
||||||
console.log("Form submission");
|
|
||||||
$(data.values()).each(function(value) {
|
|
||||||
console.log(value);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#id_drop-files").replaceWith(
|
|
||||||
'<div id="id_waiting"><img src="/static/img/ajax_loader_blue_350.gif" width="120" height="100">'
|
|
||||||
);
|
|
||||||
$.ajax({
|
|
||||||
data: data,
|
|
||||||
type: $(this).attr('method'),
|
|
||||||
url: '/rowers/workout/{{ workout.id }}/image',
|
|
||||||
contentType: false,
|
|
||||||
processData: false,
|
|
||||||
error: function(result) {
|
|
||||||
$("#id_waiting").replaceWith(
|
|
||||||
'<div id="id_failed" class="grid_12 alpha message">Your upload failed</div>'
|
|
||||||
);
|
|
||||||
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({
|
$('#id_drop-files').bind({
|
||||||
|
|||||||
5
rowers/templates/panel_uploadimage.html
Normal file
5
rowers/templates/panel_uploadimage.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<div class="grid_2 alpha">
|
||||||
|
<p>
|
||||||
|
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/image">Attach Image</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
@@ -137,8 +137,12 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
|
<div class="grid_2 alpha">
|
||||||
<div class="grid_2 prefix_4 alpha">
|
<p>
|
||||||
|
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/image">Attach Image</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="grid_2 prefix_2 omega">
|
||||||
<p>
|
<p>
|
||||||
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/addpowerpiechart">Power Pie Chart</a>
|
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/addpowerpiechart">Power Pie Chart</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ workflowleftpanel = (
|
|||||||
('panel_stats.html','Workout Statistics Button'),
|
('panel_stats.html','Workout Statistics Button'),
|
||||||
('panel_flexchart.html','Flex Chart'),
|
('panel_flexchart.html','Flex Chart'),
|
||||||
('panel_staticchart.html','Create Static Charts Buttons'),
|
('panel_staticchart.html','Create Static Charts Buttons'),
|
||||||
|
('panel_uploadimage.html','Attach Image'),
|
||||||
('panel_geekyheader.html','Geeky Header'),
|
('panel_geekyheader.html','Geeky Header'),
|
||||||
('panel_editwind.html','Edit Wind Data'),
|
('panel_editwind.html','Edit Wind Data'),
|
||||||
('panel_editstream.html','Edit Stream Data'),
|
('panel_editstream.html','Edit Stream Data'),
|
||||||
@@ -57,6 +58,7 @@ defaultleft = [
|
|||||||
'panel_editintervals.html',
|
'panel_editintervals.html',
|
||||||
'panel_stats.html',
|
'panel_stats.html',
|
||||||
'panel_staticchart.html',
|
'panel_staticchart.html',
|
||||||
|
'panel_uploadimage.html',
|
||||||
]
|
]
|
||||||
|
|
||||||
coxes_calls = [
|
coxes_calls = [
|
||||||
@@ -65,6 +67,9 @@ coxes_calls = [
|
|||||||
"Almost there. Give me ten strokes on the legs!",
|
"Almost there. Give me ten strokes on the legs!",
|
||||||
"Let it run!",
|
"Let it run!",
|
||||||
"Don't rush the slides!",
|
"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.",
|
"We're going for the line now. Power ten on the next.",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -8894,9 +8894,13 @@ def workout_uploadimage_view(request,id):
|
|||||||
filename = path_and_filename,
|
filename = path_and_filename,
|
||||||
width=width,height=height)
|
width=width,height=height)
|
||||||
i.save()
|
i.save()
|
||||||
|
|
||||||
url = reverse(r.defaultlandingpage,
|
url = reverse(r.defaultlandingpage,
|
||||||
kwargs = {'id':id})
|
kwargs = {'id':id})
|
||||||
return HttpResponseRedirect(url)
|
if is_ajax:
|
||||||
|
return JSONResponse({'result':1,'url':0})
|
||||||
|
else:
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
messages.error(request,'Something went wrong - no file attached')
|
messages.error(request,'Something went wrong - no file attached')
|
||||||
url = reverse(workout_uploadimage_view,
|
url = reverse(workout_uploadimage_view,
|
||||||
|
|||||||
Reference in New Issue
Block a user