From 3d0202b4faaef7ff0900bcfefca4c88907a2b6d4 Mon Sep 17 00:00:00 2001 From: stilbruch Date: Sat, 23 Apr 2022 15:08:27 -0500 Subject: Update record workout page --- app/static/js/record.js | 33 ++++++++++++++++++++ app/templates/base/layout.html | 2 +- app/templates/workout/record.html | 64 ++++++++++++++++++++------------------- 3 files changed, 67 insertions(+), 32 deletions(-) (limited to 'app') diff --git a/app/static/js/record.js b/app/static/js/record.js index fedbdd7..75aa148 100644 --- a/app/static/js/record.js +++ b/app/static/js/record.js @@ -1,9 +1,42 @@ +// Register 'Enter' listeners on all inputs +Array.from(document.getElementsByClassName('input')) + .filter(e => e.type == 'number') + .forEach(e => e.addEventListener('keyup', function(event) { + if (event.key == 'Enter') { + console.log("ENTER"); + } + })) + +function checkSet(row) { + // Disable input editing + row.children[1].firstChild.disabled = true; + row.children[2].firstChild.disabled = true; + + // Add is-success to inputs + row.children[1].firstChild.classList.add('is-success') + row.children[2].firstChild.classList.add('is-success') +} + +function uncheckSet(row) { + // Re-enable input editing + row.children[1].firstChild.disabled = false; + row.children[2].firstChild.disabled = false; + + // Remove is-success from inputs + row.children[1].firstChild.classList.remove('is-success') + row.children[2].firstChild.classList.remove('is-success') +} + // Called when the check at the end of a set line is clicked function onClickSetCheck(elem) { if (elem.classList.contains('is-success')) { elem.classList.remove('is-success'); + + uncheckSet(elem.parentElement.parentElement); } else { elem.classList.add('is-success'); + + checkSet(elem.parentElement.parentElement); } } diff --git a/app/templates/base/layout.html b/app/templates/base/layout.html index 89ad385..fe83440 100644 --- a/app/templates/base/layout.html +++ b/app/templates/base/layout.html @@ -47,7 +47,7 @@ - + diff --git a/app/templates/workout/record.html b/app/templates/workout/record.html index 0908ef8..3dfb2c8 100644 --- a/app/templates/workout/record.html +++ b/app/templates/workout/record.html @@ -7,39 +7,41 @@

Record {{ workout.name }}

{% for exercise in workout.exercises %} -

{{ exercise.name }}

-
-
-
- -
- -
-
-
- -
- -
-
- - -
-
- +

{{ exercise.name }}

+ + + + + + + + + {% for i in range(exercise.sets) %} + + + + + + + {% endfor %} + +
SetlbsRepsDone
{{ i }} + +
- - + +
+
{% endfor %}
-- cgit v1.2.3