mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Highlight unread notifications
This commit is contained in:
parent
3ddd4a0490
commit
e8cfa99cd9
3 changed files with 8 additions and 1 deletions
|
@ -221,3 +221,7 @@ th, td {
|
|||
.post.depth-4 {
|
||||
margin-left: 3em;
|
||||
}
|
||||
|
||||
.unread {
|
||||
background-color: #F3FFBD;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<button type="submit">Delete notifications</button>
|
||||
</form>
|
||||
{% for notification in notifications %}
|
||||
<div class="notification{% if not notification.read %}unread{% endif %}">
|
||||
<div class="notification{% if notification.id in unread %} unread{% endif %}">
|
||||
<p>
|
||||
{% if notification.notification_type == 'FAVORITE' %}
|
||||
{% include 'snippets/username.html' with user=notification.related_user %}
|
||||
|
|
|
@ -139,12 +139,15 @@ def register(request):
|
|||
return redirect('/')
|
||||
|
||||
|
||||
@login_required
|
||||
def notifications_page(request):
|
||||
''' list notitications '''
|
||||
notifications = request.user.notification_set.all() \
|
||||
.order_by('-created_date')
|
||||
unread = [n.id for n in notifications.filter(read=False)]
|
||||
data = {
|
||||
'notifications': notifications,
|
||||
'unread': unread,
|
||||
}
|
||||
notifications.update(read=True)
|
||||
return TemplateResponse(request, 'notifications.html', data)
|
||||
|
|
Loading…
Reference in a new issue