add_shitpost.html.tera 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {% extends "base.html.tera" %} {% block content %}
  2. <div class="container">
  3. <form action="/api/shitpost/add", method="post">
  4. <label for="title">Название</label>
  5. <br>
  6. <input type="text" name="title" id="title"/>
  7. <br>
  8. <label>Тип</label>
  9. <br>
  10. {% for type in types %}
  11. <input type="radio" name="type_id" id="{{ type.id }}" value="{{ type.id }}"/>
  12. <label for="{{ type.id }}">{{type.title}}</label>
  13. <br>
  14. {% endfor %}
  15. <label for="url">Ссылка</label>
  16. <br>
  17. <input type="url" name="url" id="url"/>
  18. <br>
  19. <label for="seconds">Продолжительность(секунд)</label>
  20. <br>
  21. <input type="number" name="seconds" id="seconds"/>
  22. <br>
  23. <button type="submit">Добавить</button>
  24. </form>
  25. </div>
  26. <script lang='js'>
  27. function get_types() {
  28. axios({
  29. method:'get',
  30. url: `/shitpost/types`
  31. })
  32. .then((response) => {
  33. // handle success
  34. return response.data
  35. })
  36. .catch((error) => {
  37. // handle error
  38. console.log(error);
  39. })
  40. }
  41. </script>
  42. {% endblock content %}