123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- {% macro post(post, type) %}
- <div class="post">
- <h3 class="post__heading">
- <span class="post__title">
- {{ post.title }} <span class="post__date">:: {{ post.date }}</span>
- </span>
- <div class="post__links">
- {% if type == "index" %}
- <a class="post__link" href="/posts/{{ post.id }}">view</a>
- {% endif %}
-
- {% if logged_in %}
- <a class="post__link" href="/posts/{{ post.id }}/edit">edit</a>
- <span class="post__link danger" data-delete="{{ post.id }}">delete</span>
- {% endif %}
- </div>
- </h3>
-
- {% 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.id }}{% 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="body" class="form__label">Body</label>
- <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 %}
|