edit page

This commit is contained in:
janphilippweinsheimer 2024-03-01 08:19:53 +01:00
parent e20defa4e1
commit 7771c1eea2
5 changed files with 44 additions and 8 deletions

23
app.py
View File

@ -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():

View File

@ -125,7 +125,6 @@
{% if not habit.streak == 0 %}
{{ habit.streak }} 🔥
{% endif %}
</div>
<!-- Knopf für das Löschen einer Gewohnheit -->
@ -135,13 +134,12 @@
<i class="bi bi-trash3"></i>
</button>
<!-- Knopf für die Einstellungen einer Gewohnheit -->
<button type="button" class="btn"
<!-- -->
<a type="button" class="btn" href="{{ url_for('edit_habit') }}?habit={{ habit.id }}" aria-current="page"
style="width: 40px; height: 40px; min-height: 3em;">
<i class="bi bi-gear"></i>
</button>
<i class="bi bi-pencil"></i>
</a>
<!-- Progressbar -->
<div class="col-12">

View File

@ -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

View File

@ -0,0 +1,7 @@
{% extends 'index.html' %}
{% block content %}
test
{{ title }}
{% endblock %}

View File

@ -6,7 +6,7 @@
<h1 class="mb-4">Account Einstellungen👤</h1>
<!-- Account information fields -->
<div class="card mb-4">
<div class="card bg-light mb-4">
<div class="card-body d-flex">
<div>
<h5 class="card-title">Profilbild</h5>
@ -35,7 +35,7 @@
</div>
<!-- Password change fields -->
<div class="card mb-4">
<div class="card bg-light mb-4">
<div class="card-body">
<h5 class="card-title">Passwort ändern</h5>
<form id="editPasswordForm" action="/password" method="POST">