From 372a1f756a85b6039178c3c35e421bc064378c6b Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 17 Jul 2018 09:52:50 +0200 Subject: [PATCH] Update the welcome page with actual numbers --- calsocial/__init__.py | 8 +++++++- calsocial/static/css/style.css | 4 ++++ calsocial/templates/welcome.html | 10 +++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/calsocial/__init__.py b/calsocial/__init__.py index 00779f9..a62514b 100644 --- a/calsocial/__init__.py +++ b/calsocial/__init__.py @@ -164,6 +164,7 @@ class CalendarSocialApp(Flask): """ from .calendar_system.gregorian import GregorianCalendar + from .models import User, Event try: timestamp = datetime.fromtimestamp(float(request.args.get('date'))) @@ -175,10 +176,15 @@ class CalendarSocialApp(Flask): if not current_user.is_authenticated: login_form_class = current_app.extensions['security'].login_form login_form = login_form_class() + user_count = User.query.count() + event_count = Event.query.count() + return render_template('welcome.html', calendar=calendar, user_only=False, - login_form=login_form) + login_form=login_form, + user_count=user_count, + event_count=event_count) return render_template('index.html', calendar=calendar, user_only=True) diff --git a/calsocial/static/css/style.css b/calsocial/static/css/style.css index f4a702e..8a6ea78 100644 --- a/calsocial/static/css/style.css +++ b/calsocial/static/css/style.css @@ -34,6 +34,10 @@ header > h1 > img { color: #666666; } +.ui.centered.statistics { + justify-content: center; +} + .timezone-warning { color: #e94a4a; } diff --git a/calsocial/templates/welcome.html b/calsocial/templates/welcome.html index 948d555..5e19372 100644 --- a/calsocial/templates/welcome.html +++ b/calsocial/templates/welcome.html @@ -40,17 +40,17 @@
-
+
-
12
+
{{ user_count }}
- {% trans count=12 %}user{% pluralize %}users{% endtrans %} + {% trans count=user_count %}user{% pluralize %}users{% endtrans %}
-
87
+
{{ event_count }}
- {% trans count=87 %}event{% pluralize %}events{% endtrans %} + {% trans count=event_count %}event{% pluralize %}events{% endtrans %}