diff options
Diffstat (limited to 'view')
-rw-r--r-- | view/js/main.js | 21 | ||||
-rw-r--r-- | view/tpl/notifications_widget.tpl | 12 |
2 files changed, 10 insertions, 23 deletions
diff --git a/view/js/main.js b/view/js/main.js index 66a0bda2f..4ec7a71aa 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -30,7 +30,6 @@ var sse_bs_active = false; var sse_offset = 0; var sse_type; var sse_partial_result = false; -var sse_mids = []; // take care of tab/window reloads on channel change if(localStorage.getItem('uid') !== localUser.toString()) { @@ -699,14 +698,11 @@ function updateConvItems(mode,data) { var nmids = $(this).data('b64mids'); nmids.forEach(function(nmid, index) { - sse_mids.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, true); + return sse_updateNotifications(n[1], nmid); }); - sse_mids = []; } // special handling for forum notifications @@ -1774,16 +1770,10 @@ function sse_handleNotificationsItems(notifyType, data, replace, followup) { } $(data).each(function() { - if(sse_mids.indexOf(this.b64mid) >= 0) { - return sse_updateNotifications(notifyType, this.b64mid, false); - } - html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids)); notify_menu.append(html); }); - sse_mids = []; - if(!replace && !followup) { $("#nav-" + notifyType + "-menu .notification").sort(function(a,b) { a = new Date(a.dataset.when); @@ -1815,9 +1805,7 @@ function sse_handleNotificationsItems(notifyType, data, replace, followup) { } } -function sse_updateNotifications(type, mid, interactive) { - - //console.log('interactive: ' + interactive); +function sse_updateNotifications(type, mid) { if(type === 'pubs') return true; @@ -1839,9 +1827,6 @@ function sse_updateNotifications(type, mid, interactive) { $('.' + type + '-update').html(count); } - if(! interactive) - return true; - $('#nav-' + type + '-menu .notification[data-b64mid=\'' + mid + '\']').fadeOut(function() { this.remove(); }); @@ -1876,10 +1861,12 @@ function sse_setNotificationsStatus() { if(any_available) { $('.notifications-btn').css('opacity', 1); $('#no_notifications').hide(); + $('#notifications').show(); } else { $('.notifications-btn').css('opacity', 0.5); $('#navbar-collapse-1').removeClass('show'); $('#no_notifications').show(); + $('#notifications').hide(); } } diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 5e96c2767..146c510f1 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -82,7 +82,7 @@ {{if $notification.filter}} $(document).on('click', '#tt-{{$notification.type}}-only', function(e) { e.preventDefault(); - $('#nav-{{$notification.type}}-menu [data-thread_top=false]').toggle(); + $('#nav-{{$notification.type}}-menu [data-thread_top=false]').toggleClass('d-none'); $(this).toggleClass('active sticky-top'); }); $(document).on('click', '#cn-{{$notification.type}}-input-clear', function(e) { @@ -151,9 +151,9 @@ <i class="fa fa-{11} text-muted"></i> </a> </div> - <div id="notifications" class="navbar-nav"> + <div id="notifications" class="border rounded border-bottom-0 list-group list-group-flush navbar-nav collapse"> {{foreach $notifications as $notification}} - <div class="collapse {{$notification.type}}-button"> + <div class="list-group collapse {{$notification.type}}-button"> <a id="notification-link-{{$notification.type}}" class="collapsed list-group-item notification-link" href="#" title="{{$notification.title}}" data-target="#nav-{{$notification.type}}-sub" data-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> @@ -161,7 +161,7 @@ <div class="spinner s"></div> </div> </a> - <div id="nav-{{$notification.type}}-sub" class="collapse notification-content" data-parent="#notifications" data-sse_type="{{$notification.type}}"> + <div id="nav-{{$notification.type}}-sub" class="list-group border-bottom collapse notification-content" data-parent="#notifications" data-sse_type="{{$notification.type}}"> {{if $notification.viewall}} <a class="list-group-item text-dark" id="nav-{{$notification.type}}-see-all" href="{{$notification.viewall.url}}"> <i class="fa fa-fw fa-external-link"></i> {{$notification.viewall.label}} @@ -186,8 +186,8 @@ </div> {{/if}} {{/if}} - <div id="nav-{{$notification.type}}-menu"></div> - <div id="nav-{{$notification.type}}-loading" style="display: none;"> + <div id="nav-{{$notification.type}}-menu" class="list-group"></div> + <div id="nav-{{$notification.type}}-loading" class="list-group-item border-0" style="display: none;"> {{$loading}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span> </div> |