49 lines
1.8 KiB
HTML
49 lines
1.8 KiB
HTML
{% extends 'base.html' %}
|
|
{% load markdown %}
|
|
|
|
{% block title %}Announcements - Packs Site{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="home-section-header">
|
|
<h1><i class="fas fa-bullhorn"></i> Announcements</h1>
|
|
{% if user.is_staff %}
|
|
<a href="{% url 'announcements:create' %}" class="btn btn-primary"><i class="fas fa-plus"></i> New announcement</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="announce-list">
|
|
{% for a in page %}
|
|
<article class="card announce-card">
|
|
<h2>
|
|
<a href="{% url 'announcements:detail' a.pk %}">{{ a.title }}</a>
|
|
{% if user.is_authenticated and a.pk not in read_ids %}
|
|
<span class="announce-badge">new</span>
|
|
{% endif %}
|
|
</h2>
|
|
<div class="markdown-body announce-excerpt">{{ a.body|markdown|truncatechars_html:320 }}</div>
|
|
<p class="announce-meta">
|
|
<i class="fas fa-user"></i> {{ a.created_by.username|default:"Staff" }}
|
|
<span class="separator">•</span>
|
|
{{ a.created_at|date:"F j, Y" }}
|
|
<span class="separator">•</span>
|
|
<i class="fas fa-comments"></i> {{ a.comments_count }} comment{{ a.comments_count|pluralize }}
|
|
</p>
|
|
</article>
|
|
{% empty %}
|
|
<p class="empty-hint">No announcements yet.</p>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if page.has_other_pages %}
|
|
<div class="pagination">
|
|
{% if page.has_previous %}
|
|
<a href="?page={{ page.previous_page_number }}">«</a>
|
|
{% endif %}
|
|
<span>Page {{ page.number }} of {{ page.paginator.num_pages }}</span>
|
|
{% if page.has_next %}
|
|
<a href="?page={{ page.next_page_number }}">»</a>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|