Add textarea rendering
This commit is contained in:
parent
e9dc5a07ec
commit
d231505686
2 changed files with 37 additions and 0 deletions
|
@ -126,6 +126,10 @@ _TEMPLATE_MAPPINGS = {
|
|||
'template_name': (
|
||||
'widgets/bootstrap5/floating/input-hidden.html.jinja'),
|
||||
},
|
||||
'Textarea': {
|
||||
'template_name': (
|
||||
'widgets/bootstrap5/floating/input-textarea.html.jinja'),
|
||||
},
|
||||
'CheckboxSelectMultiple': {
|
||||
'template_name': (
|
||||
'widgets/bootstrap5/floating/multiple-input.html.jinja'),
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
{% from 'widgets/bootstrap5/floating/attr-class.html.jinja' import attr_class with context %}
|
||||
<div class="form-floating mb-3" data-ktools-field-type="{{ dash_case_convert(name=_k_boundfield.field.widget.__class__.__name__) }}">
|
||||
<textarea name="{{ widget.name|e }}"
|
||||
{%- if _k_boundfield.form.is_bound %}
|
||||
{% if _k_boundfield.errors %}
|
||||
{{- attr_class(widget, 'form-control is-invalid') -}}
|
||||
{% elif _k_boundfield.mark_if_valid %}
|
||||
{{- attr_class(widget, 'form-control is-valid') -}}
|
||||
{% else %}
|
||||
{{- attr_class(widget, 'form-control') -}}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{- attr_class(widget, 'form-control') -}}
|
||||
{% endif %}
|
||||
{% include 'widgets/bootstrap5/floating/attrs-wo-class.html.jinja' %}
|
||||
placeholder="{{ _k_boundfield.label|e }}">
|
||||
{%- if widget.value != None %}{{ widget.value|e }}{% endif %}
|
||||
</textarea>
|
||||
<label for="{{ widget.attrs.id }}">{{ _k_boundfield.label }}</label>
|
||||
{% if _k_boundfield.form.is_bound and _k_boundfield.errors %}
|
||||
<div id="{{ _k_boundfield.form.errorfeedback_prefix }}{{ widget.attrs.id }}" class="invalid-feedback">
|
||||
{% for error in _k_boundfield.errors %}
|
||||
<p class="mb-0">
|
||||
<i class="bi bi-exclamation-octagon-fill"></i>
|
||||
{{ error|e }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if _k_boundfield.help_text %}
|
||||
<small class="text-muted">{{ _k_boundfield.help_text }}</small>
|
||||
{% endif %}
|
||||
</div>
|
Loading…
Reference in a new issue