actions.hbs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <td class="actions">
  2. {{#if password}}
  3. <button class="action password" disabled="true" data-tooltip="Password protected">
  4. {{> icons/key}}
  5. </button>
  6. {{/if}}
  7. {{#if banned}}
  8. <button class="action banned" disabled="true" data-tooltip="Banned">
  9. {{> icons/stop}}
  10. </button>
  11. {{/if}}
  12. <a
  13. class="button action stats"
  14. href="/stats?id={{id}}"
  15. title="Stats"
  16. class="action stats"
  17. >
  18. {{> icons/chart}}
  19. </a>
  20. <button
  21. class="action qrcode"
  22. hx-on:click="handleQRCode(this, 'link-dialog')"
  23. data-url="{{link.url}}"
  24. >
  25. {{> icons/qrcode}}
  26. </button>
  27. <button
  28. class="action edit"
  29. hx-trigger="click queue:none"
  30. hx-ext="path-params"
  31. hx-get="/link/edit/{id}"
  32. hx-vals='{"id":"{{id}}"}'
  33. hx-swap="beforeend"
  34. hx-target="next tr.edit"
  35. hx-indicator="next tr.edit"
  36. hx-sync="this:drop"
  37. hx-on::before-request="
  38. const tr = event.detail.target;
  39. tr.classList.add('show');
  40. if (tr.querySelector('.content')) {
  41. event.preventDefault();
  42. tr.classList.remove('show');
  43. tr.removeChild(tr.querySelector('.content'));
  44. }
  45. "
  46. >
  47. {{> icons/pencil}}
  48. </button>
  49. <button
  50. class="action delete"
  51. hx-on:click='openDialog("link-dialog")'
  52. hx-get="/confirm-link-delete"
  53. hx-target="#link-dialog .content-wrapper"
  54. hx-indicator="#link-dialog"
  55. hx-vals='{"id":"{{id}}"}'
  56. >
  57. {{> icons/trash}}
  58. </button>
  59. </td>