forked from mirrors/bookwyrm
141 lines
11 KiB
HTML
141 lines
11 KiB
HTML
{% extends 'layout.html' %}
|
|
{% load i18n %}
|
|
{% load humanize %}
|
|
{% load bookwyrm_tags %}
|
|
|
|
{% block title %}{% trans "Notifications" %}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="block">
|
|
<h1 class="title">{% trans "Notifications" %}</h1>
|
|
|
|
<form name="clear" action="/notifications" method="POST">
|
|
{% csrf_token %}
|
|
<button class="button is-danger is-light" type="submit" class="secondary">{% trans "Delete notifications" %}</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="block">
|
|
{% for notification in notifications %}
|
|
{% related_status notification as related_status %}
|
|
<div class="notification {% if notification.id in unread %} is-primary{% endif %}">
|
|
<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>
|
|
{% elif notification.notification_type == 'REPLY' %}
|
|
<span class="icon icon-comments"></span>
|
|
{% elif notification.notification_type == 'FOLLOW' or notification.notification_type == 'FOLLOW_REQUEST' %}
|
|
<span class="icon icon-local"></span>
|
|
{% elif notification.notification_type == 'BOOST' %}
|
|
<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>
|
|
{% endif %}
|
|
</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' %}
|
|
{% 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 %}
|
|
|
|
{% elif notification.notification_type == 'MENTION' %}
|
|
{% 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 %}
|
|
|
|
{% elif notification.notification_type == 'REPLY' %}
|
|
{% 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 %}
|
|
|
|
{% elif notification.notification_type == 'FOLLOW' %}
|
|
{% trans "followed you" %}
|
|
{% include 'snippets/follow_button.html' with user=notification.related_user %}
|
|
{% elif notification.notification_type == 'FOLLOW_REQUEST' %}
|
|
{% trans "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' %}
|
|
{% if related_status.status_type == 'Review' %}
|
|
{% 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 %}
|
|
{% elif related_status.status_type == 'Comment' %}
|
|
{% 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 %}
|
|
{% elif related_status.status_type == 'Quotation' %}
|
|
{% 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 %}
|
|
{% else %}
|
|
{% blocktrans with related_path=related_status.local_path %}boosted your <a href="{{ related_path }}">status</a>{% endblocktrans %}
|
|
{% endif %}
|
|
{% elif notification.notification_type == 'ADD' %}
|
|
{% 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 %}
|
|
{% endif %}
|
|
{% elif notification.related_import %}
|
|
{% blocktrans with related_id=notification.related_import.id %} your <a href="/import/{{ related_id }}">import</a> completed.{% endblocktrans %}
|
|
{% 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>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
|
|
{% if not notifications %}
|
|
<p>{% trans "You're all caught up!" %}</p>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|