Notifications

This commit is contained in:
Mouse Reeve
2020-09-29 14:45:04 -07:00
parent 0bea615b82
commit 767190e012
5 changed files with 67 additions and 40 deletions

View File

@ -9,9 +9,9 @@
</div>
{% endfor %}
<div>
<nav class="pagination" role="navigation" aria-label="pagination">
{% if prev %}
<p>
<p class="pagination-previous">
<a href="{{ prev }}">
<span class="icon icon-arrow-left"></span>
Previous
@ -20,13 +20,13 @@
{% endif %}
{% if next %}
<p class="next">
<p class="pagination-next">
<a href="{{ next }}">
Next
<span class="icon icon-arrow-right"></span>
</a>
</p>
{% endif %}
</div>
</nav>
</div>
{% endblock %}

View File

@ -82,7 +82,9 @@
<span class="icon icon-bell">
<span class="hidden-text">Notitications</span>
</span>
{% if request.user|notification_count %}<span class="count">{{ request.user | notification_count }}</span>{% endif %}
{% if request.user|notification_count %}
<span class="bubble">{{ request.user | notification_count }}</span>
{% endif %}
</a>
</div>
</div>

View File

@ -1,46 +1,52 @@
{% extends 'layout.html' %}
{% load humanize %}l
{% block content %}
<div class="content-container">
<h2>Notifications</h2>
<div class="block">
<h2 class="title">Notifications</h2>
<form name="clear" action="/clear-notifications" method="POST">
{% csrf_token %}
<button type="submit" class="secondary">Delete notifications</button>
<button class="button is-danger" type="submit" class="secondary">Delete notifications</button>
</form>
</div>
<div class="content-container">
<div class="block">
{% for notification in notifications %}
<div class="notification{% if notification.id in unread %} unread{% endif %}">
<small class="time-ago">{{ notification.created_date | naturaltime }}</small>
{% if notification.related_user %}
{% include 'snippets/username.html' with user=notification.related_user %}
{% if notification.notification_type == 'FAVORITE' %}
favorited your
<a href="{{ notification.related_status.remote_id}}">status</a>
<div class="notification level{% if notification.id in unread %} is-primary{% endif %}">
<div class="level-left">
<p>
{% if notification.related_user %}
{% include 'snippets/avatar.html' with user=notification.related_user %}
{% include 'snippets/username.html' with user=notification.related_user %}
{% if notification.notification_type == 'FAVORITE' %}
favorited your
<a href="{{ notification.related_status.remote_id}}">status</a>
{% elif notification.notification_type == 'REPLY' %}
<a href="{{ notification.related_status.remote_id}}">replied</a>
to your
<a href="{{ notification.related_status.reply_parent.remote_id}}">status</a>
{% elif notification.notification_type == 'REPLY' %}
<a href="{{ notification.related_status.remote_id}}">replied</a>
to your
<a href="{{ notification.related_status.reply_parent.remote_id}}">status</a>
{% elif notification.notification_type == 'FOLLOW' %}
followed you
{% elif notification.notification_type == 'FOLLOW' %}
followed you
{% elif notification.notification_type == 'FOLLOW_REQUEST' %}
sent you a follow request
<div class="row shrink">
{% include 'snippets/follow_request_buttons.html' with user=notification.related_user %}
</div>
{% elif notification.notification_type == 'FOLLOW_REQUEST' %}
sent you a follow request
<div class="row shrink">
{% include 'snippets/follow_request_buttons.html' with user=notification.related_user %}
</div>
{% elif notification.notification_type == 'BOOST' %}
boosted your <a href="{{ notification.related_status.remote_id}}">status</a>
{% endif %}
{% else %}
your <a href="/import_status/{{ notification.related_import.id }}">import</a> completed.
{% elif notification.notification_type == 'BOOST' %}
boosted your <a href="{{ notification.related_status.remote_id}}">status</a>
{% endif %}
{% else %}
your <a href="/import_status/{{ notification.related_import.id }}">import</a> completed.
{% endif %}
{% endif %}
</p>
</div>
<p class="level-right">{{ notification.created_date | naturaltime }}</p>
</div>
{% endfor %}
{% if not notifications %}

View File

@ -35,7 +35,7 @@
{% endif %}
{% if status.quote %}
<div class="quote">
<div class="quote block">
<blockquote>{{ status.quote }}</blockquote>
<p> &mdash; {% include 'snippets/book_titleby.html' with book=status.book %}</p>