annoucment logic implemented, fixing looks
This commit is contained in:
@@ -19,7 +19,44 @@
|
||||
|
||||
<div class="home-placeholder">
|
||||
<h2><i class="fas fa-bullhorn"></i> Announcements</h2>
|
||||
<p class="home-placeholder-text">Placeholder — news and updates will live here.</p>
|
||||
<div class="announce-panel">
|
||||
{% for a in announcements %}
|
||||
<div class="announce-item{% if a.pk not in global_read_ids and user.is_authenticated %} announce-unread{% endif %}">
|
||||
<a href="{% url 'announcements:detail' a.pk %}">{{ a.title }}</a>
|
||||
<span class="announce-meta">{{ a.created_at|date:"M j" }}{% if a.comments_count %} · {{ a.comments_count }} comment{{ a.comments_count|pluralize }}{% endif %}</span>
|
||||
</div>
|
||||
{% empty %}
|
||||
<p class="empty-hint">No announcements yet.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if announcements_total > 4 %}
|
||||
<a href="{% url 'announcements:list' %}" class="announce-more">View all ({{ announcements_total }}) <i class="fas fa-arrow-right"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
<h2 class="announce-subhead"><i class="fas fa-bell"></i> For you
|
||||
{% if unread_notifications %}<span class="announce-badge">{{ unread_notifications }}</span>{% endif %}
|
||||
</h2>
|
||||
<div class="announce-panel">
|
||||
{% for n in notifications %}
|
||||
<div class="announce-item{% if not n.read %} announce-unread{% endif %}">
|
||||
<a href="{% url 'library:project_detail' n.project.slug %}">{{ n.text }}</a>
|
||||
<span class="announce-meta">{{ n.created_at|timesince }} ago</span>
|
||||
</div>
|
||||
{% empty %}
|
||||
<p class="empty-hint">Nothing new for you yet.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="announce-actions">
|
||||
<a href="{% url 'announcements:personal' %}" class="announce-more">All your alerts <i class="fas fa-arrow-right"></i></a>
|
||||
{% if unread_notifications %}
|
||||
<form method="post" action="{% url 'announcements:mark_all_read' %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="link-btn">Mark all read</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="home-stats">
|
||||
|
||||
Reference in New Issue
Block a user