Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2018-10-08 21:43:38 +02:00
parent f44ba139d8
commit add3f4167e
3 changed files with 51 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "newbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
@@ -15,36 +15,33 @@
</script>
{% endblock %}
{% block content %}
<div id="id_dropregion" class="grid_12 alpha watermark invisible">
<p>Drag and drop files here </p>
</div>
<div id="id_drop-files" class="grid_12 alpha drop-files">
<form id="file_form" enctype="multipart/form-data" action="{{ formloc }}" method="post">
<div id="left" class="grid_6 alpha">
<h1>Upload Image</h1>
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
{% block main %}
<h1>Upload Image</h1>
<ul class="main-content">
<li class="grid_4">
<div id="id_dropregion" class="watermark invisible">
<p>Drag and drop files here </p>
</div>
<div id="id_drop-files" class="drop-files">
<form id="file_form" enctype="multipart/form-data" action="{{ formloc }}" method="post">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
{% endif %}
<table>
{{ form.as_table }}
{{ form.as_table }}
</table>
{% csrf_token %}
<div id="formbutton" class="grid_1 prefix_4 suffix_1">
<input class="button green" type="submit" value="Submit">
</div>
</div>
<div id="right" class="grid_6 omega">
&nbsp;
</div>
</form>
<p>
<input class="button green" type="submit" value="Submit">
</p>
</form>
</div>
</li>
</ul>
{% endblock %}
{% block scripts %}
@@ -169,7 +166,7 @@
});
$("#id_drop-files").replaceWith(
'<div id="id_waiting"><img src="/static/img/rowingtimer.gif" width="120" height="100">'
'<div id="id_waiting"><img src="/static/img/rowingtimer.gif" width="120" height="100" style="width:120px">'
);
$.ajax({
data: data,
@@ -250,3 +247,7 @@
</script>
{% endblock %}
{% block sidebar %}
{% include 'menu_workout.html' %}
{% endblock %}

View File

@@ -102,6 +102,11 @@
</a>
</li>
{% endif %}
<li id="chart-image">
<a href="/rowers/workout/{{ workout.id }}/image">
<i class="fas fa-file-image fa-fw"></i>&nbsp;Upload Image
</a>
</li>
</ul>
</li>
<li class="has-children" id="export">

View File

@@ -9275,6 +9275,22 @@ def workout_uploadimage_view(request,id):
w = get_workout(id)
breadcrumbs = [
{
'url':'/rowers/list-workouts',
'name':'Workouts'
},
{
'url':get_workout_default_page(request,id),
'name': str(w.id)
},
{
'url':reverse(workout_uploadimage_view,kwargs={'id':id}),
'name': 'Upload Image'
}
]
if not checkworkoutuser(request.user,w):
raise PermissionDenied("You are not allowed to edit this workout")
@@ -9342,6 +9358,9 @@ def workout_uploadimage_view(request,id):
form = ImageForm()
return render(request,'image_form.html',
{'form':form,
'rower':r,
'active':'nav-active',
'breadcrumbs':breadcrumbs,
'teams':get_my_teams(request.user),
'workout': w,
})