actix-admin/templates/create_or_edit.html

36 lines
1.5 KiB
HTML

{% extends "base.html" %}
{% block content %}
<form method="post" enctype="multipart/form-data">
{% for model_field in view_model.fields -%}
<div class="field">
<label class="{{ model_field | get_html_input_type }}" for="{{ model_field.field_name }}">
{{ model_field.field_name | split(pat="_") | join(sep=" ") | title }}{% if not model_field.is_option %} *{% endif %}
</label>
<div class="control">
{% if model_field.field_type == "SelectList" %}
{% include "form_elements/selectlist.html" %}
{% elif model_field.field_type == "Checkbox" %}
{% include "form_elements/checkbox.html" %}
{% else %}
{% include "form_elements/input.html" %}
{% endif %}
</div>
{% if model.errors | get(key=model_field.field_name, default="" ) !="" %}
<p class="help is-danger">{{ model.errors | get(key=model_field.field_name) }}</p>
{% endif %}
{% if model.custom_errors | get(key=model_field.field_name, default="" ) !="" %}
<p class="help is-danger">{{ model.custom_errors | get(key=model_field.field_name) }}</p>
{% endif %}
</div>
{%- endfor %}
<div class="field is-grouped">
<div class="control">
<button class="button is-link" type="submit">Save</button>
</div>
<div class="control">
<a class="button is-link is-light" href="{{ list_link }}">Cancel</a>
</div>
</div>
</form>
{% endblock content %}