htmx_examples/templates/partials/edit_row_get.html

27 lines
853 B
HTML

{% for contact in contacts %}
<tr class="">
<td> {{ contact.name }} </td>
<td> {{ contact.email }} </td>
<td>
<button class="btn btn-danger"
hx-get="/contacts/{{ contact.id }}/edit"
hx-trigger="edit"
_="on click
if .editing is not empty
Swal.fire({title: 'Already Editing',
showCancelButton: true,
confirmButtonText: 'Yep, Edit This Row!',
text:'Hey! You are already editing a row! Do you want to cancel that edit and continue?'})
if the result's isConfirmed is false
halt
end
send cancel to .editing
end
trigger edit">
Edit
</button>
</td>
</tr>
{% endfor %}