wohnungen actions: keep label text, disable both buttons while running

Showing "läuft…" inside the Bewerben button duplicated the "läuft…"
chip beside the address. Drop the text swap; keep the original labels
"Bewerben" / "Ablehnen", just disable + grey both buttons (the existing
.btn[disabled] styling handles that) while finished_at is null.

On success, both buttons continue to hide — only the "beworben" chip remains.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-21 18:43:17 +02:00
parent 72d9f808e2
commit 6bd7a4306a

View file

@ -146,8 +146,10 @@
</div>
</div>
<div class="flex gap-2 items-center">
{% if apply_allowed and not (item.last and item.last.success == 1) %}
{% set is_running = item.last and item.last.finished_at is none %}
{% set is_success = item.last and item.last.success == 1 %}
{% if not is_success %}
{% if apply_allowed %}
<form method="post" action="/actions/apply"
class="btn-with-badge"
hx-post="/actions/apply" hx-target="#wohnungen-body" hx-swap="outerHTML"
@ -157,8 +159,8 @@
<button class="btn btn-primary text-sm" type="submit"
{% if is_running %}disabled{% endif %}
hx-confirm="Bewerbung für {{ (f.address or f.link)|e }} starten?"
hx-on::before-request="this.textContent='läuft…'; this.disabled=true">
{% if is_running %}läuft…{% else %}Bewerben{% endif %}
hx-on::before-request="this.disabled=true">
Bewerben
</button>
{% if partner and f.id in partner.applied_flat_ids %}
<span class="partner-badge"
@ -166,14 +168,16 @@
{% endif %}
</form>
{% endif %}
{% if not (item.last and item.last.success == 1) %}
<form method="post" action="/actions/reject"
class="btn-with-badge"
hx-post="/actions/reject" hx-target="#wohnungen-body" hx-swap="outerHTML">
hx-post="/actions/reject" hx-target="#wohnungen-body" hx-swap="outerHTML"
hx-disabled-elt="find button">
<input type="hidden" name="csrf" value="{{ csrf }}">
<input type="hidden" name="flat_id" value="{{ f.id }}">
<button class="btn btn-ghost text-sm" type="submit"
hx-confirm="Ablehnen und aus der Liste entfernen?">
{% if is_running %}disabled{% endif %}
hx-confirm="Ablehnen und aus der Liste entfernen?"
hx-on::before-request="this.disabled=true">
Ablehnen
</button>
{% if partner and f.id in partner.rejected_flat_ids %}