actix-admin/templates/create_or_edit.html

36 lines
1.6 KiB
HTML
Raw Normal View History

2022-05-31 23:13:44 +02:00
{% extends "base.html" %}
{% block content %}
<form hx-boost="true" hx-indicator="#loading" hx-push-url="true" hx-encoding="multipart/form-data" method="post" enctype="multipart/form-data">
2022-08-04 09:21:40 +02:00
{% 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 %}
2022-08-04 09:21:40 +02:00
</label>
<div class="control">
2022-08-05 18:23:51 +02:00
{% if model_field.field_type == "SelectList" %}
{% include "form_elements/selectlist.html" %}
{% elif model_field.field_type == "Checkbox" %}
{% include "form_elements/checkbox.html" %}
2022-08-04 09:21:40 +02:00
{% else %}
2022-08-05 18:23:51 +02:00
{% include "form_elements/input.html" %}
2022-08-04 09:21:40 +02:00
{% endif %}
2022-08-05 18:23:51 +02:00
</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 %}
2022-08-04 09:21:40 +02:00
</div>
{%- endfor %}
<div class="field is-grouped">
<div class="control">
2022-10-06 15:08:00 +02:00
<button class="button is-link" type="submit">Save</i></button>
2022-08-04 09:21:40 +02:00
</div>
<div class="control">
2022-12-29 19:56:20 +01:00
<a class="button is-link is-light" href="{{ base_path }}/list">Cancel</a>
2022-08-04 09:21:40 +02:00
</div>
</div>
</form>
2022-05-31 23:13:44 +02:00
{% endblock content %}