From 7771c1eea2c56cb0109dc64b9432d28e7855e7ef Mon Sep 17 00:00:00 2001 From: janphilippweinsheimer Date: Fri, 1 Mar 2024 08:19:53 +0100 Subject: [PATCH] edit page --- app.py | 23 +++++++++++++++++++++++ templates/components/habit_lists.html | 10 ++++------ templates/components/scripts.html | 8 ++++++++ templates/edit-habit.html | 7 +++++++ templates/profile.html | 4 ++-- 5 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 templates/edit-habit.html diff --git a/app.py b/app.py index c87d6a6..d3839a1 100644 --- a/app.py +++ b/app.py @@ -300,6 +300,29 @@ def profile_change(): ) +@app.route('/edit-habit') +@login_required +def edit_habit(): + habit_id = request.args.get("habit") + #habit_id = request.get_json()["editHabitId"] + + habit = Habit.get(habit_id) + return render_template( + "edit-habit.html", + title=habit.name + ) +''' +@app.route('/edit-habit', methods=['POST']) +@login_required +def edit_habit_change(): + #habit_id = request.get_json()["habitId"] + + #habit = Habit.get(habit_id) + + return render_template( + "edit-habit.html" + ) +''' @app.route('/check_password', methods=['POST']) @login_required def check_password(): diff --git a/templates/components/habit_lists.html b/templates/components/habit_lists.html index 96f997f..3ae3bb8 100644 --- a/templates/components/habit_lists.html +++ b/templates/components/habit_lists.html @@ -125,7 +125,6 @@ {% if not habit.streak == 0 %} {{ habit.streak }} 🔥 {% endif %} - @@ -135,13 +134,12 @@ - - + +
diff --git a/templates/components/scripts.html b/templates/components/scripts.html index 6bc6dcb..161588d 100644 --- a/templates/components/scripts.html +++ b/templates/components/scripts.html @@ -49,6 +49,14 @@ }); } + function sendHabitId(Id) { + + var habitId = document.getElementById(Id); + + // Make a POST request to /check with the habit id + // axios.post('/edit-habit', {editHabitId: habitId}) + } + function deleteHabit(habitId) { // Make a POST request to /delete with the habit id diff --git a/templates/edit-habit.html b/templates/edit-habit.html new file mode 100644 index 0000000..fbe5b9e --- /dev/null +++ b/templates/edit-habit.html @@ -0,0 +1,7 @@ +{% extends 'index.html' %} + +{% block content %} + +test +{{ title }} +{% endblock %} \ No newline at end of file diff --git a/templates/profile.html b/templates/profile.html index 06f64bd..19f9602 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -6,7 +6,7 @@

Account Einstellungen👤

-
+
Profilbild
@@ -35,7 +35,7 @@
-
+
Passwort ändern