actix-admin/templates/form_elements/input.html

32 lines
1.9 KiB
HTML
Raw Normal View History

2022-08-20 23:31:45 +02:00
{% if model_field.field_type == "TextArea" %}
2022-12-29 19:56:20 +01:00
<textarea class="{{ model_field | get_html_input_class }}
2022-08-20 23:31:45 +02:00
{% if model.errors | length > 0 or model.custom_errors | length > 0 %}
{% if
model.errors | get(key=model_field.field_name, default="" ) !=""
or
model.custom_errors | get(key=model_field.field_name, default="" ) !=""
%}is-danger{% else %}is-success{% endif %}
{% endif %}
2022-12-29 19:56:20 +01:00
" type="{{ model_field | get_html_input_type }}" name="{{ model_field.field_name }}"
2022-08-20 23:31:45 +02:00
placeholder="{{ model_field.field_name }}"
2022-12-29 19:56:20 +01:00
aria-label="{{ model_field.field_name }}">{{ model.values | get(key=model_field.field_name, default="") }}</textarea>
{% elif model_field.field_type == "FileUpload" and model.values | get(key=model_field.field_name, default="") != "" %}
<div>
<a hx-disable href="{{ base_path }}/static_content/{{ model.primary_key }}/{{ model_field.field_name }}">{{ model.values |
get(key=model_field.field_name, default="") }}</a>
<a class="is-pulled-right" hx-target="closest div" hx-push-url="false" hx-delete="{{ base_path }}/static_content/{{ model.primary_key }}/{{ model_field.field_name }}"
hx-confirm="Are you sure?"><i class="fa-solid fa-trash"></i></a>
</div>
2022-08-20 23:31:45 +02:00
{% else %}
2022-12-29 19:56:20 +01:00
<input class="{{ model_field | get_html_input_class }}
2022-08-20 23:31:45 +02:00
{% if model.errors | length > 0 or model.custom_errors | length > 0 %}
{% if
model.errors | get(key=model_field.field_name, default="" ) !=""
or
model.custom_errors | get(key=model_field.field_name, default="" ) !=""
%}is-danger{% else %}is-success{% endif %}
{% endif %}
2022-12-29 19:56:20 +01:00
" type="{{ model_field | get_html_input_type }}"
value="{{ model.values | get(key=model_field.field_name, default="") }}" name="{{ model_field.field_name }}"
placeholder="{{ model_field.field_name }}" aria-label="{{ model_field.field_name }}">
2022-08-20 23:31:45 +02:00
{% endif %}