From d684740b9222480958863a2217329d93f497b463 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Wed, 8 Dec 2021 21:42:35 -0800 Subject: [PATCH] add message count to menu --- web/app.py | 9 ++++++++- web/templates/flask_user_layout.html | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/web/app.py b/web/app.py index 25adc08..4436ee1 100644 --- a/web/app.py +++ b/web/app.py @@ -767,7 +767,14 @@ def hbnet_web_service(): # Use this to pass variables into Jinja2 templates @app.context_processor def global_template_config(): - return dict(global_config={'mode': mode}) + messages_waiting = 0 + if current_user.is_authenticated == True: + mail_all = MailBox.query.filter_by(rcv_callsign=str(current_user.username).upper()).all() + messages_waiting = 0 + for i in mail_all: + messages_waiting = messages_waiting + 1 + + return dict(global_config={'mode': mode, 'messages': messages_waiting}) # The Home page is accessible to anyone diff --git a/web/templates/flask_user_layout.html b/web/templates/flask_user_layout.html index 0a8728f..7637b23 100644 --- a/web/templates/flask_user_layout.html +++ b/web/templates/flask_user_layout.html @@ -121,7 +121,7 @@ {% endif %} @@ -130,7 +130,11 @@ Features