From a20ad2dcaad3546d04992676ad1954f7268f3818 Mon Sep 17 00:00:00 2001 From: stilbruch Date: Mon, 9 May 2022 01:03:42 -0500 Subject: Fix adding rows for record timers --- app/routes/workout.py | 1 - app/static/js/record.js | 15 +++++++-------- app/templates/workout/record.html | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'app') diff --git a/app/routes/workout.py b/app/routes/workout.py index 767603e..e27cee8 100644 --- a/app/routes/workout.py +++ b/app/routes/workout.py @@ -131,7 +131,6 @@ def workout_record(workout_id=None): return redirect(url_for("home")) else: - print(form.errors) # Populate form with data for exercise in workout.exercises: form.exercises.append_entry( diff --git a/app/static/js/record.js b/app/static/js/record.js index a3ea516..2654a47 100644 --- a/app/static/js/record.js +++ b/app/static/js/record.js @@ -6,11 +6,10 @@ class Timer { finish; } -// Register 'Enter' listeners on all inputs -allInputs = Array.from(document.getElementsByClassName('input')) - .filter(e => e.type == 'number'); -allInputs.forEach(e => e.addEventListener('keydown', handleEnterKey)); -// Register onsubmit handler for form +// Get an arrayt of all inputs +allInputs = Array.from(document.getElementsByClassName('input')).filter(e => e.type == 'number'); + +// Register onsubmit handler for form (NOTE: unfortunatly not a better way to do this) document.getElementById("form").addEventListener('submit', (el) => { Array.from(event.target.getElementsByTagName('input')).forEach(i => i.disabled = false); }); @@ -83,9 +82,9 @@ function setReset(row, index, values=true) { function setSetid(row, id) { let setNumber = row.children[0]; - let lbsInput = row.children[1].children[0]; - let repsInput = row.children[2].children[0]; - let doneButton = row.children[3].children[0]; + //let lbsInput = row.children[1].children[0]; + //let repsInput = row.children[2].children[0]; + //let doneButton = row.children[3].children[0]; setNumber.textContent = id + 1; } diff --git a/app/templates/workout/record.html b/app/templates/workout/record.html index c7152cd..3805891 100644 --- a/app/templates/workout/record.html +++ b/app/templates/workout/record.html @@ -42,8 +42,8 @@ {% else %} - {{ set['lbs'](class_='input') }} - {{ set['units'](class_='input') }} + {{ set['lbs'](class_='input', onkeydown='handleEnterKey(event)') }} + {{ set['units'](class_='input', onkeydown='handleEnterKey(event)') }} {% endif %} -- cgit v1.2.3