fix(feedback): inline edit + live status change without reload
- Replaced broken status_aendern (missing status_choices in response)
with a single eintrag_bearbeiten view that always returns the full
partial context
- eintrag_zeile.html is now a <tbody x-data="{ editing: false }"> with
two rows: display row + collapsible edit form
- Click anywhere on a row to expand the edit form; @click.stop on the
status cell prevents accidental toggles
- Status dropdown in the display row posts via HTMX and swaps the whole
<tbody> — no page reload needed
- Edit form covers all fields: titel, beschreibung, kategorie,
dringlichkeit, status, bewertung, entscheidung
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
40739c1bfd
commit
40e70e64f0
4 changed files with 145 additions and 56 deletions
|
|
@ -65,17 +65,32 @@ def backlog(request):
|
|||
return render(request, 'feedback/backlog.html', ctx)
|
||||
|
||||
|
||||
def _eintrag_ctx(eintrag):
|
||||
return {
|
||||
'eintrag': eintrag,
|
||||
'status_choices': Feedbackeintrag.STATUS_CHOICES,
|
||||
'kategorie_choices': Feedbackeintrag.KATEGORIE_CHOICES,
|
||||
'dringlichkeit_choices': Feedbackeintrag.DRINGLICHKEIT_CHOICES,
|
||||
}
|
||||
|
||||
|
||||
@require_POST
|
||||
def status_aendern(request, pk):
|
||||
def eintrag_bearbeiten(request, pk):
|
||||
eintrag = get_object_or_404(Feedbackeintrag, pk=pk)
|
||||
neuer_status = request.POST.get('status')
|
||||
if neuer_status in dict(Feedbackeintrag.STATUS_CHOICES):
|
||||
eintrag.status = neuer_status
|
||||
bewertung = request.POST.get('bewertung')
|
||||
if bewertung is not None:
|
||||
eintrag.bewertung = bewertung
|
||||
entscheidung = request.POST.get('entscheidung')
|
||||
if entscheidung is not None:
|
||||
eintrag.entscheidung = entscheidung
|
||||
for field, choices in [
|
||||
('status', Feedbackeintrag.STATUS_CHOICES),
|
||||
('kategorie', Feedbackeintrag.KATEGORIE_CHOICES),
|
||||
('dringlichkeit', Feedbackeintrag.DRINGLICHKEIT_CHOICES),
|
||||
]:
|
||||
val = request.POST.get(field)
|
||||
if val and val in dict(choices):
|
||||
setattr(eintrag, field, val)
|
||||
for field in ('beschreibung', 'bewertung', 'entscheidung'):
|
||||
val = request.POST.get(field)
|
||||
if val is not None:
|
||||
setattr(eintrag, field, val)
|
||||
titel = request.POST.get('titel', '').strip()
|
||||
if titel:
|
||||
eintrag.titel = titel
|
||||
eintrag.save()
|
||||
return render(request, 'feedback/partials/eintrag_zeile.html', {'eintrag': eintrag})
|
||||
return render(request, 'feedback/partials/eintrag_zeile.html', _eintrag_ctx(eintrag))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue