diff --git a/rowers/models.py b/rowers/models.py index 7624c996..efc43f81 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2427,6 +2427,31 @@ class PlannedSessionStep(models.Model): notes = models.TextField(default='',max_length=200, blank=True, null=True) color = models.TextField(default='#ddd',max_length=200) + def save(self, *args, **kwargs): + if self.intensity == "Warmup": + self.color = "#ffcccb" + elif self.intensity == "Cooldown": + self.color = '#90ee90' + elif self.intensity == "Rest": + self.color = 'add8e6' + + super(PlannedSessionStep, self).save(*args, **kwargs) + +class StepEditorForm(ModelForm): + class Meta: + model = PlannedSessionStep + fields = [ + 'name', + #'type', + 'durationtype', + 'durationvalue', + 'intensity', + ] + + widgets = { + 'name': forms.Textarea(attrs={'rows':1, 'cols':50}), + } + class PlannedSession(models.Model): diff --git a/rowers/templates/stepeditor.html b/rowers/templates/stepeditor.html index 85a6478f..2d92d0de 100644 --- a/rowers/templates/stepeditor.html +++ b/rowers/templates/stepeditor.html @@ -7,6 +7,15 @@ {% block main %}
+ WARNING: This is experimental functionality which may not behave as you + expect. Does not work on smartphones. +
++ Drag from Library to Training to add a step to the end. + Drag on top of a training step to insert after it. + Drag out of Training to remove a step. +