RemoveModalForm refactoring

* wraps generic request processing logic into RemoveModalForm
* adds delete action to intervention detail compensations.html
* fixes rendering of deleted compensations in intervention detail view
This commit is contained in:
mipel
2021-08-02 10:53:34 +02:00
parent 98de05089e
commit 6bc8ada286
5 changed files with 86 additions and 74 deletions

View File

@@ -4,7 +4,7 @@
<div class="row">
<div class="col-sm-6">
<h5>
<span class="badge badge-light">{{intervention.compensations.count}}</span>
<span class="badge badge-light">{{compensations.count}}</span>
{% trans 'Compensations' %}
</h5>
</div>
@@ -30,10 +30,13 @@
<th scope="col">
{% trans 'Title' %}
</th>
<th scope="col">
{% trans 'Action' %}
</th>
</tr>
</thead>
<tbody>
{% for comp in intervention.compensations.all %}
{% for comp in compensations %}
<tr>
<td class="align-middle">
<a href="{% url 'compensation:open' comp.id %}">
@@ -41,6 +44,11 @@
</a>
</td>
<td class="align-middle">{{ comp.title }}</td>
<td>
<button data-form-url="{% url 'compensation:remove' comp.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove compensation' %}">
{% fa5_icon 'trash' %}
</button>
</td>
</tr>
{% endfor %}
</tbody>