- modified web interface: added stylesheet, personal page and divs;

This commit is contained in:
Bernhard Stampfer
2016-02-18 15:18:11 +01:00
parent 476d1b1273
commit be95db1823
6 changed files with 100 additions and 22 deletions

View File

@@ -1 +1,52 @@
static css style sheet div.tops { background-color:#006699;
color:white;
padding:5px;
padding-left:20px;
overflow:hidden;
border-radius:5px;
border:0px solid black;
}
div.loggedin { background-color:#009966;
color:white;
padding:5px;
padding-left:20px;
overflow:hidden;
border-radius:5px;
border:0px solid black;
}
div.mainblock { background-color:white;
color:black;
padding:5px;
padding-left:20px;
overflow:hidden;
border-radius:5px;
border:1px solid black;
}
div.item { float:left;
margin:3px;
padding:5px;
border:1px solid;
border-color:black;
border-radius:4px;
min-width:80px;
#line-height:25px;
background-color:#0088AA;
color:white;
text-align:center;
text-decoration:none;
}
div.item:hover { background-color:#00AA88;
}
div.item:active { background-color:AA8800;
}
.center { text-align:center;
}
.right { float:right;
}

View File

@@ -4,6 +4,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/static/style.css">
{% if title %} {% if title %}
<title> {{ title }} - Baroness </title> <title> {{ title }} - Baroness </title>
{% else %} {% else %}
@@ -13,27 +14,30 @@
<body> <body>
<!-- Menu --> <!-- Menu -->
<h1> Menu </h1> <div class="tops">
<ul> <h1> {{ title }} - Baroness</h1>
<li><a href="/index">Home</a></li> <a href="/index"><div class="item">Home</div></a>
{% if user %} {% if user %}
<li><a href="/logout">Logout</a></li> <a href="/logout"><div class="item">Logout</div></a>
<li><a href="/consume"> Konsumieren</a></li> <a href="/consume"><div class="item">Konsumieren</div></a>
<li><a href="/personal">Personal</a></li> <a href="/personal"><div class="item">Personal</div></a>
{% if user.isbaron %} {% if user.isbaron %}
<li><a href="/billing">Billing</a></li> <a href="/billing"><div class="item">Billing</div></a>
<li><a href="/manage_beverages">Konsumatverwaltung</a></li> <a href="/manage_beverages"><div class="item">Konsumatverwaltung</div></a>
<li><a href="/manage_users">Konsumentenverwaltung</a></li> <a href="/manage_users"><div class="item">Konsumentenverwaltung</div></a>
{% endif %} {% endif %}
{% else %} {% else %}
<li><a href="/login">Login</a></li> <a href="/login"><div class="item right">Login</div></a>
{% endif %} {% endif %}
</ul> </div>
{% if user %} {% if user %}
<div class="loggedin">
Du bist eingeloggt als {{user.longname}} Du bist eingeloggt als {{user.longname}}
</div>
{% endif %} {% endif %}
<div class="mainblock">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div>
</body> </body>
</html> </html>

View File

@@ -12,7 +12,7 @@
<p> <p>
Möchtest du etwas konsumieren? Möchtest du etwas konsumieren?
{% for product in products %} {% for product in products %}
<div><p> {{ product.id }}, <a href="/consume?prodid={{product.id}}"> {{product.name}} </a>, {{product.price}} € </p> </div> <div><p> {{ product.id }}, <a href="/consume?prodid={{product.id}}"> {{product.name}} </a>, {{"%0.2f" % product.price}} € </p> </div>
{% endfor %} {% endfor %}
</p> </p>
{% endblock %} {% endblock %}

View File

@@ -3,17 +3,18 @@
{% block content %} {% block content %}
<h3>TODO: </h3> <h3>TODO: </h3>
<ul> <ul>
<li> graphical beer list</li> <li>generate new plots if .png missing</li>
<img src="{{ url_for('static', filename='total.png') }}"> </ul>
{% if user %}
<h1> Bierkonsum </h1>
<img src="{{ url_for('static', filename='total.png') }}">
{% if user %}
{% set fils = "total%03d.png" % user.id %} {% set fils = "total%03d.png" % user.id %}
<img src="{{ url_for('static', filename=fils) }}"> <img src="{{ url_for('static', filename=fils) }}">
{% endif %} {% endif %}
</ul>
<h1> Bierliste </h1> <h1> Bierliste </h1>
<img src="{{ url_for('static', filename='bierliste_small.png') }}"> <img src="{{ url_for('static', filename='bierliste_small.png') }}">
<table> <!-- <table>
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Produkt Nummer</th> <th>Produkt Nummer</th>
@@ -30,5 +31,5 @@
<td>{{consumption.time}}</td> <td>{{consumption.time}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table> -->
{% endblock %} {% endblock %}

View File

@@ -0,0 +1,17 @@
{% extends "base.html"%}
{% set title = "Personal" %}
{% block content %}
<h3>TODO: </h3>
<ul>
<li>add money owed</li>
</ul>
<h1> Statistik </h1>
<h2> Bierkonsum </h2>
<img src="{{ url_for('static', filename='total.png') }}">
{% if user %}
{% set fils = "total%03d.png" % user.id %}
<img src="{{ url_for('static', filename=fils) }}">
{% endif %}
{% endblock %}

View File

@@ -216,6 +216,11 @@ def consume():
plot_list(4) plot_list(4)
return render_template('consume.html', products=products, message=message, user=get_user_by_name(session.get('name'))) return render_template('consume.html', products=products, message=message, user=get_user_by_name(session.get('name')))
@app.route('/personal')
@requires_login
def personal():
return render_template('personal.html', user=get_user_by_name(session.get('name')))
@app.route('/billing') @app.route('/billing')
@requires_baron @requires_baron
def billing(): def billing():