add.eta 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <% layout("/en/layout", { title: "add station" }) %>
  2. <%~ include("/en/panel/partials/navbar") %>
  3. <% const backIcon = `
  4. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  5. <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m12 19l-7-7l7-7m7 7H5" />
  6. </svg>
  7. ` %>
  8. <% const addIcon = `
  9. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  10. <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7-7v14" />
  11. </svg>
  12. ` %>
  13. <% const errorIcon = `
  14. <svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  15. <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01" />
  16. </svg>
  17. ` %>
  18. <div class="container-row">
  19. <a role="button" href="/en/panel/stations"><%~ backIcon %></a>
  20. <h2><%~ addIcon %> add station</h2>
  21. </div>
  22. <% const errorValue = it.error?.split('.').reduce((a, b) => a[b], it.lang.stations?.errors)?.(it?.errorDetails) %>
  23. <% if (typeof errorValue === "string") { %>
  24. <div class="message error">
  25. <p class="messageText"><%~ errorIcon %> <%= errorValue %></p>
  26. </div>
  27. <% } %>
  28. <form action="/en/panel/stations/add" method="post">
  29. <div>
  30. <label for="name">name</label>
  31. <input type="text" id="name" name="name" placeholder="cool station">
  32. </div>
  33. <div>
  34. <label for="description">description</label>
  35. <textarea id="description" name="description" placeholder="the coolest one"></textarea>
  36. </div>
  37. <div class="cf-turnstile" data-sitekey="<%= it.siteKey %>"></div>
  38. <button type="submit" class="primary"><%~ addIcon %> add</button>
  39. </form>
  40. <script
  41. src="https://challenges.cloudflare.com/turnstile/v0/api.js"
  42. async
  43. defer
  44. ></script>