actions.hbs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. <button class="action stats">
  13. {{> icons/chart}}
  14. </button>
  15. <button
  16. class="action qrcode"
  17. hx-on:click="handleQRCode(this)"
  18. data-url="{{link.url}}"
  19. >
  20. {{> icons/qrcode}}
  21. </button>
  22. <button
  23. class="action edit"
  24. hx-trigger="click queue:none"
  25. hx-ext="path-params"
  26. hx-get="/link/edit/{id}"
  27. hx-vals='{"id":"{{id}}"}'
  28. hx-swap="beforeend"
  29. hx-target="next tr.edit"
  30. hx-indicator="next tr.edit"
  31. hx-sync="this:drop"
  32. hx-on::before-request="
  33. const tr = event.detail.target;
  34. tr.classList.add('show');
  35. if (tr.querySelector('.content')) {
  36. event.preventDefault();
  37. tr.classList.remove('show');
  38. tr.removeChild(tr.querySelector('.content'));
  39. }
  40. "
  41. >
  42. {{> icons/pencil}}
  43. </button>
  44. {{#unless banned}}
  45. {{#if @root.isAdmin}}
  46. <button
  47. class="action ban"
  48. hx-on:click='openDialog("link-dialog")'
  49. hx-get="/confirm-link-ban"
  50. hx-target="#link-dialog .content-wrapper"
  51. hx-indicator="#link-dialog"
  52. hx-vals='{"id":"{{id}}"}'
  53. >
  54. {{> icons/stop}}
  55. </button>
  56. {{/if}}
  57. {{/unless}}
  58. <button
  59. class="action delete"
  60. hx-on:click='openDialog("link-dialog")'
  61. hx-get="/confirm-link-delete"
  62. hx-target="#link-dialog .content-wrapper"
  63. hx-indicator="#link-dialog"
  64. hx-vals='{"id":"{{id}}"}'
  65. >
  66. {{> icons/trash}}
  67. </button>
  68. </td>