feat: Show notifications on profile

This commit is contained in:
moanos [he/him] 2024-08-02 20:44:33 +02:00
parent 198fb88bfd
commit 63f542da81
5 changed files with 27 additions and 4 deletions

View File

@ -457,7 +457,7 @@ select, button {
} }
} }
.container-comments { .container-comments, .container-cards {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
background: var(--background-two); background: var(--background-two);
@ -465,7 +465,7 @@ select, button {
padding: 5px; padding: 5px;
} }
.comment { .comment, .notification {
flex: 1 100%; flex: 1 100%;
margin: 10px; margin: 10px;
border-radius: 8px; border-radius: 8px;

View File

@ -14,7 +14,11 @@
{% endif %} {% endif %}
{% if user.id is request.user.id %} {% if user.id is request.user.id %}
<h2>{% translate 'Benachrichtigungen' %}</h2>
{% include "fellchensammlung/lists/list-notifications.html" %}
<h2>{% translate 'Meine Vermittlungen' %}</h2> <h2>{% translate 'Meine Vermittlungen' %}</h2>
{% include "fellchensammlung/lists/list-adoption-notices.html" %} {% include "fellchensammlung/lists/list-adoption-notices.html" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,5 @@
<div class="container-cards">
{% for notification in notifications %}
{% include "fellchensammlung/partials/partial-notification.html" %}
{% endfor %}
</div>

View File

@ -0,0 +1,12 @@
{% load i18n %}
{% load custom_tags %}
<div class="notification">
<div class="notification-header">
<b>{{ notification.title }}</b>
{{ notification.created_at }}
<a class="adoption-card-report-link" href=""><i class="fa-solid fa-check"></i></a>
</div>
<p>
{{ notification.text | render_markdown }}
</p>
</div>

View File

@ -12,7 +12,7 @@ from notfellchen import settings
from fellchensammlung import logger from fellchensammlung import logger
from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, ModerationAction, \ from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, ModerationAction, \
User, Location, AdoptionNoticeStatus, Subscriptions, CommentNotification User, Location, AdoptionNoticeStatus, Subscriptions, CommentNotification, BaseNotification
from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageForm, ReportAdoptionNoticeForm, \ from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageForm, ReportAdoptionNoticeForm, \
CommentForm, ReportCommentForm, AnimalForm, \ CommentForm, ReportCommentForm, AnimalForm, \
AdoptionNoticeSearchForm, AnimalFormWithDateWidget AdoptionNoticeSearchForm, AnimalFormWithDateWidget
@ -316,7 +316,9 @@ def report_detail_success(request, report_id):
def user_detail(request, user_id): def user_detail(request, user_id):
user = User.objects.get(id=user_id) user = User.objects.get(id=user_id)
context = {"user": user, "adoption_notices": AdoptionNotice.objects.filter(created_by=user)} context = {"user": user,
"adoption_notices": AdoptionNotice.objects.filter(created_by=user),
"notifications": BaseNotification.objects.filter(user=user, read=False)}
return render(request, 'fellchensammlung/details/detail-user.html', context=context) return render(request, 'fellchensammlung/details/detail-user.html', context=context)