Expand the selected day where it sits

Choosing a day from the list made the page jump around. Two causes, both
structural.

The editing panel lived above the list, so opening a day swapped content in
at the top and pushed everything down. And the selected day was then skipped
when rendering the list — to avoid showing it twice — so every row below it
slid up under the tap.

The day list is now the page. The selected day expands in place and every
other row stays exactly where it was. Anchors carry the viewport to the day
rather than the top of the document, and links inside the open day keep the
anchor, so picking a dish or cancelling does not throw the page back up.
Saving and deleting redirect to the same anchor, leaving the viewport where
the work was happening. The history window stretches to reach the selected
day, which would otherwise have no row to open in.

The open day is marked with a bar down its left side rather than rules above
and below: the rows either side already draw a bottom border, so a horizontal
rule doubled up with it on any day but the first.
This commit is contained in:
Esa Kataja
2026-09-05 23:21:26 +03:00
parent d743327cd2
commit 768ab50140
4 changed files with 133 additions and 62 deletions
+10 -2
View File
@@ -137,8 +137,16 @@ check "saving redirects back to the day" \
check "the saved day shows what was eaten" \
"$(curl -s -u ":$pass" "http://$addr/?pvm=2026-09-05")" "kirjattu"
check "history is on the same page as the logger" \
"$(curl -s -u ":$pass" "http://$addr/")" "Aiemmin"
# The selected day expands inside the list rather than in a panel above it,
# so the rows below do not shift when one is tapped.
day=$(curl -s -u ":$pass" "http://$addr/?pvm=2026-09-05")
check "the selected day expands in place" "$day" 'id="paiva-2026-09-05"'
check "and stays in the list rather than being lifted out" "$day" "kirjattu"
check "links inside it keep the anchor" "$day" "#paiva-2026-09-05"
check "saving returns to the day, not the top" \
"$(curl -s -o /dev/null -w '%{redirect_url}' -u ":$pass" \
-d "pvm=2026-09-04&ruoka=$ruoka" "http://$addr/kirjaa")" "#paiva-2026-09-04"
# Deleting a logged meal drops the row outright, so it asks first.
saved=$(curl -s -u ":$pass" "http://$addr/?pvm=2026-09-05&poista=1")