prevent scroll position from being lost when updating servings
This commit is contained in:
parent
e05a4d0ccd
commit
12a040fe87
4 changed files with 45 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<div style="border: 1px solid black; margin: 1em; padding: 1em;">
|
||||
<div style="border: 1px solid black; margin: 1em; padding: 1em;" id="food-{{ food.id }}">
|
||||
<div style="text-align: center;">
|
||||
<p>
|
||||
<b>{{ food.name }}</b>
|
||||
|
|
@ -15,9 +15,14 @@
|
|||
<br>
|
||||
<form method="post">
|
||||
<div style="text-align: center;">
|
||||
<button formaction="/decrease/{{ food.id }}" style="width: 40%; height: 3em;" {% if food.actual_servings <=0 %}
|
||||
disabled {% endif %}>-</button>
|
||||
<button formaction="/increase/{{ food.id }}" style="width: 40%; height: 3em;">+</button>
|
||||
<button hx-post="/decrease/{{ food.id }}" hx-target="#food-{{ food.id }}" hx-swap="outerHTML"
|
||||
style="width: 40%; height: 3em;" {% if food.actual_servings <=0 %} disabled {% endif %}>
|
||||
-
|
||||
</button>
|
||||
<button hx-post="/increase/{{ food.id }}" hx-target="#food-{{ food.id }}" hx-swap="outerHTML"
|
||||
style="width: 40%; height: 3em;">
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.min.js"></script>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue