Private
Public Access
1
0

fixes for coach trial

This commit is contained in:
Sander Roosendaal
2022-09-04 17:53:16 +02:00
parent 936a524804
commit 86890a8a73
15 changed files with 97 additions and 54 deletions

View File

@@ -25,7 +25,7 @@
<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 %}
{% if user.is_authenticated and user|coach_rowers %}
<p>Looking for <a href="/rowers/workout/upload/team/">Team Manager
Upload?</a></p>
{% endif %}
@@ -50,7 +50,7 @@
<p>
<table>
{{ optionsform.as_table }}
</table>
</p>
<p>
@@ -60,7 +60,7 @@
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>
@@ -68,7 +68,7 @@
<p><b>Select Files with the File button or drag them on the marked area</b></p>
</li>
@@ -91,16 +91,16 @@ $( document ).ready(function() {
|| $(this).val() == 'churchboat'
) {
$('#id_boattype').toggle(true);
} else {
} else {
$('#id_boattype').toggle(false);
$('#id_boattype').val('1x');
$('#id_boattype').val('1x');
}
});
$('#id_workouttype').change();
$('#id_workouttype').change();
});
</script>
<script>
var td = new FormData();
var formdatasetok = false;
@@ -117,13 +117,13 @@ $('#id_workouttype').change();
if (!formdatasetok) {
$("#id_dropregion").remove();
}
if (formdatasetok) {
$(document).ready(function() {
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
console.log("CSRF token",csrftoken);
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
@@ -141,11 +141,11 @@ $('#id_workouttype').change();
$(window).on('dragenter', function() {
$("#id_drop-files").css("background-color","#E9E9E4");
$("#id_dropregion").addClass("watermark").removeClass("invisible");})
$(window).on('dragleave', function() {
$("#id_drop-files").css("background-color","#FFFFFF");
$("#id_dropregion").removeClass("watermark").addClass("invisible");})
var frm = $("#file_form");
if( window.FormData === undefined ) {
@@ -154,7 +154,7 @@ $('#id_workouttype').change();
} else {
console.log('we have formdata');
}
var data = new FormData(frm[0]);
$('#id_file').on('change', function(evt) {
@@ -187,11 +187,11 @@ $('#id_workouttype').change();
data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked'));
console.log("Set offline to True");
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.');
$('#extra_message').addClass('message');
$('#extra_message').addClass('message');
}
}
});
});
$('input').each(function( i ) {
$(this).change(function() {
@@ -211,8 +211,8 @@ $('#id_workouttype').change();
$(this).change(function() {
data.set($(this).attr('name'),$(this).val());
console.log($(this).attr('id'),$(this).attr('name'),$(this).val());
});});
});});
$('select').each(function( i ) {
console.log($(this).attr('name'),$(this).val());
$(this).change(function() {
@@ -253,7 +253,7 @@ $('#id_workouttype').change();
console.log(result," reloading");
location.reload();
};
}
}
});
return false;
});
@@ -295,9 +295,9 @@ $('#id_workouttype').change();
data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked'));
console.log("Set offline to True");
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.');
$('#extra_message').addClass('message');
$('#extra_message').addClass('message');
}
data.set("file",f);
data.set("file",f);
// data.append("file",f);
$("#id_file").replaceWith('<div id="id_file">'+files[0].name+'&nbsp; <a class="remove" href="javascript:void(0);"><b><font color="red">X</font></b></a></div>');