45 lines
2.1 KiB
HTML
45 lines
2.1 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<article>
|
|
<form method="post">
|
|
<div>
|
|
{% for model_field in view_model.fields -%}
|
|
<label for="{{ model_field.field_name }}">
|
|
{{ model_field.field_name | split(pat="_") | join(sep=" ") | title }}
|
|
{% if model_field.select_list != "" %}
|
|
<select name="{{ model_field.field_name }}" {% if model.errors | get(key=model_field.field_name,
|
|
default="" ) !="" %} placeholder="Invalid" aria-invalid="true" {% endif %}>
|
|
{% if model_field.is_option %}
|
|
<option value=""></option>
|
|
{% else %}
|
|
<option value="" selected disabled>Select</option>
|
|
{% endif %}
|
|
{% for select_list_item in select_lists[model_field.field_name] -%}
|
|
<option {% if select_list_item[0]==model.values | get(key=model_field.field_name, default="" ) %}
|
|
selected {% endif %} value="{{ select_list_item[0] }}">{{ select_list_item[1] | split(pat="_") |
|
|
join(sep=" ") | title }}</option>
|
|
{%- endfor %}
|
|
</select>
|
|
</label>
|
|
{% else %}
|
|
<input type="{{ model_field.html_input_type }}"
|
|
value="{{ model.values | get(key=model_field.field_name, default="") | split(pat=" _") | join(sep=" " )
|
|
| title }}" name="{{ model_field.field_name }}" placeholder="{{ model_field.field_name }}"
|
|
aria-label="{{ model_field.field_name }}" {% if model.errors | get(key=model_field.field_name,
|
|
default="" ) !="" %} placeholder="Invalid" aria-invalid="true" {% endif %}>
|
|
{% endif %}
|
|
</label>
|
|
{%- endfor %}
|
|
<div class="grid">
|
|
<div>
|
|
<button type="submit">Save</button>
|
|
</div>
|
|
<div>
|
|
<a href="{{ list_link }}" role="button" class="secondary full-width">Cancel</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</article>
|
|
{% endblock content %} |