preserve previous state on form error

the html now contains a `data-prev-state` attribute which contains the
previous state, taken from the `operation` value in the form data (from
the submit button). This is used to seed the `currentState` of the
templateFolderForm. If not specified (or 'unknown', because the user
hit enter last time round), then set it to nothingSelectedButtons.
This commit is contained in:
Leo Hemsted
2018-12-04 14:48:39 +00:00
parent 97f663f99e
commit 17cc262ea3
3 changed files with 28 additions and 24 deletions

View File

@@ -4,7 +4,8 @@
autocomplete=False,
class=None,
id=None,
module=None
module=None,
data_kwargs={}
) %}
<form
method="{{ method }}"
@@ -13,6 +14,11 @@
{% if class %}class="{{ class }}"{% endif %}
{% if id %}id="{{ id }}"{% endif %}
{% if module %}data-module="{{ module }}"{% endif %}
{% for key, val in data_kwargs.items() %}
{% if val %}
data-{{ key }}="{{ val }}"
{% endif %}
{% endfor %}
novalidate
>
{{ caller() }}