Adds a status page
This commit is contained in:
parent
023798abce
commit
691e35c22c
@ -744,20 +744,17 @@ def register():
|
||||
return render_template('register.html', title='Register', registrations=REGISTRATIONS, form=form, config=config)
|
||||
|
||||
|
||||
@app.route('/registrations_status/icon')
|
||||
def registrations_status_icon():
|
||||
@app.route('/status')
|
||||
def status():
|
||||
count = db.session.query(User).count()
|
||||
if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0:
|
||||
return redirect(url_for('static', filename='img/close.png'))
|
||||
filen = url_for('static', filename='img/close.png')
|
||||
caniregister = False
|
||||
else:
|
||||
return redirect(url_for('static', filename='img/open.png'))
|
||||
|
||||
|
||||
@app.route('/registrations_status/text')
|
||||
def registrations_status_text():
|
||||
count = db.session.query(User).count()
|
||||
return "{c}/{t}".format(c=count, t=config['maxInstanceUsers'])
|
||||
filen = url_for('static', filename='img/open.png')
|
||||
caniregister = True
|
||||
|
||||
return render_template('status.html', title='STATUS', count=count, max=config['maxInstanceUsers'], file=filen, cani=False)
|
||||
|
||||
@app.route('/error/<errno>')
|
||||
def error(errno):
|
||||
|
46
app/templates/status.html
Normal file
46
app/templates/status.html
Normal file
@ -0,0 +1,46 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="ui text container center aligned centered">
|
||||
<div class="ui placeholder segment">
|
||||
<div class="ui two column stackable center aligned grid">
|
||||
<div class="ui vertical divider">
|
||||
{%if cani%}
|
||||
:)
|
||||
{%else%}
|
||||
:(
|
||||
{%endif%}
|
||||
</div>
|
||||
<div class="middle aligned row">
|
||||
<div class="column">
|
||||
<h3 class="ui header"> Capacity </h3>
|
||||
<div class="ui icon header">
|
||||
{%if cani%}
|
||||
<i class="green users icon"></i>
|
||||
{%else%}
|
||||
<i class="red users icon"></i>
|
||||
{%endif%}
|
||||
{{count}}/{{max}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="ui icon header">
|
||||
<i class="user circle outline icon"></i>
|
||||
Can I register?
|
||||
</div>
|
||||
|
||||
{%if cani%}
|
||||
<a href="/register"><div class="ui green button">
|
||||
Yes!
|
||||
</div></a>
|
||||
{%else%}
|
||||
<a href="#!"><div class="ui disabled red button">
|
||||
It's full!
|
||||
</div></a>
|
||||
{%endif%}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%endblock%}
|
Reference in New Issue
Block a user