12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- {% macro post(post, type) %}
- <div class="post">
-
- <div class="post__heading">
- <div class="post__title">
- <span class="post__date">:: {{ post.date }} //</span>
- <a class="post__link" href="/posts/{{ post.slug }}">
- {{ post.title }}
- </a>
- </div>
- {% if logged_in %}
- <div class="post__meta">
- <a class="post__link" href="/posts/{{ post.slug }}/edit">edit</a>
- <span class="post__link danger" data-delete="{{ post.slug }}">delete</span>
- </div>
- {% endif %}
- </div>
-
- {% if type != "index" %}
- <div class="post__body">
- {{ post.html | safe }}
- </div>
- {% endif %}
- </div>
- {% endmacro %}
-
- {% macro form(post=false, action) %}
- <form class="form" method="POST" action="{{ action }}" id="post-form">
- <input
- type="hidden"
- name="id"
- value="{% if post %}{{ post.slug }}{% endif %}"
- />
- <input
- type="hidden"
- name="date"
- value="{% if post %}{{ post.date }}{% endif %}"
- />
- <input type="hidden" name="html" />
- <div class="form__field">
- <label for="title" class="form__label">Title</label>
- <input
- class="form__text-field"
- type="text"
- name="title"
- required
- value="{% if post %}{{ post.title }}{% endif %}"
- />
- </div>
- <div class="form__field">
- <label for="slug" class="form__label">Slug</label>
- <input
- class="form__text-field"
- type="text"
- name="slug"
- required
- value="{% if post %}{{ post.slug }}{% endif %}"
- />
- </div>
- <div class="form__field">
- <label for="body" class="form__label">Body</label>
- <div class="editor-helpers">
- <button class="btn" data-editor-helper="bold">bold</button>
- <button class="btn" data-editor-helper="italic">italic</button>
- <button class="btn" data-editor-helper="link">link</button>
- <button class="btn" data-editor-helper="code">code</button>
- </div>
- <textarea
- class="form__textarea"
- name="body"
- required
- >{% if post %}{{ post.body }}{% endif %}</textarea>
- </div>
- <div class="form__field">
- <a class="btn" href="#" data-preview>Preview</a>
- <input class="btn" type="submit" value="Post" />
- </div>
- </form>
- {% endmacro %}
|