From 7028672b9351a8ba6b2f33bb7c1d8d9882ec2649 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 2 Feb 2022 09:32:34 +0100 Subject: [PATCH 01/12] # 86 Viewport jump Intervention * adds direct jump of viewport on related-data action (create/delete) --- compensation/views/eco_account.py | 3 +- compensation/views/payment.py | 5 ++- intervention/models/revocation.py | 4 ++ .../templates/intervention/detail/view.html | 40 ++++++++++--------- intervention/views.py | 11 +++-- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/compensation/views/eco_account.py b/compensation/views/eco_account.py index 59b82a7b..988b0c50 100644 --- a/compensation/views/eco_account.py +++ b/compensation/views/eco_account.py @@ -533,7 +533,8 @@ def new_deduction_view(request: HttpRequest, id: str): form = NewDeductionModalForm(request.POST or None, instance=acc, request=request) return form.process_request( request, - msg_success=_("Deduction added") + msg_success=_("Deduction added"), + redirect_url=reverse("compensation:detail", args=(id,)) + "#related_data" ) diff --git a/compensation/views/payment.py b/compensation/views/payment.py index 99d6d3ee..7caf847e 100644 --- a/compensation/views/payment.py +++ b/compensation/views/payment.py @@ -5,6 +5,7 @@ Contact: michel.peltriaux@sgdnord.rlp.de Created on: 09.08.21 """ +from django.urls import reverse from django.utils.translation import gettext_lazy as _ from django.contrib.auth.decorators import login_required from django.http import HttpRequest @@ -33,7 +34,8 @@ def new_payment_view(request: HttpRequest, intervention_id: str): form = NewPaymentForm(request.POST or None, instance=intervention, request=request) return form.process_request( request, - msg_success=_("Payment added") + msg_success=_("Payment added"), + redirect_url=reverse("intervention:detail", args=(intervention_id,)) + "#related_data" ) @@ -54,5 +56,6 @@ def payment_remove_view(request: HttpRequest, id: str): return form.process_request( request=request, msg_success=_("Payment removed"), + redirect_url=reverse("intervention:detail", args=(payment.intervention_id,)) + "#related_data" ) diff --git a/intervention/models/revocation.py b/intervention/models/revocation.py index 5eb70e5e..e996f564 100644 --- a/intervention/models/revocation.py +++ b/intervention/models/revocation.py @@ -26,6 +26,10 @@ class Revocation(BaseResource): self.document.delete(*args, **kwargs) super().delete() + @property + def intervention(self): + return self.legal.intervention + class RevocationDocument(AbstractDocument): """ diff --git a/intervention/templates/intervention/detail/view.html b/intervention/templates/intervention/detail/view.html index e51f3ecd..86220949 100644 --- a/intervention/templates/intervention/detail/view.html +++ b/intervention/templates/intervention/detail/view.html @@ -136,27 +136,29 @@
-
-
- {% include 'intervention/detail/includes/compensations.html' %} +
- -
-
- {% include 'compensation/detail/compensation/includes/states-before.html' %} +