From 21d081e175ccc3201fe58f44b5aabb98a3c15671 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 18 Jan 2018 11:22:30 +0100 Subject: implement notifications name filter and slightly change the way we load notification to the ui --- view/tpl/notifications_widget.tpl | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'view/tpl/notifications_widget.tpl') diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 9d2e08c41..9489e850c 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -65,6 +65,23 @@ $('#nav-{{$notification.type}}-menu [data-thread_top=false]').toggle(); $(this).toggleClass('active sticky-top'); }); + $(document).on('keyup', '#cn-{{$notification.type}}-input', function(e) { + var val = $('#cn-{{$notification.type}}-input').val().toLowerCase(); + + if(val) + $('#cn-{{$notification.type}}-only').addClass('active sticky-top'); + else + $('#cn-{{$notification.type}}-only').removeClass('active sticky-top'); + + $("#nav-{{$notification.type}}-menu .notification").each(function(i, el){ + var cn = $(el).data('contact_name').toLowerCase(); + + if(cn.indexOf(val) === -1) + $(this).addClass('d-none'); + else + $(this).removeClass('d-none'); + }); + }); {{/if}} {{/foreach}} @@ -90,7 +107,7 @@