# 86 Viewport jump EcoAccount/EMA
* adds direct jump of viewport on related-data action (create/delete)
This commit is contained in:
@@ -80,10 +80,8 @@ class ShareModalForm(BaseModalForm):
|
||||
|
||||
"""
|
||||
# Initialize share_link field
|
||||
url_name = f"{self.instance._meta.app_label}:share"
|
||||
self.share_link = self.request.build_absolute_uri(
|
||||
reverse(url_name, args=(self.instance.id, self.instance.access_token,))
|
||||
)
|
||||
share_link = self.instance.get_share_link()
|
||||
self.share_link = self.request.build_absolute_uri(share_link)
|
||||
self.initialize_form_field(
|
||||
"url",
|
||||
self.share_link
|
||||
|
||||
@@ -8,6 +8,7 @@ Created on: 15.11.21
|
||||
import shutil
|
||||
|
||||
from django.contrib import messages
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from user.models import User
|
||||
@@ -299,6 +300,14 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
|
||||
and is_free_of_revocations
|
||||
return is_ready
|
||||
|
||||
def get_share_link(self):
|
||||
""" Returns the share url for the object
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
return reverse("intervention:share", args=(self.id, self.access_token))
|
||||
|
||||
|
||||
class InterventionDocument(AbstractDocument):
|
||||
"""
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:acc-new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'tree' %}
|
||||
</button>
|
||||
@@ -44,7 +44,7 @@
|
||||
{% for deduction in obj.deductions.all %}
|
||||
<tr {% if deduction.account.deleted %}class="align-middle alert-danger" title="{% trans 'Eco-account deleted! Deduction invalid!' %}" {% elif not deduction.account.recorded %}class="align-middle alert-danger" title="{% trans 'Eco-account not recorded! Deduction invalid!' %}" {% endif %}>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:acc-detail' deduction.account.id %}">
|
||||
<a href="{% url 'compensation:acc:detail' deduction.account.id %}">
|
||||
{% if deduction.account.deleted or not deduction.account.recorded %}
|
||||
{% fa5_icon 'exclamation-triangle' %}
|
||||
{% endif %}
|
||||
@@ -55,7 +55,7 @@
|
||||
<td class="align-middle">{{ deduction.created.timestamp|default_if_none:""|naturalday}}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:acc-remove-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Deduction' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:remove-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Deduction' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay-new' obj.id %}" title="{% trans 'Add new payment' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay:new' obj.id %}" title="{% trans 'Add new payment' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'money-bill-wave' %}
|
||||
</button>
|
||||
@@ -50,7 +50,7 @@
|
||||
<td class="align-middle">{{ pay.comment }}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:pay-remove' pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove payment' %}">
|
||||
<button data-form-url="{% url 'compensation:pay:remove' pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove payment' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<th scope="row">{% trans 'Deductions of eco-accounts' %}</th>
|
||||
<td class="align-middle">
|
||||
{% for deduction in deductions %}
|
||||
<a href="{% url 'compensation:acc-report' deduction.account.id %}">
|
||||
<a href="{% url 'compensation:acc:report' deduction.account.id %}">
|
||||
{{deduction.account.identifier}} - {{deduction.account.title}}
|
||||
</a>
|
||||
<br>
|
||||
|
||||
@@ -210,7 +210,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
# Attention: Despite the fact, this url refers to a compensation app route, we test it here for the interventions.
|
||||
# Reason: A payment is some kind of compensation for an intervention. Therefore it lives inside the compensation app.
|
||||
# BUT: Payments are added on the intervention detail page. Therefore it's part of a regular intervention workflow.
|
||||
new_payment_url = reverse("compensation:pay-new", args=(self.intervention.id,))
|
||||
new_payment_url = reverse("compensation:pay:new", args=(self.intervention.id,))
|
||||
|
||||
# Make sure there are no payments on the intervention, yet
|
||||
self.assertEqual(0, self.intervention.payments.count())
|
||||
@@ -251,7 +251,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
|
||||
"""
|
||||
# Create removing url for the payment
|
||||
remove_url = reverse("compensation:pay-remove", args=(payment.id,))
|
||||
remove_url = reverse("compensation:pay:remove", args=(payment.id,))
|
||||
post_data = {
|
||||
"confirm": True,
|
||||
}
|
||||
@@ -390,7 +390,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
|
||||
"""
|
||||
# Create the url for creating a new deduction
|
||||
new_url = reverse("compensation:acc-new-deduction", args=(self.eco_account.id,))
|
||||
new_url = reverse("compensation:acc:new-deduction", args=(self.eco_account.id,))
|
||||
|
||||
# Prepare the form data
|
||||
test_surface = 100.00
|
||||
@@ -415,7 +415,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
|
||||
"""
|
||||
# Prepare url for deleting of this deduction
|
||||
delete_url = reverse("compensation:acc-remove-deduction", args=(self.eco_account.id, deduction.id,))
|
||||
delete_url = reverse("compensation:acc:remove-deduction", args=(self.eco_account.id, deduction.id,))
|
||||
post_data = {
|
||||
"confirm": True
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ urlpatterns = [
|
||||
path('document/<doc_id>/remove/', remove_document_view, name='remove-doc'),
|
||||
|
||||
# Deductions
|
||||
path('<id>/deduction/new', new_deduction_view, name='acc-new-deduction'),
|
||||
path('<id>/deduction/new', new_deduction_view, name='new-deduction'),
|
||||
|
||||
# Revocation routes
|
||||
path('<id>/revocation/new', new_revocation_view, name='new-revocation'),
|
||||
|
||||
Reference in New Issue
Block a user