diff --git a/routes/conditions.py b/routes/conditions.py index ed6f48c..2cc3f04 100644 --- a/routes/conditions.py +++ b/routes/conditions.py @@ -25,7 +25,7 @@ def create_conditions_routes(app): data = request.form.to_dict() result = r.table(table_name).insert(data).run(get_connection()) - return redirect(request.referrer or url_for('index')) + return render_template(route + '/create.html') # Read operation @app.route('/' + route, methods=['GET']) diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/static/js/main.js b/static/js/main.js index 87f7fad..6aa5c32 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -3,8 +3,12 @@ document.addEventListener('DOMContentLoaded', documentReady, false); function documentReady() { const iframe = document.querySelector("iframe"); const dialog = document.querySelector("dialog"); - iframe.onload = () => { + iframe.onload = (event) => { dialog.style.height = iframe.contentWindow.document.body.getBoundingClientRect().height + "px"; + if (event.target.contentWindow.location.search.includes("submitted")) { + dialog.close(); + window.location.href=window.location.href + } } } diff --git a/templates/conditions/create.html b/templates/conditions/create.html index faef62b..7a7a6c6 100644 --- a/templates/conditions/create.html +++ b/templates/conditions/create.html @@ -14,7 +14,7 @@