diff --git a/src/fellchensammlung/static/fellchensammlung/css/styles.css b/src/fellchensammlung/static/fellchensammlung/css/styles.css index 453bc39..8956a07 100644 --- a/src/fellchensammlung/static/fellchensammlung/css/styles.css +++ b/src/fellchensammlung/static/fellchensammlung/css/styles.css @@ -457,7 +457,7 @@ select, button { } } -.container-comments { +.container-comments, .container-cards { display: flex; flex-wrap: wrap; background: var(--background-two); @@ -465,7 +465,7 @@ select, button { padding: 5px; } -.comment { +.comment, .notification { flex: 1 100%; margin: 10px; border-radius: 8px; diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-user.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-user.html index d161d16..fbd54d3 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail-user.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-user.html @@ -14,7 +14,11 @@ {% endif %} {% if user.id is request.user.id %} + +

{% translate 'Benachrichtigungen' %}

+ {% include "fellchensammlung/lists/list-notifications.html" %}

{% translate 'Meine Vermittlungen' %}

{% include "fellchensammlung/lists/list-adoption-notices.html" %} + {% endif %} {% endblock %} \ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/lists/list-notifications.html b/src/fellchensammlung/templates/fellchensammlung/lists/list-notifications.html new file mode 100644 index 0000000..f794c5b --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/lists/list-notifications.html @@ -0,0 +1,5 @@ +
+ {% for notification in notifications %} + {% include "fellchensammlung/partials/partial-notification.html" %} + {% endfor %} +
diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-notification.html b/src/fellchensammlung/templates/fellchensammlung/partials/partial-notification.html new file mode 100644 index 0000000..1f1f0f8 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partials/partial-notification.html @@ -0,0 +1,12 @@ +{% load i18n %} +{% load custom_tags %} +
+
+ {{ notification.title }} + {{ notification.created_at }} + +
+

+ {{ notification.text | render_markdown }} +

+
diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index b9ce936..cdfdfa0 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -12,7 +12,7 @@ from notfellchen import settings from fellchensammlung import logger 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, \ CommentForm, ReportCommentForm, AnimalForm, \ AdoptionNoticeSearchForm, AnimalFormWithDateWidget @@ -316,7 +316,9 @@ def report_detail_success(request, report_id): def user_detail(request, 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)