1234567891011121314151617181920212223242526272829303132333435363738 |
- {% extends "layout.html" %} {% block content %}
- {% if logged_in %}
- <h1 class="heading">New Post</h1>
- <form class="form" method="POST" action="/posts">
- <input type="hidden" name="id" />
- <input type="hidden" name="date" />
- <div class="form__field">
- <label for="title" class="form__label">Title</label>
- <input class="form__text-field" type="text" name="title" required />
- </div>
- <div class="form__field">
- <label for="body" class="form__label">Body</label>
- <textarea class="form__textarea" name="body" required></textarea>
- </div>
- <div class="form__field">
- <input class="form__button" type="submit" value="Post" />
- </div>
- </form>
- {% endif %}
-
- <div class="posts">
- {% for post in posts %}
- <div class="posts__post post">
- <h3 class="post__heading">
- {% if logged_in %}
- <a class="post__edit-link" href="/posts/{{ post.id }}/edit">edit</a>
- {% endif %}
- <span>
- {{ post.title }} :: {{ post.date }}
- </span>
- </h3>
- <div class="post__body">
- {{ post.body | safe }}
- </div>
- </div>
- {% endfor %}
- </div>
- {% endblock %}
|