1
Fork 0
mirror of https://github.com/Steffo99/estus.git synced 2024-11-21 23:24:18 +00:00

Aggiunta la navbar

ma non l'avevo già fatto ieri?
This commit is contained in:
Steffo 2017-02-02 08:19:45 +01:00
parent 55459f6b7f
commit 4ec935a00e
3 changed files with 34 additions and 6 deletions

View file

@ -141,7 +141,7 @@ def page_ente_show(eid):
if request.method == "GET": if request.method == "GET":
ente = Ente.query.get(eid) ente = Ente.query.get(eid)
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("ente/show.html.j2", css=css, ente=ente, type="ente", user=session["username"]) return render_template("ente/show.html.j2", css=css, ente=ente, user=session["username"])
else: else:
ente = Ente.query.get(eid) ente = Ente.query.get(eid)
ente.nomeente = request.form["nomeente"] ente.nomeente = request.form["nomeente"]
@ -189,7 +189,7 @@ def page_serv_list_plus(eid):
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
serv = Servizio.query.join(Ente).filter_by(eid=eid).all() serv = Servizio.query.join(Ente).filter_by(eid=eid).all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("servizio/list.html.j2", css=css, serv=serv, type="serv", user=session["username"]) return render_template("servizio/list.html.j2", css=css, user=session["username"])
@app.route('/serv_show/<int:sid>', methods=['GET', 'POST']) @app.route('/serv_show/<int:sid>', methods=['GET', 'POST'])
def page_serv_show(sid): def page_serv_show(sid):
@ -199,7 +199,7 @@ def page_serv_show(sid):
serv = Servizio.query.get(sid) serv = Servizio.query.get(sid)
enti = Ente.query.all() enti = Ente.query.all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("servizio/show.html.j2", css=css, serv=serv, enti=enti, type="serv", user=session["username"]) return render_template("servizio/show.html.j2", css=css, serv=serv, enti=enti, user=session["username"])
else: else:
serv = Servizio.query.get(sid) serv = Servizio.query.get(sid)
serv.eid = request.form["eid"] serv.eid = request.form["eid"]
@ -244,7 +244,7 @@ def page_imp_list_plus(sid):
return redirect(url_for('page_login')) return redirect(url_for('page_login'))
impiegati = Impiegato.query.join(Servizio).filter_by(sid=sid).join(Ente).all() impiegati = Impiegato.query.join(Servizio).filter_by(sid=sid).join(Ente).all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("impiegato/list.html.j2", css=css, impiegati=impiegati, type="imp", user=session["username"]) return render_template("impiegato/list.html.j2", css=css, impiegati=impiegati, user=session["username"])
@app.route('/imp_show/<int:iid>', methods=['GET', 'POST']) @app.route('/imp_show/<int:iid>', methods=['GET', 'POST'])
def page_imp_show(iid): def page_imp_show(iid):
@ -254,7 +254,7 @@ def page_imp_show(iid):
imp = Impiegato.query.get(iid) imp = Impiegato.query.get(iid)
servizi = Servizio.query.all() servizi = Servizio.query.all()
css = url_for("static", filename="style.css") css = url_for("static", filename="style.css")
return render_template("impiegato/show.html.j2", css=css, imp=imp, servizi=servizi, type="imp", user=session["username"]) return render_template("impiegato/show.html.j2", css=css, imp=imp, servizi=servizi, user=session["username"])
else: else:
imp = Impiegato.query.get(iid) imp = Impiegato.query.get(iid)
imp.sid = request.form["sid"] imp.sid = request.form["sid"]

View file

@ -1,9 +1,19 @@
.goldfish .goldfish
{ {
width: 25vh; width: 25%;
} }
.monospace .monospace
{ {
font-family: "Consolas", monospace; font-family: "Consolas", monospace;
} }
.btn-right
{
margin-right: 16px;
}
body
{
padding-top: 70px; /*Per la navbar*/
}

18
templates/nav.html.j2 Normal file
View file

@ -0,0 +1,18 @@
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand {% if type is equalto "main" %}active{% endif %}" href="/dashboard">Inventario</a>
</div>
<ul class="nav navbar-nav">
<li class="{% if type is equalto "ente" %}active{% endif %}"><a href="/ente_list">Enti</a></li>
<li class="{% if type is equalto "serv" %}active{% endif %}"><a href="/serv_list">Servizi</a></li>
<li class="{% if type is equalto "imp" %}active{% endif %}"><a href="/imp_list">Impiegati</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<p class="navbar-text">
{{user}}
</p>
<a href="/login" class="btn btn-danger navbar-btn btn-right">Logout</a>
</ul>
</div>
</nav>