2020-03-07 22:50:29 +00:00
{% extends 'layout.html' %}
2021-02-28 00:44:58 +00:00
{% load i18n %}
2020-12-13 02:25:04 +00:00
{% load bookwyrm_tags %}
2021-05-11 22:14:42 +00:00
{% load humanize %}
2021-02-28 18:00:36 +00:00
{% block title %}{% trans "Notifications" %}{% endblock %}
2020-03-07 22:50:29 +00:00
{% block content %}
2021-05-07 21:00:55 +00:00
< header class = "columns" >
< div class = "column" >
< h1 class = "title" > {% trans "Notifications" %}< / h1 >
< / div >
2020-03-07 22:50:29 +00:00
2021-05-07 21:00:55 +00:00
< form name = "clear" action = "/notifications" method = "POST" class = "column is-narrow" >
2020-03-17 01:05:49 +00:00
{% csrf_token %}
2021-02-27 22:22:39 +00:00
< button class = "button is-danger is-light" type = "submit" class = "secondary" > {% trans "Delete notifications" %}< / button >
2020-03-17 01:05:49 +00:00
< / form >
2021-05-07 21:00:55 +00:00
< / header >
< div class = "block" >
< nav class = "tabs" >
< ul >
{% url 'notifications' as tab_url %}
< li { % if tab_url = = request . path % } class = "is-active" { % endif % } >
< a href = "{{ tab_url }}" > {% trans "All" %}< / a >
< / li >
{% url 'notifications' 'mentions' as tab_url %}
< li { % if tab_url = = request . path % } class = "is-active" { % endif % } >
< a href = "{{ tab_url }}" > {% trans "Mentions" %}< / a >
< / li >
< / ul >
< / nav >
2020-03-17 01:05:49 +00:00
< / div >
2020-09-29 21:45:04 +00:00
< div class = "block" >
2020-03-17 01:05:49 +00:00
{% for notification in notifications %}
2021-01-06 23:53:09 +00:00
{% related_status notification as related_status %}
2020-12-11 19:26:34 +00:00
< div class = "notification {% if notification.id in unread %} is-primary{% endif %}" >
2021-01-06 23:53:09 +00:00
< div class = "columns is-mobile" >
< div class = "column is-narrow is-size-3 {% if notification.id in unread%}has-text-white{% else %}has-text-grey{% endif %}" >
{% if notification.notification_type == 'MENTION' %}
< span class = "icon icon-comment" > < / span >
2020-09-29 21:45:04 +00:00
{% elif notification.notification_type == 'REPLY' %}
2021-01-06 23:53:09 +00:00
< span class = "icon icon-comments" > < / span >
{% elif notification.notification_type == 'FOLLOW' or notification.notification_type == 'FOLLOW_REQUEST' %}
< span class = "icon icon-local" > < / span >
2020-09-29 21:45:04 +00:00
{% elif notification.notification_type == 'BOOST' %}
2021-01-06 23:53:09 +00:00
< span class = "icon icon-boost" > < / span >
{% elif notification.notification_type == 'FAVORITE' %}
< span class = "icon icon-heart" > < / span >
2021-01-07 02:02:46 +00:00
{% elif notification.notification_type == 'IMPORT' %}
< span class = "icon icon-list" > < / span >
2021-02-10 21:46:56 +00:00
{% elif notification.notification_type == 'ADD' %}
< span class = "icon icon-plus" > < / span >
2021-03-16 19:57:23 +00:00
{% elif notification.notification_type == 'REPORT' %}
< span class = "icon icon-warning" > < / span >
2020-09-29 21:45:04 +00:00
{% endif %}
2021-01-06 23:53:09 +00:00
< / div >
< div class = "column" >
< div class = "block" >
< p >
{# DESCRIPTION #}
{% if notification.related_user %}
2021-03-07 18:24:46 +00:00
< a href = "{{ notification.related_user.local_path }}" >
{% include 'snippets/avatar.html' with user=notification.related_user %}
{{ notification.related_user.display_name }}
< / a >
2021-02-10 21:46:56 +00:00
{% if notification.notification_type == 'FAVORITE' %}
2021-03-01 17:32:03 +00:00
{% if related_status.status_type == 'Review' %}
{% blocktrans with book_title=related_status.book.title related_path=related_status.local_path %}favorited your < a href = "{{ related_path }}" > review of < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% elif related_status.status_type == 'Comment' %}
{% blocktrans with book_title=related_status.book.title related_path=related_status.local_path %}favorited your < a href = "{{ related_path }}" > comment on < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% elif related_status.status_type == 'Quotation' %}
{% blocktrans with book_title=related_status.book.title related_path=related_status.local_path %}favorited your < a href = "{{ related_path }}" > quote from < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% else %}
{% blocktrans with related_path=related_status.local_path %}favorited your < a href = "{{ related_path }}" > status< / a > {% endblocktrans %}
{% endif %}
2021-01-06 23:53:09 +00:00
2021-02-10 21:46:56 +00:00
{% elif notification.notification_type == 'MENTION' %}
2021-03-01 17:32:03 +00:00
{% if related_status.status_type == 'Review' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}mentioned you in a < a href = "{{ related_path }}" > review of < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% elif related_status.status_type == 'Comment' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}mentioned you in a < a href = "{{ related_path }}" > comment on < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% elif related_status.status_type == 'Quotation' %}
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}mentioned you in a < a href = "{{ related_path }}" > quote from < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% else %}
{% blocktrans with related_path=related_status.local_path %}mentioned you in a < a href = "{{ related_path }}" > status< / a > {% endblocktrans %}
{% endif %}
2021-01-06 23:53:09 +00:00
2021-02-10 21:46:56 +00:00
{% elif notification.notification_type == 'REPLY' %}
2021-03-01 17:32:03 +00:00
{% if related_status.status_type == 'Review' %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path book_title=related_status.reply_parent.book.title %}< a href = "{{ related_path }}" > replied< / a > to your < a href = "{{ parent_path }}" > review of < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% elif related_status.status_type == 'Comment' %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path book_title=related_status.reply_parent.book.title %}< a href = "{{ related_path }}" > replied< / a > to your < a href = "{{ parent_path }}" > comment on < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% elif related_status.status_type == 'Quotation' %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path book_title=related_status.reply_parent.book.title %}< a href = "{{ related_path }}" > replied< / a > to your < a href = "{{ parent_path }}" > quote from < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
{% else %}
{% blocktrans with related_path=related_status.local_path parent_path=related_status.reply_parent.local_path %}< a href = "{{ related_path }}" > replied< / a > to your < a href = "{{ parent_path }}" > status< / a > {% endblocktrans %}
{% endif %}
2021-02-28 02:48:10 +00:00
2021-02-10 21:46:56 +00:00
{% elif notification.notification_type == 'FOLLOW' %}
2021-02-28 02:48:10 +00:00
{% trans "followed you" %}
2021-02-10 21:46:56 +00:00
{% include 'snippets/follow_button.html' with user=notification.related_user %}
{% elif notification.notification_type == 'FOLLOW_REQUEST' %}
2021-02-28 02:48:10 +00:00
{% trans "sent you a follow request" %}
2021-02-10 21:46:56 +00:00
< div class = "row shrink" >
{% include 'snippets/follow_request_buttons.html' with user=notification.related_user %}
< / div >
{% elif notification.notification_type == 'BOOST' %}
2021-03-01 17:32:03 +00:00
{% if related_status.status_type == 'Review' %}
2021-03-04 16:04:55 +00:00
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}boosted your < a href = "{{ related_path }}" > review of < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
2021-03-01 17:32:03 +00:00
{% elif related_status.status_type == 'Comment' %}
2021-03-04 16:04:55 +00:00
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}boosted your < a href = "{{ related_path }}" > comment on< em > {{ book_title }}< / em > < / a > {% endblocktrans %}
2021-03-01 17:32:03 +00:00
{% elif related_status.status_type == 'Quotation' %}
2021-03-04 16:04:55 +00:00
{% blocktrans with related_path=related_status.local_path book_title=related_status.book.title %}boosted your < a href = "{{ related_path }}" > quote from < em > {{ book_title }}< / em > < / a > {% endblocktrans %}
2021-03-01 17:32:03 +00:00
{% else %}
{% blocktrans with related_path=related_status.local_path %}boosted your < a href = "{{ related_path }}" > status< / a > {% endblocktrans %}
{% endif %}
2021-02-10 21:46:56 +00:00
{% elif notification.notification_type == 'ADD' %}
2021-03-01 17:32:03 +00:00
{% if notification.related_list_item.approved %}
{% blocktrans with book_path=notification.related_list_item.book.local_path book_title=notification.related_list_item.book.title list_path=notification.related_list_item.book_list.local_path list_name=notification.related_list_item.book_list.name %} added < em > < a href = "{{ book_path }}" > {{ book_title }}< / a > < / em > to your list "< a href = "{{ list_path }}" > {{ list_name }}< / a > "{% endblocktrans %}
{% else %}
{% blocktrans with book_path=notification.related_list_item.book.local_path book_title=notification.related_list_item.book.title list_path=notification.related_list_item.book_list.local_path list_name=notification.related_list_item.book_list.name %} suggested adding < em > < a href = "{{ book_path }}" > {{ book_title }}< / a > < / em > to your list "< a href = "{{ list_path }}/curate" > {{ list_name }}< / a > "{% endblocktrans %}
{% endif %}
2021-02-10 21:46:56 +00:00
{% endif %}
{% elif notification.related_import %}
2021-05-04 16:45:13 +00:00
{% url 'import-status' notification.related_import.id as url %}
{% blocktrans %}Your < a href = "{{ url }}" > import< / a > completed.{% endblocktrans %}
2021-03-16 19:57:23 +00:00
{% elif notification.related_report %}
{% url 'settings-report' notification.related_report.id as path %}
{% blocktrans with related_id=path %}A new < a href = "{{ path }}" > report< / a > needs moderation.{% endblocktrans %}
2021-01-06 23:53:09 +00:00
{% endif %}
< / p >
< / div >
{% if related_status %}
< div class = "block" >
{# PREVIEW #}
< div class = "notification py-2 {% if notification.id in unread %}is-primary is-light{% else %}has-background-white{% if notification.notification_type == 'REPLY' or notification.notification_type == 'MENTION' %} has-text-black{% else %}-bis has-text-grey-dark{% endif %}{% endif %}" >
< div class = "columns" >
< div class = "column" >
2021-03-12 01:38:21 +00:00
{% include 'snippets/status_preview.html' with status=related_status %}
2021-01-06 23:53:09 +00:00
< / div >
< div class = "column is-narrow {% if notification.notification_type == 'REPLY' or notification.notification_type == 'MENTION' %}has-text-black{% else %}has-text-grey-dark{% endif %}" >
2021-04-19 23:33:28 +00:00
{{ related_status.published_date|timesince }}
2021-01-06 23:53:09 +00:00
{% include 'snippets/privacy-icons.html' with item=related_status %}
< / div >
< / div >
2020-12-11 19:26:34 +00:00
< / div >
< / div >
2021-01-06 23:53:09 +00:00
{% endif %}
2020-12-11 19:26:34 +00:00
< / div >
< / div >
2020-03-07 22:50:29 +00:00
< / div >
2020-03-17 01:05:49 +00:00
{% endfor %}
2020-12-11 19:26:34 +00:00
2020-03-17 01:05:49 +00:00
{% if not notifications %}
2021-02-27 22:22:39 +00:00
< p > {% trans "You're all caught up!" %}< / p >
2020-03-17 01:05:49 +00:00
{% endif %}
2020-03-07 22:50:29 +00:00
< / div >
{% endblock %}