This commit is contained in:
Eden Kirin
2024-05-15 22:56:30 +02:00
parent af61d45fa4
commit 178377cfb6
2 changed files with 39 additions and 15 deletions

View File

@ -1,6 +1,6 @@
{% macro inline_table_row(person, is_editing) %}
<tr hx-target="this" hx-swap="outerHTML">
{% if is_editing %}
{% if is_editing %}
<tr id="person-row-{{ person.pk }}" hx-target="this" hx-swap="outerHTML">
<td>
<input class="form-control" name="name" value="{{ person.name }}">
</td>
@ -13,8 +13,8 @@
<td>
<button
class="btn btn-outline-success"
hx-get="{{ url("table-inline-edit-row", pk=person.pk) }}"
hx-vals='{"action": "save"}'
hx-post="{{ url("table-inline-edit-row", pk=person.pk) }}"
hx-include="#person-row-{{ person.pk }} input"
>
<i class="bi bi-check-circle-fill"></i>
</button>
@ -26,7 +26,9 @@
<i class="bi bi-x-circle-fill"></i>
</button>
</td>
{% else %}
</tr>
{% else %}
<tr hx-target="this" hx-swap="outerHTML">
<td>{{ person.name }}</td>
<td>{{ person.address }}</td>
<td>{{ person.city }}</td>
@ -34,10 +36,11 @@
<button
class="btn btn-outline-primary"
hx-get="{{ url("table-inline-edit-row", pk=person.pk) }}"
>
<i class="bi bi-pencil-square"></i>
</button>
</td>
{% endif %}
</tr>
</tr>
{% endif %}
{% endmacro %}