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.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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="date"
  29. value="{% if post %}{{ post.date }}{% endif %}"
  30. />
  31. <input type="hidden" name="html" />
  32. <div class="form__field">
  33. <label for="title" class="form__label">Title</label>
  34. <input
  35. class="form__text-field"
  36. type="text"
  37. name="title"
  38. required
  39. value="{% if post %}{{ post.title }}{% endif %}"
  40. />
  41. </div>
  42. <div class="form__field">
  43. <label for="slug" class="form__label">Slug</label>
  44. <input
  45. class="form__text-field"
  46. type="text"
  47. name="slug"
  48. required
  49. value="{% if post %}{{ post.slug }}{% endif %}"
  50. />
  51. </div>
  52. <div class="form__field">
  53. <label for="body" class="form__label">Body</label>
  54. <div class="editor-helpers">
  55. <button class="btn" data-editor-helper="bold">bold</button>
  56. <button class="btn" data-editor-helper="italic">italic</button>
  57. <button class="btn" data-editor-helper="link">link</button>
  58. <button class="btn" data-editor-helper="code">code</button>
  59. </div>
  60. <textarea
  61. class="form__textarea"
  62. name="body"
  63. required
  64. >{% if post %}{{ post.body }}{% endif %}</textarea>
  65. </div>
  66. <div class="form__field">
  67. <label for="draft">
  68. Save as Draft?
  69. <input type="checkbox" name="draft" value="1" {% if post.draft %}checked{% endif %}>
  70. </label>
  71. </div>
  72. <div class="form__field">
  73. <a class="btn" href="#" data-preview>Preview</a>
  74. <input class="btn btn--green" type="submit" value="Post">
  75. </div>
  76. </form>
  77. {% endmacro %}