actix-admin/actix_admin/templates/create_or_edit.html

45 lines
2.1 KiB
HTML
Raw Normal View History

2022-05-31 23:13:44 +02:00
{% extends "base.html" %}
{% block content %}
2022-07-26 22:34:33 +02:00
<article>
<form method="post">
<div>
{% for model_field in view_model.fields -%}
<label for="{{ model_field.field_name }}">
2022-07-29 17:53:59 +02:00
{{ model_field.field_name | split(pat="_") | join(sep=" ") | title }}
2022-07-26 22:34:33 +02:00
{% if model_field.select_list != "" %}
2022-07-31 16:33:02 +02:00
<select name="{{ model_field.field_name }}" {% if model.errors | get(key=model_field.field_name,
default="" ) !="" %} placeholder="Invalid" aria-invalid="true" {% endif %}>
2022-07-26 22:34:33 +02:00
{% if model_field.is_option %}
<option value=""></option>
2022-07-27 00:37:49 +02:00
{% else %}
<option value="" selected disabled>Select</option>
2022-07-26 22:34:33 +02:00
{% endif %}
{% for select_list_item in select_lists[model_field.field_name] -%}
2022-07-27 00:37:49 +02:00
<option {% if select_list_item[0]==model.values | get(key=model_field.field_name, default="" ) %}
2022-07-31 16:33:02 +02:00
selected {% endif %} value="{{ select_list_item[0] }}">{{ select_list_item[1] | split(pat="_") |
join(sep=" ") | title }}</option>
2022-07-26 22:34:33 +02:00
{%- endfor %}
</select>
</label>
{% else %}
2022-07-27 00:37:49 +02:00
<input type="{{ model_field.html_input_type }}"
2022-07-31 16:33:02 +02:00
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 %}>
2022-07-26 11:47:49 +02:00
{% endif %}
2022-07-26 22:34:33 +02:00
</label>
2022-07-21 19:01:05 +02:00
{%- endfor %}
2022-07-31 16:33:02 +02:00
<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>
2022-07-26 22:34:33 +02:00
</div>
</form>
</article>
2022-05-31 23:13:44 +02:00
{% endblock content %}