From 97d9764f015990b1df01463c45090c4cbc2192fa Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 23 Jun 2021 22:14:01 +0200 Subject: if there are no messages display that there are no messages --- view/tpl/messages_widget.tpl | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'view') diff --git a/view/tpl/messages_widget.tpl b/view/tpl/messages_widget.tpl index 6f888962d..2d7ab99df 100644 --- a/view/tpl/messages_widget.tpl +++ b/view/tpl/messages_widget.tpl @@ -49,6 +49,9 @@ {{$e.info}} {{/foreach}} + @@ -90,6 +93,8 @@ get_messages_page_active = true; $('#messages-loading').show(); + $('#messages-empty').hide(); + $.ajax({ type: 'post', url: 'hq', @@ -102,19 +107,24 @@ messages_offset = obj.offset; let html; let tpl = $('#messages-template[rel=template]').html(); - obj.entries.forEach(function(e) { - html = tpl.format( - e.b64mid, - e.created, - e.summary, - e.info, - e.author_name, - e.author_addr, - e.href, - e.icon - ); - $('#messages-loading').before(html); - }); + if (obj.entries.length) { + obj.entries.forEach(function(e) { + html = tpl.format( + e.b64mid, + e.created, + e.summary, + e.info, + e.author_name, + e.author_addr, + e.href, + e.icon + ); + $('#messages-loading').before(html); + }); + } + else { + $('#messages-empty').show(); + } $('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active'); $('#messages-loading').hide(); $('.messages-timeago').timeago(); -- cgit v1.2.3