templates/macros: Add macro for single button post forms

master
Felix Stupp 3 years ago
parent 8d6f6760b8
commit 5346a2f7a4
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -19,6 +19,10 @@
a:active {
text-decoration: none;
}
form.form-single-button {
display: inline-block;
}
form.form-single-button button,
.button {
padding: .1rem .2rem;
margin: 0 .1rem;
@ -27,3 +31,10 @@
}
</style>
{% endmacro %}
{% macro post_form(uri, key, val, text, fragment="") %}
<form class="form-single-button" method="POST" action="{{ uri }}">
<input type="hidden" name="redirect" value="{{ url_for(request.endpoint, **request.view_args) }}{{ ('#' + fragment) if fragment else '' }}"/>
<button name="{{ key }}" value="{{ val }}">{{ text }}</button>
</form>
{% endmacro %}

Loading…
Cancel
Save