moviewyrm/bookwyrm/templates/notifications.html

105 lines
6.3 KiB
HTML
Raw Normal View History

2020-03-07 22:50:29 +00:00
{% extends 'layout.html' %}
{% load humanize %}
2020-12-13 02:25:04 +00:00
{% load bookwyrm_tags %}
2020-03-07 22:50:29 +00:00
{% block content %}
2020-09-29 21:45:04 +00:00
<div class="block">
2020-11-09 20:06:44 +00:00
<h1 class="title">Notifications</h1>
2020-03-07 22:50:29 +00:00
2021-01-12 19:07:29 +00:00
<form name="clear" action="/notifications" method="POST">
2020-03-17 01:05:49 +00:00
{% csrf_token %}
2020-11-09 20:10:37 +00:00
<button class="button is-danger is-light" type="submit" class="secondary">Delete notifications</button>
2020-03-17 01:05:49 +00:00
</form>
</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 %}
<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>
{% elif notification.notification_type == 'IMPORT' %}
<span class="icon icon-list"></span>
{% elif notification.notification_type == 'ADD' %}
<span class="icon icon-plus"></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 %}
{% 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="{{ related_status.local_path }}">{{ related_status | status_preview_name|safe }}</a>
2021-01-06 23:53:09 +00:00
{% elif notification.notification_type == 'MENTION' %}
mentioned you in a
<a href="{{ related_status.local_path }}">{{ related_status | status_preview_name|safe }}</a>
2021-01-06 23:53:09 +00:00
{% elif notification.notification_type == 'REPLY' %}
<a href="{{ related_status.local_path }}">replied</a>
to your
<a href="{{ related_status.reply_parent.local_path }}">{{ related_status | status_preview_name|safe }}</a>
{% elif notification.notification_type == 'FOLLOW' %}
followed you
{% include 'snippets/follow_button.html' with user=notification.related_user %}
{% 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="{{ related_status.local_path }}">{{ related_status | status_preview_name|safe }}</a>
{% elif notification.notification_type == 'ADD' %}
{% if notification.related_list_item.approved %}added{% else %}suggested adding{% endif %} {% include 'snippets/book_titleby.html' with book=notification.related_list_item.book %} to your list "<a href="{{ notification.related_list_item.book_list.local_path }}{% if not notification.related_list_item.approved %}/curate{% endif %}">{{ notification.related_list_item.book_list.name }}</a>"
{% endif %}
{% elif notification.related_import %}
2021-01-12 19:28:03 +00:00
your <a href="/import/{{ notification.related_import.id }}">import</a> completed.
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">
{% if related_status.content %}
<a href="{{ related_status.local_path }}">{{ related_status.content | safe | truncatewords_html:10 }}</a>
{% elif related_status.quote %}
<a href="{{ related_status.local_path }}">{{ related_status.quote | safe | truncatewords_html:10 }}</a>
{% elif related_status.rating %}
{% include 'snippets/stars.html' with rating=related_status.rating %}
{% endif %}
</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 %}">
{{ related_status.published_date | post_date }}
{% include 'snippets/privacy-icons.html' with item=related_status %}
</div>
</div>
</div>
</div>
2021-01-06 23:53:09 +00:00
{% endif %}
</div>
</div>
2020-03-07 22:50:29 +00:00
</div>
2020-03-17 01:05:49 +00:00
{% endfor %}
2020-03-17 01:05:49 +00:00
{% if not notifications %}
<p>You're all caught up!</p>
{% endif %}
2020-03-07 22:50:29 +00:00
</div>
{% endblock %}