rows.gohtml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. {{define "rows.html"}}
  2. {{ range $k, $contact := .contacts }}
  3. <tr>
  4. <td><input type="checkbox"
  5. name="selected_contact_ids"
  6. value="{{ $contact.ID }}"
  7. x-model="selected"></td>
  8. <td>{{ $contact.First }}</td>
  9. <td>{{ $contact.Last }}</td>
  10. <td>{{ $contact.Phone }}</td>
  11. <td>{{ $contact.Email }}</td>
  12. <td>
  13. <div data-overflow-menu>
  14. <button type="button" aria-haspopup="menu"
  15. aria-controls="contact-menu-{{ $contact.ID }}"
  16. >Options
  17. </button>
  18. <div role="menu" hidden id="contact-menu-{{ $contact.ID }}">
  19. <a role="menuitem" href="/contacts/{{ $contact.ID }}/edit">Edit</a>
  20. <a role="menuitem" href="/contacts/{{ $contact.ID }}">View</a>
  21. <a role="menuitem" href="#"
  22. hx-delete="/contacts/{{ $contact.ID }}"
  23. hx-confirm="Are you sure you want to delete this contact?"
  24. hx-swap="outerHTML swap:1s"
  25. hx-target="closest tr">Delete</a>
  26. </div>
  27. </div>
  28. </td>
  29. </tr>
  30. {{ else }}
  31. <tr>
  32. <td>No matching rows</td>
  33. </tr>
  34. {{end}}
  35. {{end}}