Benachrichtigungen noch verlinkt und Default-Link auf Benachrichtigungen gesetzt

This commit is contained in:
holger.trampe 2020-02-09 21:54:45 +01:00
parent 1ba4da5b89
commit 71771d3183
3 changed files with 6 additions and 3 deletions

View File

@ -111,5 +111,5 @@ def save_news(sender, instance, **kwargs):
)
if(user.profile.news_push):
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews")
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews", elementid=instance.pk)
newnotification.save()

View File

@ -490,6 +490,8 @@ getDimensions();
*/
newunknownotificationscounter = 0;
function loadUnsendNotifications(){
$.ajax(
{
@ -503,7 +505,7 @@ function loadUnsendNotifications(){
notifications = data['unknownnotification'];
var i = 0;
for (var key in notifications) {
$("#notification_items").append('<a id="notifyid_'+notifications[i]['not_id']+'" class="dropdown-item d-flex align-items-center" onclick="removeNotification('+notifications[i]['not_id']+')"><div><div class="small text-gray-500">'+notifications[i]['date']+'</div>'+notifications[i]['text']+'</div></a>')
$("#notification_items").append('<a href="/'+notifications[i]['elelink']+'" id="notifyid_'+notifications[i]['not_id']+'" class="dropdown-item d-flex align-items-center"><div><div class="small text-gray-500">'+notifications[i]['date']+'</div>'+notifications[i]['text']+'</div></a>')
i = i + 1;
newunknownotificationscounter = newunknownotificationscounter + 1;
}
@ -530,7 +532,7 @@ function loadUnviewnNotifications(){
i = 0;
for (var key in notifications) {
if(newunknownotificationscounter <= 5){
$("#notification_items").append('<a id="notifyid_'+notifications[i]['not_id']+'" class="dropdown-item d-flex align-items-center" onclick="removeNotification('+notifications[i]['not_id']+')"><div><div class="small text-gray-500">'+notifications[i]['date']+'</div>'+notifications[i]['text']+'</div></a>')
$("#notification_items").append('<a href="/'+notifications[i]['elelink']+'" id="notifyid_'+notifications[i]['not_id']+'" class="dropdown-item d-flex align-items-center"><div><div class="small text-gray-500">'+notifications[i]['date']+'</div>'+notifications[i]['text']+'</div></a>')
i = i + 1;
}
}
@ -559,6 +561,7 @@ function removeNotification(notifyid){
}
$(document).ready(function(){
console.log();
$("#notification_items").html("");
loadUnsendNotifications();
loadUnviewnNotifications();