From f093b46d5ba76faa66a43c95c22f9240f8870902 Mon Sep 17 00:00:00 2001 From: stilbruch Date: Sat, 30 Apr 2022 13:41:38 -0500 Subject: Fix navbar burger and some other stuff --- app/forms/workout.py | 1 - app/routes/basic.py | 4 ++-- app/routes/workout.py | 1 + app/static/css/style.css | 11 ++++++++--- app/static/js/bulma.js | 13 +++++++++++++ app/templates/base/layout.html | 4 ++-- app/templates/workout/history.html | 1 - 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/app/forms/workout.py b/app/forms/workout.py index ec9eb03..f3a1082 100644 --- a/app/forms/workout.py +++ b/app/forms/workout.py @@ -11,7 +11,6 @@ from wtforms.validators import DataRequired, Email, Optional # /workout/create class ExerciseCreateForm(Form): - # TODO no exercise_*, breaks workout_edit endpoint id = HiddenField("id", [Optional()]) name = StringField("name", [DataRequired()]) sets = IntegerField("sets", [DataRequired()]) diff --git a/app/routes/basic.py b/app/routes/basic.py index f6cb005..684daf2 100644 --- a/app/routes/basic.py +++ b/app/routes/basic.py @@ -15,8 +15,8 @@ def home(): # Prepare so we don't have to do this in the template records = ( db.session.query(WorkoutRecord) - .join(Workout) - .filter(Workout.user_id == current_user.id) + .filter_by(user_id=current_user.id) + .order_by(WorkoutRecord.finished.desc()) ) return render_template("home.html", records=records) diff --git a/app/routes/workout.py b/app/routes/workout.py index 9b46694..1d46aed 100644 --- a/app/routes/workout.py +++ b/app/routes/workout.py @@ -120,6 +120,7 @@ def workout_record(): for se in ee.sets.entries: lbs = se.data["lbs"] units = se.data["units"] + print(id, lbs, units) if lbs and units: # Add the set to the workout record diff --git a/app/static/css/style.css b/app/static/css/style.css index 4715c0d..574120a 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -4,15 +4,20 @@ rgba(0, 0, 0, 0.7) ), url('/static/img/index.jpg') no-repeat center center fixed; - /* background: url('/static/img/index.jpg') no-repeat center center fixed; */ -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } +/* pretty colors */ +@media screen and (max-width: 1023px) { + .navbar-menu { + background: linear-gradient(to right, #55F, #95F); + } +} .welcome { background: linear-gradient(to right, #55F, #95F); - margin-bottom: 16px; - border-radius: 6px; + margin-bottom: 16px; + border-radius: 6px; } diff --git a/app/static/js/bulma.js b/app/static/js/bulma.js index 49b9b93..66ccd0c 100644 --- a/app/static/js/bulma.js +++ b/app/static/js/bulma.js @@ -40,3 +40,16 @@ document.addEventListener('keydown', (event) => { closeAllModals(); } }); + +// Navbar burger +Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0).forEach(el => { + el.addEventListener('click', () => { + // Get the target from the "data-target" attribute + const target = el.dataset.target; + const $target = document.getElementById(target); + + // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" + el.classList.toggle('is-active'); + $target.classList.toggle('is-active'); + }); +}) diff --git a/app/templates/base/layout.html b/app/templates/base/layout.html index fe83440..4da4f30 100644 --- a/app/templates/base/layout.html +++ b/app/templates/base/layout.html @@ -27,14 +27,14 @@ Logo - + -