mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-30 11:19:59 +00:00
Add edit and delete functionality for food items
Implemented routes and templates to allow users to edit and delete their food items from the dashboard. Updated dashboard template to include Edit and Delete buttons. Refactored template locations and removed unused dashboard.html. Fixed redirect logic in app.py and updated seed data.
This commit is contained in:
@@ -32,10 +32,13 @@ Food Nutritional Info
|
||||
<td class="bg-body-tertiary">{{ food.carbs_100g }}</td>
|
||||
<td class="bg-body-tertiary">{{ food.protein_100g }}</td>
|
||||
<td class="bg-body-tertiary">
|
||||
<form method="POST" action="{{ url_for('admin.delete_food', id=food.id) }}"
|
||||
<form method="POST" action="{{ url_for('user.delete_food_item', barcode=food.barcode) }}"
|
||||
onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
|
||||
</form>
|
||||
<form method="GET" action="{{ url_for('user.edit_food_item', barcode=food.barcode) }}">
|
||||
<button type="submit" class="btn btn-warning btn-sm">Edit</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user