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():
|
if current_user not in habit_list.get_users():
|
||||||
return {"error": "List does not belong to user"}
|
return {"error": "List does not belong to user"}
|
||||||
|
|
||||||
habit_list.delete()
|
habit_list.delete(current_user.id)
|
||||||
return {}
|
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-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<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>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">abbrechen</button>
|
<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"
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -73,7 +73,10 @@
|
|||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<button type="button" class="btn btn-xs me-3" data-bs-toggle="modal"
|
<button type="button" class="btn btn-xs me-3" data-bs-toggle="modal"
|
||||||
data-bs-target="#listenModal" style="width: 40px; height: 40px"
|
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>
|
<i class="bi bi-trash3"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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) {
|
function deleteHabit(habitId) {
|
||||||
// Make a POST request to /delete with the habit id
|
// Make a POST request to /delete with the habit id
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user