You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

components.html 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {% macro post(post, type) %}
  2. <div class="post">
  3. <div class="post__heading">
  4. <div class="post__title">
  5. <span class="post__date">:: {{ post.date }} //</span>
  6. <a class="post__link" href="/posts/{{ post.slug }}">
  7. {{ post.title }}
  8. </a>
  9. </div>
  10. {% if logged_in %}
  11. <div class="post__meta">
  12. <a class="post__link" href="/posts/{{ post.slug }}/edit">edit</a>
  13. <span class="post__link danger" data-delete="{{ post.slug }}">delete</span>
  14. </div>
  15. {% endif %}
  16. </div>
  17. {% if type != "index" %}
  18. <div class="post__body">
  19. {{ post.html | safe }}
  20. </div>
  21. {% endif %}
  22. </div>
  23. {% endmacro %}
  24. {% macro form(post=false, action) %}
  25. <form class="form" method="POST" action="{{ action }}" id="post-form">
  26. <input
  27. type="hidden"
  28. name="id"
  29. value="{% if post %}{{ post.slug }}{% endif %}"
  30. />
  31. <input
  32. type="hidden"
  33. name="date"
  34. value="{% if post %}{{ post.date }}{% endif %}"
  35. />
  36. <input type="hidden" name="html" />
  37. <div class="form__field">
  38. <label for="title" class="form__label">Title</label>
  39. <input
  40. class="form__text-field"
  41. type="text"
  42. name="title"
  43. required
  44. value="{% if post %}{{ post.title }}{% endif %}"
  45. />
  46. </div>
  47. <div class="form__field">
  48. <label for="slug" class="form__label">Slug</label>
  49. <input
  50. class="form__text-field"
  51. type="text"
  52. name="slug"
  53. required
  54. value="{% if post %}{{ post.slug }}{% endif %}"
  55. />
  56. </div>
  57. <div class="form__field">
  58. <label for="body" class="form__label">Body</label>
  59. <div class="editor-helpers">
  60. <button class="btn" data-editor-helper="bold">bold</button>
  61. <button class="btn" data-editor-helper="italic">italic</button>
  62. <button class="btn" data-editor-helper="link">link</button>
  63. <button class="btn" data-editor-helper="code">code</button>
  64. </div>
  65. <textarea
  66. class="form__textarea"
  67. name="body"
  68. required
  69. >{% if post %}{{ post.body }}{% endif %}</textarea>
  70. </div>
  71. <div class="form__field">
  72. <a class="btn" href="#" data-preview>Preview</a>
  73. <input class="btn btn--green" type="submit" value="Post" />
  74. </div>
  75. </form>
  76. {% endmacro %}