Private
Public Access
1
0

document upload

This commit is contained in:
Sander Roosendaal
2018-10-08 17:46:34 +02:00
parent e787204e79
commit b9ea9a0e59
3 changed files with 74 additions and 147 deletions

View File

@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "newbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
@@ -15,64 +15,65 @@
</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 Workout File</h1>
{% if user.is_authenticated and user|is_manager %}
<p>Looking for <a href="/rowers/workout/upload/team/">Team Manager
Upload?</a></p>
{% endif %}
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
{% block main %}
<div id="id_main">
<ul class="main-content">
<li class="grid_2">
<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">
<h1>Upload Workout File</h1>
{% if user.is_authenticated and user|is_manager %}
<p>Looking for <a href="/rowers/workout/upload/team/">Team Manager
Upload?</a></p>
{% endif %}
{% 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">
<h1>Optional extra actions</h1>
<p>
<table>
{{ optionsform.as_table }}
</table>
</p>
<p>
You can select one static plot to be generated immediately for
this workout. You can select to export to major fitness
platforms automatically.
If you check "make private", this workout will not be visible to your followers and will not show up in your teams' workouts list. With the Landing Page option, you can select to which (workout related) page you will be
taken after a successfull upload.
</p>
<p>
If you don't have a workout file but have written down the splits,
you can create a workout file yourself from <a href="/static/dummy_workout_template.xls">this template</a>
</p>
<p><b>Select Files with the File button or drag them on the marked area</b></p>
</div>
</form>
</div>
</li>
<li class="grid_2">
<h1>Optional extra actions</h1>
<p>
<table>
{{ optionsform.as_table }}
</table>
</p>
<p>
You can select one static plot to be generated immediately for
this workout. You can select to export to major fitness
platforms automatically.
If you check "make private", this workout will not be visible to your followers and will not show up in your teams' workouts list. With the Landing Page option, you can select to which (workout related) page you will be
taken after a successfull upload.
</p>
<p>
If you don't have a workout file but have written down the splits,
you can create a workout file yourself from <a href="/static/dummy_workout_template.xls">this template</a>
</p>
<p><b>Select Files with the File button or drag them on the marked area</b></p>
</li>
</form>
</ul>
</div>
{% endblock %}
{% block scripts %}
@@ -221,8 +222,8 @@ $('#id_workouttype').change();
console.log(value);
});
$("#id_drop-files").replaceWith(
'<div id="id_waiting"><img src="/static/img/rowingtimer.gif" width="120" height="100">'
$("#id_main").replaceWith(
'<div id="id_waiting"><img src="/static/img/rowingtimer.gif" width="120" height="100" style="width:120px">'
);
$.ajax({
data: data,
@@ -310,3 +311,8 @@ $('#id_workouttype').change();
};
</script>
{% endblock %}
{% block sidebar %}
{% include 'menu_workouts.html' %}
{% endblock %}

View File

@@ -9923,6 +9923,17 @@ def workout_upload_view(request,
r = getrower(request.user)
breadcrumbs = [
{
'url':'/rowers/list-workouts',
'name':'Workouts'
},
{
'url': reverse(workout_upload_view),
'name': 'Upload'
}
]
if 'uploadoptions' in request.session:
uploadoptions = request.session['uploadoptions']
try:
@@ -10280,6 +10291,8 @@ def workout_upload_view(request,
optionsform = UploadOptionsForm(initial=uploadoptions)
return render(request, 'document_form.html',
{'form':form,
'active':'nav-workouts',
'breadcrumbs':breadcrumbs,
'teams':get_my_teams(request.user),
'optionsform': optionsform,
})

View File

@@ -223,98 +223,6 @@
display: block;
}
main .cd-accordion-menu {
width: 100%;
max-width: 600px;
background: #27aae2;
padding-left: 30px;
padding-bottom: 0px;
}
main .cd-accordion-menu ul {
/* by default hide all sub menus */
display: none;
}
main .cd-accordion-menu li {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
main .cd-accordion-menu input[type=checkbox] {
/* hide native checkbox */
position: absolute;
opacity: 0;
}
main .cd-accordion-menu label,
main .cd-accordion-menu a {
position: relative;
display: block;
color: #fff;
}
main ul label:hover,
main ul ul label:hover,
main ul ul a:hover,
main ul ul ul label:hover,
main ul ul ul a:hover {
background: #1c74bb;
}
main .cd-accordion-menu a::before {
content: '\00a0';
width: 16px;
height: 16px;
display: inline-block;
font-size: inherit;
text-rendering: auto;
}
main .cd-accordion-menu label::before
{
/* icons */
font: normal normal normal 1.0em/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
content: '\f0da';
display: inline-block;
width: 16px;
height: 16px;
-webkit-transform: translateY(0%);
-moz-transform: translateY(0%);
-ms-transform: translateY(0%);
-o-transform: translateY(0%);
transform: translateY(0%);
}
main .cd-accordion-menu label {
cursor: pointer;
background: #27aae2;
}
main .cd-accordion-menu input[type=checkbox]:checked + label::before {
/* rotate arrow */
-webkit-transform: translateY(20%) rotate(90deg);
-moz-transform: translateY(20%) rotate(90deg);
-ms-transform: translateY(20%) rotate(90deg);
-o-transform: translateY(20%) rotate(90deg);
transform: translateY(20%) rotate(90deg);
}
main .cd-accordion-menu input[type=checkbox]:checked + label + ul,
main .cd-accordion-menu input[type=checkbox]:checked + label:nth-of-type(n) + ul {
/* use label:nth-of-type(n) to fix a bug on safari (<= 8.0.8) with multiple adjacent-sibling selectors*/
/* show children when item is checked */
display: block;
}
user ul {