Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. {% macro post(post, type) %}
  2. <div class="post">
  3. <h3 class="post__heading">
  4. <span class="post__title">
  5. {{ post.title }} <span class="post__date">:: {{ post.date }}</span>
  6. </span>
  7. <div class="post__links">
  8. {% if type == "index" %}
  9. <a class="post__link" href="/posts/{{ post.id }}">view</a>
  10. {% endif %} {% if logged_in %}
  11. <a class="post__link" href="/posts/{{ post.id }}/edit">edit</a>
  12. <span class="post__link danger" data-delete="{{ post.id }}">delete</span>
  13. {% endif %}
  14. </div>
  15. </h3>
  16. {% if type != "index" %}
  17. <div class="post__body">
  18. {{ post.html | safe }}
  19. </div
  20. {% endif %}
  21. </div>
  22. {% endmacro %} {% macro form(post=false, action) %}
  23. <form class="form" method="POST" action="{{ action }}" id="post-form">
  24. <input
  25. type="hidden"
  26. name="id"
  27. value="{% if post %}{{ post.id }}{% endif %}"
  28. />
  29. <input
  30. type="hidden"
  31. name="date"
  32. value="{% if post %}{{ post.date }}{% endif %}"
  33. />
  34. <input type="hidden" name="html" />
  35. <div class="form__field">
  36. <label for="title" class="form__label">Title</label>
  37. <input
  38. class="form__text-field"
  39. type="text"
  40. name="title"
  41. required
  42. value="{% if post %}{{ post.title }}{% endif %}"
  43. />
  44. </div>
  45. <div class="form__field">
  46. <label for="body" class="form__label">Body</label>
  47. <textarea class="form__textarea" name="body" required>
  48. {% if post %}{{ post.body }}{% endif %}</textarea
  49. >
  50. </div>
  51. <div class="form__field">
  52. <a class="btn" href="#" data-preview>Preview</a>
  53. <input class="btn" type="submit" value="Post" />
  54. </div>
  55. </form>
  56. {% endmacro %}