actions.hbs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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)"
  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. {{#unless banned}}
  50. {{#if @root.isAdmin}}
  51. <button
  52. class="action ban"
  53. hx-on:click='openDialog("link-dialog")'
  54. hx-get="/confirm-link-ban"
  55. hx-target="#link-dialog .content-wrapper"
  56. hx-indicator="#link-dialog"
  57. hx-vals='{"id":"{{id}}"}'
  58. >
  59. {{> icons/stop}}
  60. </button>
  61. {{/if}}
  62. {{/unless}}
  63. <button
  64. class="action delete"
  65. hx-on:click='openDialog("link-dialog")'
  66. hx-get="/confirm-link-delete"
  67. hx-target="#link-dialog .content-wrapper"
  68. hx-indicator="#link-dialog"
  69. hx-vals='{"id":"{{id}}"}'
  70. >
  71. {{> icons/trash}}
  72. </button>
  73. </td>