fix reload after submit
This commit is contained in:
parent
71e1ec06e4
commit
63b76e1579
|
|
@ -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'])
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<body>
|
||||
<h2>Create a condition</h2>
|
||||
<form method="POST" action="/conditions">
|
||||
<form method="POST" action="/conditions?submitted">
|
||||
<fieldset>
|
||||
<label for="symbol">Symbol</label>
|
||||
<input type="text" name="symbol">
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<body>
|
||||
<h2>Update a condition</h2>
|
||||
<form method="POST" action="/conditions/{{ data.id }}">
|
||||
<form method="POST" action="/conditions/{{ data.id }}?submitted">
|
||||
<fieldset>
|
||||
<label>ID</label>
|
||||
<div>{{ data.id }}</div>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
<button type="submit">Submit</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<form method="POST" action="/conditions/delete/{{ data.id }}">
|
||||
<form method="POST" action="/conditions/delete/{{ data.id }}?submitted">
|
||||
<button class="danger" type="submit">Delete</button>
|
||||
</form>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Trading Zone Website</title>
|
||||
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}">
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='js/main.js') }}" ></script>
|
||||
</head>
|
||||
|
|
|
|||
Loading…
Reference in New Issue