broadfield-dev's picture
Update templates/index.html
6af59d7 verified
raw
history blame contribute delete
969 Bytes
{% extends "base.html" %}
{% block content %}
<article>
<header><h2>Create a New Post</h2></header>
<form method="POST" action="{{ url_for('index') }}">
<textarea name="content" placeholder="Start a new conversation..." required></textarea>
<button type="submit">Post</button>
</form>
</article>
<hr>
<h2>Latest Posts</h2>
{% for post in posts %}
<article class="post">
<p>
<strong class="post-author">{{ post.username }}</strong>
<small class="post-date"> - {{ post.timestamp.strftime('%b %d, %H:%M') }} UTC</small>
</p>
<p>{{ post.content }}</p>
<footer>
<!-- Link to the full thread view -->
<a href="{{ url_for('view_chirp', chirp_id=post.id) }}">
View Thread ({{ post.children|length }} replies)
</a>
</footer>
</article>
{% else %}
<p>No posts yet. Be the first!</p>
{% endfor %}
{% endblock %}