2018-02-09 14:39:05 -08:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
|
|
|
|
|
|
{% block header %}
|
2024-09-09 22:12:43 +00:00
|
|
|
<h1 id="toggle-all">Posts</h1>
|
2018-02-09 14:39:05 -08:00
|
|
|
{% if g.user %}
|
|
|
|
|
<a class="action" href="{{ url_for('blog.create') }}">New</a>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
{% for post in posts %}
|
|
|
|
|
<article class="post">
|
2024-09-09 22:25:18 +00:00
|
|
|
<header class="post-header">
|
2018-02-09 14:39:05 -08:00
|
|
|
<div>
|
2024-09-09 22:25:18 +00:00
|
|
|
<h1 onclick="togglePostBody({{ post['id'] }})">{{ post['title'] }}</h1>
|
2018-02-09 14:39:05 -08:00
|
|
|
<div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% if g.user['id'] == post['author_id'] %}
|
|
|
|
|
<a class="action" href="{{ url_for('blog.update', id=post['id']) }}">Edit</a>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</header>
|
2024-09-09 22:12:43 +00:00
|
|
|
<p class="body" id="post-body-{{ post['id'] }}">{{ post['body'] }}</p>
|
2018-02-09 14:39:05 -08:00
|
|
|
</article>
|
|
|
|
|
{% if not loop.last %}
|
|
|
|
|
<hr>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endfor %}
|
2024-09-09 22:12:43 +00:00
|
|
|
<script src="{{ url_for('static', filename='collapse.js') }}"></script>
|
2018-02-09 14:39:05 -08:00
|
|
|
{% endblock %}
|