Initial commit: simpleblog
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<section class="comments-section" aria-label="Comments">
|
||||
<h2 class="page-heading">Comments</h2>
|
||||
|
||||
{% if not comments_enabled %}
|
||||
<p class="empty-state">Comments are closed.</p>
|
||||
{% else %}
|
||||
{% if comment_count > 0 %}
|
||||
<p class="field-hint">{{ comment_count }} comment{{ 's' if comment_count != 1 }} so far.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if comments %}
|
||||
<div class="comment-list">
|
||||
{% for c in comments %}
|
||||
<article class="comment-block" data-comment-id="{{ c.id }}">
|
||||
<div class="comment-meta">
|
||||
<span class="comment-author">{{ c.author }}</span>
|
||||
<time datetime="{{ c.created_at }}">{{ parse_date(c.created_at) }}</time>
|
||||
</div>
|
||||
<div class="comment-body">{{ render_markdown(c.body) }}</div>
|
||||
{% if logged_in and c.author == session.get('username') %}
|
||||
<form method="post" action="{{ url_for('public.public_comment_delete', cid=c.id) }}" style="display:inline;" onsubmit="return confirm('Delete this comment?');">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button class="btn btn-sm btn-danger" type="submit">Delete my comment</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="empty-state">No comments yet — be the first!</p>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% if object_type == 'post' %}{{ url_for('public.post_comment', slug=slug) }}{% else %}{{ url_for('public.page_comment', slug=slug) }}{% endif %}" class="comment-form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
{# Bot traps (hidden, no visual change): a field humans never fill in and
|
||||
the time this page was rendered. #}
|
||||
<div hidden aria-hidden="true">
|
||||
<label for="c-website">Website</label>
|
||||
<input type="text" id="c-website" name="website" tabindex="-1" autocomplete="off">
|
||||
</div>
|
||||
<input type="hidden" name="ts" value="{{ now_ts }}">
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="c-author">Name</label>
|
||||
<input type="text" id="c-author" name="author" required autocomplete="name" placeholder="Your name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="c-email">Email <small>(optional, not published)</small></label>
|
||||
<input type="email" id="c-email" name="email" autocomplete="email" placeholder="you@example.com">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="c-body">Comment</label>
|
||||
<textarea id="c-body" name="body" rows="4" required placeholder="Share your thoughts…"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary">Post comment</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
Reference in New Issue
Block a user