From d0f8c08363c2b53d015df3b185be6b8bfb576e32 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 18 Sep 2017 16:35:42 +0200 Subject: [PATCH] Remove serv_add page --- server.py | 4 ++-- templates/servizio/add.htm | 17 ----------------- templates/servizio/show.htm | 16 ++++++++++------ 3 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 templates/servizio/add.htm diff --git a/server.py b/server.py index 40496a3..223064e 100644 --- a/server.py +++ b/server.py @@ -324,7 +324,7 @@ def page_serv_add(): return abort(403) if request.method == 'GET': enti = Ente.query.order_by(Ente.nomeente).all() - return render_template("servizio/add.htm", enti=enti, pagetype="serv", user=session.get("username")) + return render_template("servizio/show.htm", action="add", enti=enti, pagetype="serv", user=session.get("username")) else: nuovoserv = Servizio(request.form['eid'], request.form['nomeservizio'], request.form['locazione']) db.session.add(nuovoserv) @@ -372,7 +372,7 @@ def page_serv_show(sid): if request.method == "GET": serv = Servizio.query.get_or_404(sid) enti = Ente.query.all() - return render_template("servizio/show.htm", serv=serv, enti=enti, user=session.get("username")) + return render_template("servizio/show.htm", action="show", serv=serv, enti=enti, user=session.get("username")) else: serv = Servizio.query.get_or_404(sid) serv.eid = request.form["eid"] diff --git a/templates/servizio/add.htm b/templates/servizio/add.htm deleted file mode 100644 index 2d38c91..0000000 --- a/templates/servizio/add.htm +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "base.htm" %} -{% block title %}Aggiungi servizio • estus{% endblock %} -{% block content %} -

- Aggiungi nuovo servizio -

-
- - - - -
-{% endblock %} \ No newline at end of file diff --git a/templates/servizio/show.htm b/templates/servizio/show.htm index 606c1b6..41bfb46 100644 --- a/templates/servizio/show.htm +++ b/templates/servizio/show.htm @@ -2,16 +2,20 @@ {% block title %}Modifica servizio • estus{% endblock %} {% block content %}

- Modifica servizio + {% if action == "add" %} + Aggiungi servizio + {% elif action == "show" %} + Modifica servizio + {% endif %}

-
- {% for ente in enti %} - + {% endfor %} - - + +
{% endblock %}