From a6010815c896cd8e5db0f74806f037f5a844bcfd Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 7 Apr 2022 19:00:01 +0200 Subject: [PATCH] some more fine tuning --- rowers/models.py | 25 +++++++++----- rowers/templates/stepedit.html | 59 ++++++++++++++++++++++++++++++++ rowers/templates/stepeditor.html | 32 ++++++++++++++--- static/css/rowsandall2.css | 34 +++++++++++++----- 4 files changed, 128 insertions(+), 22 deletions(-) diff --git a/rowers/models.py b/rowers/models.py index ef789caa..e659f300 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2401,7 +2401,8 @@ class PlannedSessionStep(models.Model): durationtypes = ( ("Distance", "Distance"), - ("Time", "Time") + ("Time", "Time"), + ('RepeatUntilStepsCmplt','Repeat previous blocks n times') ) targettypes = ( @@ -2414,16 +2415,20 @@ class PlannedSessionStep(models.Model): manager = models.ForeignKey(User, null=True, on_delete=models.CASCADE) name = models.TextField(default='',max_length=200, blank=True, null=True) type = models.TextField(default='',max_length=200, blank=True, null=True) - durationvalue = models.FloatField(default=0) - durationtype = models.TextField(default='',max_length=200, blank=True, null=True, - choices=durationtypes) - targetvalue = models.IntegerField(default=0) + durationvalue = models.FloatField(default=0, verbose_name="Duration Value") + durationtype = models.TextField(default='Time',max_length=200, + choices=durationtypes, + verbose_name='Duration Type') + targetvalue = models.IntegerField(default=0, verbose_name="Target Value") targettype = models.TextField(default='',max_length=200, blank=True, null=True, - choices=targettypes) - targetvaluelow = models.IntegerField(default=0) - targetvaluehigh = models.IntegerField(default=0) + choices=targettypes, verbose_name="Target Type") + targetvaluelow = models.IntegerField(default=0, + verbose_name="Target Value Low") + targetvaluehigh = models.IntegerField(default=0, + verbose_name="Target Value High") intensity = models.TextField(default='',max_length=200, blank=True, null=True, - choices=intensitytypes) + choices=intensitytypes, + verbose_name = "Intensity") description = models.TextField(default='',max_length=200, blank=True, null=True) color = models.TextField(default='#ddd',max_length=200) @@ -2434,6 +2439,8 @@ class PlannedSessionStep(models.Model): self.color = '#90ee90' elif self.intensity == "Rest": self.color = 'add8e6' + if self.durationtype == 'RepeatUntilStepsCmplt': + self.color = 'ffffa7' self.durationvalue = int(self.durationvalue) diff --git a/rowers/templates/stepedit.html b/rowers/templates/stepedit.html index 1e6a0530..c53575dd 100644 --- a/rowers/templates/stepedit.html +++ b/rowers/templates/stepedit.html @@ -29,6 +29,65 @@ +
  • +

    Explanation

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ParameterRegular StepRepeat Step
    Duration TypeTime or DistanceRepeat
    Duration ValueMinutes / MetersBlock number to start repeat from
    Target TypeSet a target to hold---
    Target Value +
    Power: Zone number (1-10), % of FTP (10-1000)
    +
    Speed: 1000x target speed in m/s
    +
    Heart Rate: Zone number (1-10), % of max (10-100);
    +
    Cadence: Strokes per Minute
    +
    + Number of repetitions +
    Target Value Low +
    Power: % of FTP (10-1000)
    +
    Speed: 1000x target speed in m/s
    +
    Heart Rate: % of max (10-100);
    +
    Cadence: Strokes per Minute
    +
    +
    Target Value High +
    Power: % of FTP (10-1000)
    +
    Speed: 1000x target speed in m/s
    +
    Heart Rate: % of max (10-100);
    +
    Cadence: Strokes per Minute
    +
    +
    IntensityWarming Up, Active, RestSet to Active
    DescriptionAny other text
    +
  • {% endblock %} diff --git a/rowers/templates/stepeditor.html b/rowers/templates/stepeditor.html index ec64d60d..0d82a71b 100644 --- a/rowers/templates/stepeditor.html +++ b/rowers/templates/stepeditor.html @@ -26,9 +26,15 @@

    {% for step in currentsteps %} -
    +
    + + ({{ forloop.counter|add:-1 }}) + {{ step.name }} + {% if step.durationtype == "RepeatUntilStepsCmplt" %} + - repeat {{ step.targetvalue }}x from block {{ step.durationvalue|floatformat }} + {% endif %} @@ -43,12 +49,22 @@
    {% endfor %} +
    +
    +

    +
    +
    -

    Library

    +

    Step Library

    {% for step in steps %} -
    +
    + + {{ step.name }} + {% if step.durationtype == "RepeatUntilStepsCmplt" %} + - repeat {{ step.targetvalue }}x from block {{ step.durationvalue|floatformat }} + {% endif %} @@ -142,9 +158,11 @@ console.log(result) } }) + window.location.reload(true); } function saveState() { + var cntr = 0; var list = []; steps = document.querySelector('.drop-zone'); steps.childNodes.forEach(function(item) { @@ -153,6 +171,11 @@ if (child.id && child.className == 'stepcontent') { list.push(child.id); } + if (child.className == "stepid") { + s = `(${cntr})` + child.replaceWith(s); + cntr++; + } }) } }); @@ -193,6 +216,7 @@ dragged = null; origcolor = null; } + saveState(); } function handleMouseOver(event) { @@ -242,6 +266,7 @@ if (dragged.parentNode.className.includes("drop-zone")) { trash(event); } + saveState(); } function trash(event) { @@ -251,7 +276,6 @@ event.preventDefault(); if (dragged.parentNode.className.includes("drop-zone")) { dragged.remove(); - saveState(); } } } diff --git a/static/css/rowsandall2.css b/static/css/rowsandall2.css index bd6c9752..926f970a 100644 --- a/static/css/rowsandall2.css +++ b/static/css/rowsandall2.css @@ -325,7 +325,7 @@ th.rotate > div > span { .stepcontainer { display: grid; - grid-template-columns: repeat(2, 1fr); + grid-template-columns: 4fr 1fr 4fr; gap: 10px; } @@ -353,23 +353,39 @@ th.rotate > div > span { background-color: #add8e6; } +.RepeatUntilStepsCmplt { + background-color: #ffffa7; +} + .drop-zone { position: relative; overflow: hidden; - background: #878787; + background-color: #D7D7D7; /* color: white; */ padding: 10px; padding-bottom: 40px; } +.allcentered { + /* Center vertically and horizontally */ + display: flex; + justify-content: center; + align-items: center; +} + +.allcenteredchild { + margin-top: 50%; +} + .divlines { - display: block; - overflow-x: hidden; - border-width: 1px 0 0 0; - border-color: #333 #333 #333 #333; - border-style: solid; - padding: 0px; - margin: 0px; + width: 50px; + height: 50px; + background-color: red; + /* Center vertically and horizontally */ + position: absolute; + top: 50%; + left: 50%; + margin: -25px 0 0 -25px; /* Apply negative top and left margins to truly center the element */ } .workoutcontainer {