Implemented habit list deletion
This commit is contained in:
parent
b04068da4e
commit
4dc494e67a
2
app.py
2
app.py
@ -582,7 +582,7 @@ def delete_list():
|
||||
if current_user not in habit_list.get_users():
|
||||
return {"error": "List does not belong to user"}
|
||||
|
||||
habit_list.delete()
|
||||
habit_list.delete(current_user.id)
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
|
||||
<div class="modal fade" id="listenModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="listenModal" tabindex="-1" aria-labelledby="listenModal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="exampleModalLabel">Bestätige</h1>
|
||||
<h1 class="modal-title fs-5" id="listenModalLabel">Bestätige</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -12,7 +12,7 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">abbrechen</button>
|
||||
<button type="button" class="btn btn-primary btn-danger" data-bs-dismiss="modal"
|
||||
onclick="deleteList(selectedListId)">Löschen
|
||||
onclick="deleteList(localStorage.getItem('selectedListId'));">Löschen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -73,7 +73,10 @@
|
||||
<div class="col-2">
|
||||
<button type="button" class="btn btn-xs me-3" data-bs-toggle="modal"
|
||||
data-bs-target="#listenModal" style="width: 40px; height: 40px"
|
||||
onclick="setSelectedListId({{ habit_list.id }})">
|
||||
onclick="{
|
||||
localStorage.setItem('selectedListId', {{ habit_list.id }});
|
||||
}">
|
||||
<!---onclick="setSelectedListId({{ habit_list.id }})"-->
|
||||
<i class="bi bi-trash3"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -48,14 +48,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user