Private
Public Access
1
0
This commit is contained in:
2025-01-22 20:17:47 +01:00
parent 4cf92155a6
commit 95bc02e122
3 changed files with 176 additions and 164 deletions

View File

@@ -2755,6 +2755,12 @@ class PlannedSessionStep(models.Model):
return d
# string
def __str__(self):
str = 'Step {id} {name} {intensity}'.format(id=self.pk, name=self.name, intensity=self.intensity)
return str
class StepEditorForm(ModelForm):
class Meta:
model = PlannedSessionStep

View File

@@ -20,7 +20,7 @@
<section class="drop-zone">
<h2>Training Steps for {{ ps.name }}</h2>
<p>
<form onsubmit="event.preventDefault(); saveSession();">
<form target="/rowers/plans/stepadder/{{ ps.id}}/?save=1" onsubmit="event.preventDefault(); saveSession();">
<input id="hidden" type="hidden" value="">
<input id="savebutton" type="submit" value="Save">
</form>
@@ -218,7 +218,10 @@
console.log(result)
}
})
window.location.reload(true);
saveState();
// reload the page
location.reload();
// window.location.reload(true);
}
function saveState() {
@@ -345,7 +348,7 @@
if (target && dragged) {
target.style.backgroundColor = '';
event.preventDefault();
// Get the id of the target and add the moved element to the target's DOM
// Get the id of the target and add the moved element to the targets DOM
// dragged.parentNode.removeChild(dragged);
if (target.nodeName == "SECTION") {
dragged.style.opacity = '';

View File

@@ -3077,6 +3077,7 @@ def rower_create_trainingplan(request, id=0):
'old_targets': old_targets,
})
@csrf_exempt
@user_passes_test(can_plan, login_url="/rowers/paidplans",
message="This functionality requires a Coach or Self-Coach plan",
redirect_field_name=None)
@@ -3116,6 +3117,7 @@ def stepadder(request, id=0):
'message': 'permission denied for host '+hostt[0]}
return JSONResponse(status=403, data=message)
if ps.steps:
filename = ps.steps.get('filename','')
sport = ps.steps.get('sport','rowing')
@@ -3208,6 +3210,7 @@ def stepedit(request, id=0, psid=0):
ps.fitfile = None
ps.interval_string = ""
ps.save()
step.durationtype = form.cleaned_data['durationtype']