actix-admin/templates/form_elements/selectlist.html

21 lines
945 B
HTML
Raw Normal View History

2022-08-20 23:31:45 +02:00
<div class="select
{% 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-08-05 18:23:51 +02:00
<select name="{{ model_field.field_name }}">
{% 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>
</div>