diff options
Diffstat (limited to 'view/tpl/notifications_widget.tpl')
-rw-r--r-- | view/tpl/notifications_widget.tpl | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 9ea5ffec6..97901e052 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -5,6 +5,7 @@ var sse_partial_result = false; var sse_rmids = []; var sse_fallback_interval; + var sse_sys_only = {{$sys_only}}; $(document).ready(function() { let notifications_parent; @@ -219,8 +220,9 @@ } function sse_bs_counts() { - if(sse_bs_active) + if(sse_bs_active || sse_sys_only) { return; + } sse_bs_active = true; @@ -238,10 +240,11 @@ function sse_bs_notifications(e, replace, followup) { - if(sse_bs_active) + if(sse_bs_active || sse_sys_only) { return; + } - var manual = false; + let manual = false; if(typeof replace === 'undefined') replace = e.data.replace; @@ -302,9 +305,27 @@ function sse_handleNotifications(obj, replace, followup) { - 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); + // notice and info + + if(obj.notice) { + $(obj.notice.notifications).each(function() { + toast(this, 'danger'); + }); + } + + if(obj.info) { + $(obj.info.notifications).each(function(){ + toast(this, 'info'); + }); + } + + if (sse_sys_only) { + return; + } + + let primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files']; + let secondary_notifications = ['network', 'forums', 'all_events', 'pubs']; + let all_notifications = primary_notifications.concat(secondary_notifications); all_notifications.forEach(function(type, index) { if(typeof obj[type] === typeof undefined) @@ -312,7 +333,6 @@ var count = Number(obj[type].count); - if(obj[type].count) { $('.' + type + '-button').fadeIn(); if(replace || followup) { @@ -336,21 +356,6 @@ sse_setNotificationsStatus(); - // notice and info - $.jGrowl.defaults.closerTemplate = '<div>[ ' + aStr.closeAll + ']</div>'; - - if(obj.notice) { - $(obj.notice.notifications).each(function() { - $.jGrowl(this, { sticky: true, theme: 'notice' }); - }); - } - - if(obj.info) { - $(obj.info.notifications).each(function(){ - $.jGrowl(this, { sticky: false, theme: 'info', life: 10000 }); - }); - } - // load more notifications if visible notifications count becomes low if(sse_type && sse_offset != -1 && $('#nav-' + sse_type + '-menu').children(':not(.tt-filter-active)').length < 15) { sse_bs_notifications(sse_type, false, true); @@ -465,12 +470,12 @@ }); if(primary_available) { - $('.notifications-btn-icon').removeClass('fa-exclamation-circle'); - $('.notifications-btn-icon').addClass('fa-exclamation-triangle'); + $('.notifications-btn-icon').removeClass('bi-exclamation-circle'); + $('.notifications-btn-icon').addClass('bi-exclamation-triangle'); } else { - $('.notifications-btn-icon').removeClass('fa-exclamation-triangle'); - $('.notifications-btn-icon').addClass('fa-exclamation-circle'); + $('.notifications-btn-icon').removeClass('bi-exclamation-triangle'); + $('.notifications-btn-icon').addClass('bi-exclamation-circle'); } if(any_available) { @@ -534,6 +539,7 @@ } </script> +{{if !$sys_only}} <div id="notifications_wrapper" class="mb-4"> <div id="no_notifications" class="d-xl-none"> {{$no_notifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span> @@ -566,7 +572,7 @@ <div class="rounded-top rounded-bottom border border-start-0 border-end-0 border-bottom-0 list-group list-group-flush collapse {{$notification.type}}-button"> <a id="notification-link-{{$notification.type}}" class="collapsed list-group-item justify-content-between align-items-center d-flex fakelink stretched-link notification-link" href="#" title="{{$notification.title}}" data-bs-target="#nav-{{$notification.type}}-sub" data-bs-toggle="collapse" data-sse_type="{{$notification.type}}"> <div> - <i class="fa fa-fw fa-{{$notification.icon}}"></i> + <i class="bi bi-{{$notification.icon}} generic-icons-nav"></i> {{$notification.label}} </div> <span class="badge bg-{{$notification.severity}} {{$notification.type}}-update"></span> @@ -575,25 +581,25 @@ <div id="nav-{{$notification.type}}-sub" class="rounded-bottom border border-start-0 border-end-0 border-bottom-0 list-group list-group-flush collapse notification-content" data-bs-parent="#notifications" data-sse_type="{{$notification.type}}"> {{if $notification.viewall}} <a class="list-group-item list-group-item-action text-decoration-none" id="nav-{{$notification.type}}-see-all" href="{{$notification.viewall.url}}"> - <i class="fa fa-fw fa-external-link"></i> {{$notification.viewall.label}} + <i class="bi bi-box-arrow-up-right generic-icons-nav"></i> {{$notification.viewall.label}} </a> {{/if}} {{if $notification.markall}} <div class="list-group-item list-group-item-action cursor-pointer" id="nav-{{$notification.type}}-mark-all" onclick="markRead('{{$notification.type}}'); return false;"> - <i class="fa fa-fw fa-check"></i> {{$notification.markall.label}} + <i class="bi bi-check-circle generic-icons-nav"></i> {{$notification.markall.label}} </div> {{/if}} {{if $notification.filter}} {{if $notification.filter.posts_label}} <div class="list-group-item list-group-item-action cursor-pointer" id="tt-{{$notification.type}}-only"> - <i class="fa fa-fw fa-filter"></i> {{$notification.filter.posts_label}} + <i class="bi bi-funnel generic-icons-nav"></i> {{$notification.filter.posts_label}} </div> {{/if}} {{if $notification.filter.name_label}} <div class="list-group-item clearfix notifications-textinput" id="cn-{{$notification.type}}-only"> - <div class="text-muted notifications-textinput-filter"><i class="fa fa-fw fa-filter"></i></div> + <div class="text-muted notifications-textinput-filter"><i class="bi bi-filter"></i></div> <input id="cn-{{$notification.type}}-input" type="text" class="notification-filter form-control form-control-sm" placeholder="{{$notification.filter.name_label}}"> - <div id="cn-{{$notification.type}}-input-clear" class="text-muted notifications-textinput-clear d-none"><i class="fa fa-times"></i></div> + <div id="cn-{{$notification.type}}-input-clear" class="text-muted notifications-textinput-clear d-none"><i class="bi bi-x-lg"></i></div> </div> {{/if}} {{/if}} @@ -605,3 +611,4 @@ {{/foreach}} </div> </div> +{{/if}} |