Persists list of rendered user graphs in db, graph is removed list on click

This commit is contained in:
Peter Stockings
2023-10-24 21:29:52 +11:00
parent b128ede9d0
commit 57753fc2fc
2 changed files with 94 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
<div class="flex flex-wrap mb-1">
<div class="flex flex-wrap mb-5">
<div class="w-full md:w-1/5 px-3 mb-6 md:mb-0">
<div class="mb-1 w-full">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
@@ -89,8 +89,10 @@
</div>
<div id="user-workouts-overview-graphs-{{ user.id }}">
{% for period, attributes in user.graphs %}
<img src="{{ url_for('graph_user_workouts', user_id=user.id, period=period, attributes=attributes) }}"
loading="lazy" alt="No image" class="mx-auto" _="on click remove me">
{% for graph in user.graphs %}
<img src="{{ url_for('graph_user_workouts', user_id=user.id, start_date=graph.start_date, end_date=graph.end_date, period=graph.period, attributes=graph.attributes) }}"
loading="lazy" alt="No image" class="mx-auto"
hx-delete="{{ url_for('delete_user_graph', user_id=user.id, start_date=graph.start_date, end_date=graph.end_date, period=graph.period, attributes=graph.attributes ) }}"
hx-swap="outerHTML">
{% endfor %}
</div>