| 1 |
{% extends 'base.html' %} |
| 2 |
|
| 3 |
{% block header %} |
| 4 |
<h1>{% block title %}Posts{% endblock %}</h1> |
| 5 |
{% if g.user %} |
| 6 |
<a class="action" href="{{ url_for('blog.create') }}">New</a> |
| 7 |
{% endif %} |
| 8 |
{% endblock %} |
| 9 |
|
| 10 |
{% block content %} |
| 11 |
{% for post in posts %} |
| 12 |
<article class="post"> |
| 13 |
<header> |
| 14 |
<div> |
| 15 |
<h1>{{ post['title'] }}</h1> |
| 16 |
<div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div> |
| 17 |
</div> |
| 18 |
{% if g.user['id'] == post['author_id'] %} |
| 19 |
<a class="action" href="{{ url_for('blog.update', id=post['id']) }}">Edit</a> |
| 20 |
{% endif %} |
| 21 |
</header> |
| 22 |
<p class="body">{{ post['body'] }}</p> |
| 23 |
</article> |
| 24 |
{% if not loop.last %} |
| 25 |
<hr> |
| 26 |
{% endif %} |
| 27 |
{% endfor %} |
| 28 |
{% endblock %} |