aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/notifications_widget.tpl
diff options
context:
space:
mode:
authornobody <nobody@zotlabs.com>2021-08-25 19:13:31 -0700
committernobody <nobody@zotlabs.com>2021-08-25 19:13:31 -0700
commitaa2106f9495bee4dcf0701fbd9fec8de6fa44984 (patch)
treef2e7178f78311069bd54471f6c063c5901d16fb7 /view/tpl/notifications_widget.tpl
parent73b53675b1a339cfd950845279438e35b4e2dc7c (diff)
parent6261d0826c49ca24df9f694931592fbb9bf60f7e (diff)
downloadvolse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.tar.gz
volse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.tar.bz2
volse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'view/tpl/notifications_widget.tpl')
-rw-r--r--view/tpl/notifications_widget.tpl57
1 files changed, 51 insertions, 6 deletions
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 5cbfcc214..76b0851a7 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -139,6 +139,18 @@
});
+ $(document).on('hz:sse_setNotificationsStatus', function(e, data) {
+ sse_setNotificationsStatus(data);
+ });
+
+ $(document).on('hz:sse_bs_init', function() {
+ sse_bs_init();
+ });
+
+ $(document).on('hz:sse_bs_counts', function() {
+ sse_bs_counts();
+ });
+
{{foreach $notifications as $notification}}
{{if $notification.filter}}
$(document).on('click', '#tt-{{$notification.type}}-only', function(e) {
@@ -421,7 +433,7 @@
}
- function sse_setNotificationsStatus() {
+ function sse_setNotificationsStatus(data) {
var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
var all_notifications = primary_notifications.concat(secondary_notifications);
@@ -458,6 +470,39 @@
$('#notifications').hide();
}
+ if (typeof data !== typeof undefined) {
+ data.forEach(function(nmid, index) {
+
+ sse_rmids.push(nmid);
+
+ if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
+ $('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
+ var n = this.parentElement.id.split('-');
+ return sse_updateNotifications(n[1], nmid);
+ });
+ }
+
+ // special handling for forum notifications
+ $('.notification-forum').filter(function() {
+ var fmids = decodeURIComponent($(this).data('b64mids'));
+ var n = this.parentElement.id.split('-');
+ if(fmids.indexOf(nmid) > -1) {
+ var fcount = Number($('.' + n[1] + '-update').html());
+ fcount--;
+ $('.' + n[1] + '-update').html(fcount);
+ if(fcount < 1)
+ $('.' + n[1] + '-button').fadeOut();
+
+ var count = Number($(this).find('.bg-secondary').html());
+ count--;
+ $(this).find('.bg-secondary').html(count);
+ if(count < 1)
+ $(this).remove();
+ }
+ });
+ });
+ }
+
}
function sse_fallback() {
@@ -480,14 +525,14 @@
<div id="nav-notifications-template" rel="template">
<a class="list-group-item text-decoration-none text-dark clearfix notification {6}" href="{0}" title="{13}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-when="{5}">
<img class="menu-img-3" data-src="{1}" loading="lazy">
- <div class="contactname"><span class="text-dark font-weight-bold">{2}</span> <span class="text-muted">{3}</span></div>
+ <div class="contactname"><span class="text-dark fw-bold">{2}</span> <span class="text-muted">{3}</span></div>
<span class="text-muted">{4}</span><br>
<span class="text-muted notifications-autotime" title="{5}">{5}</span>
</a>
</div>
<div id="nav-notifications-forums-template" rel="template">
<a class="list-group-item text-decoration-none clearfix notification notification-forum" href="{0}" title="{4} - {3}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-b64mids='{12}'>
- <span class="float-right badge badge-secondary">{10}</span>
+ <span class="float-end badge bg-secondary">{10}</span>
<img class="menu-img-1" data-src="{1}" loading="lazy">
<span class="">{2}</span>
<i class="fa fa-{11} text-muted"></i>
@@ -496,11 +541,11 @@
<div id="notifications" class="border border-bottom-0 rounded navbar-nav collapse">
{{foreach $notifications as $notification}}
<div class="rounded list-group list-group-flush collapse {{$notification.type}}-button">
- <a id="notification-link-{{$notification.type}}" class="collapsed list-group-item text-decoration-none notification-link" href="#" title="{{$notification.title}}" data-target="#nav-{{$notification.type}}-sub" data-toggle="collapse" data-sse_type="{{$notification.type}}">
+ <a id="notification-link-{{$notification.type}}" class="collapsed list-group-item fakelink notification-link" href="#" title="{{$notification.title}}" data-bs-target="#nav-{{$notification.type}}-sub" data-bs-toggle="collapse" data-sse_type="{{$notification.type}}">
<i class="fa fa-fw fa-{{$notification.icon}}"></i> {{$notification.label}}
- <span class="float-right badge badge-{{$notification.severity}} {{$notification.type}}-update"></span>
+ <span class="float-end badge bg-{{$notification.severity}} {{$notification.type}}-update"></span>
</a>
- <div id="nav-{{$notification.type}}-sub" class="list-group list-group-flush border border-left-0 border-top-0 border-right-0 collapse notification-content" data-parent="#notifications" data-sse_type="{{$notification.type}}">
+ <div id="nav-{{$notification.type}}-sub" class="list-group list-group-flush border-bottom collapse notification-content" data-bs-parent="#notifications" data-sse_type="{{$notification.type}}">
{{if $notification.viewall}}
<a class="list-group-item text-decoration-none text-dark" id="nav-{{$notification.type}}-see-all" href="{{$notification.viewall.url}}">
<i class="fa fa-fw fa-external-link"></i> {{$notification.viewall.label}}