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 staticfiles %}
{% load rowerfilters %} {% load rowerfilters %}
@@ -15,14 +15,16 @@
</script> </script>
{% endblock %} {% endblock %}
{% block content %} {% block main %}
<div id="id_dropregion" class="grid_12 alpha watermark invisible"> <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> <p>Drag and drop files here </p>
</div> </div>
<div id="id_drop-files" class="grid_12 alpha drop-files"> <div id="id_drop-files" class="drop-files">
<form id="file_form" enctype="multipart/form-data" action="{{ formloc }}" method="post"> <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 %} {% if form.errors %}
<p style="color: red;"> <p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below. Please correct the error{{ form.errors|pluralize }} below.
@@ -33,18 +35,13 @@
{{ form.as_table }} {{ form.as_table }}
</table> </table>
{% csrf_token %} {% csrf_token %}
<div id="formbutton" class="grid_1 prefix_4 suffix_1"> <p>
<input class="button green" type="submit" value="Submit"> <input class="button green" type="submit" value="Submit">
</div> </p>
</div>
<div id="right" class="grid_6 omega">
&nbsp;
</div>
</form> </form>
</div> </div>
</li>
</ul>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
@@ -169,7 +166,7 @@
}); });
$("#id_drop-files").replaceWith( $("#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({ $.ajax({
data: data, data: data,
@@ -250,3 +247,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block sidebar %}
{% include 'menu_workout.html' %}
{% endblock %}

View File

@@ -102,6 +102,11 @@
</a> </a>
</li> </li>
{% endif %} {% 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> </ul>
</li> </li>
<li class="has-children" id="export"> <li class="has-children" id="export">

View File

@@ -9275,6 +9275,22 @@ def workout_uploadimage_view(request,id):
w = get_workout(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): if not checkworkoutuser(request.user,w):
raise PermissionDenied("You are not allowed to edit this workout") raise PermissionDenied("You are not allowed to edit this workout")
@@ -9342,6 +9358,9 @@ def workout_uploadimage_view(request,id):
form = ImageForm() form = ImageForm()
return render(request,'image_form.html', return render(request,'image_form.html',
{'form':form, {'form':form,
'rower':r,
'active':'nav-active',
'breadcrumbs':breadcrumbs,
'teams':get_my_teams(request.user), 'teams':get_my_teams(request.user),
'workout': w, 'workout': w,
}) })