forked from gergely/calendar-social
Update the welcome page with actual numbers
This commit is contained in:
parent
43a90a237f
commit
372a1f756a
@ -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)
|
||||
|
||||
|
@ -34,6 +34,10 @@ header > h1 > img {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.ui.centered.statistics {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.timezone-warning {
|
||||
color: #e94a4a;
|
||||
}
|
||||
|
@ -40,17 +40,17 @@
|
||||
</div>
|
||||
|
||||
<div class="four wide column">
|
||||
<div class="ui statistics">
|
||||
<div class="ui centered statistics">
|
||||
<div class="statistic">
|
||||
<div class="value">12</div>
|
||||
<div class="value">{{ user_count }}</div>
|
||||
<div class="label">
|
||||
{% trans count=12 %}user{% pluralize %}users{% endtrans %}
|
||||
{% trans count=user_count %}user{% pluralize %}users{% endtrans %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="statistic">
|
||||
<div class="value">87</div>
|
||||
<div class="value">{{ event_count }}</div>
|
||||
<div class="label">
|
||||
{% trans count=87 %}event{% pluralize %}events{% endtrans %}
|
||||
{% trans count=event_count %}event{% pluralize %}events{% endtrans %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user