diff --git a/application/dash/templates/add_service.html b/application/dash/templates/add_service.html index 69003b2..8535bf7 100644 --- a/application/dash/templates/add_service.html +++ b/application/dash/templates/add_service.html @@ -8,7 +8,7 @@ Add service
{{ form.hidden_tag() }} {% if feedback %} -

{{feedback}}

+

{{feedback}}

{% endif %}
{{ form.name.label }}
{{ form.name() }} diff --git a/application/dash/templates/admin.html b/application/dash/templates/admin.html index ce3a258..efd860f 100644 --- a/application/dash/templates/admin.html +++ b/application/dash/templates/admin.html @@ -7,6 +7,9 @@ Register {% block content %} {{ form.hidden_tag() }} + {% if feedback="User succesfully added" %} +

{{feedback}}

+ {% endif %} {% if feedback %} {% endif %} diff --git a/application/dash/views.py b/application/dash/views.py index 4ea056a..60dd485 100644 --- a/application/dash/views.py +++ b/application/dash/views.py @@ -51,11 +51,27 @@ def admin(): return render_template( "admin.html", form=RegisterForm(formdata=None), - feedback="Account succesvol toegevoegd", + feedback="User succesfully added", ) return render_template("admin.html", form=register_form) @dash_blueprint.route("/service", methods=["GET", "POST"]) @login_required def service(): - return render_template("add_service.html") + service_form = ServiceForm() + + if service_form.validate_on_submit(): + name = service_form.name.data + url = service_form.url.data + new_service = Service( + name=name, + url=url, + ) + db.session.add(new_service) + db.session.commit() + return render_template( + "add_service.html", + form=ServiceForm(formdata=None), + feedback="Service succesfully added" + ) + return render_template("add_service.html", form=service_form) diff --git a/application/static/style.css b/application/static/style.css index 1b4b8c1..5907ac3 100644 --- a/application/static/style.css +++ b/application/static/style.css @@ -47,4 +47,9 @@ form { .feedback { font-size: 16px; color: red; +} + +.succes { + font-size: 16px; + color: green; } \ No newline at end of file