Starting work on adding new dropdown selector.

This commit is contained in:
Yaro Kasear 2025-10-21 15:46:30 -05:00
parent 38bae34247
commit 43b3df9938
2 changed files with 15 additions and 1 deletions

View file

@ -20,6 +20,12 @@ const MarkDown = {
for (const q of root.querySelectorAll('blockquote')) { for (const q of root.querySelectorAll('blockquote')) {
q.classList.add('blockquote', 'border-start', 'border-5', 'border-success', 'mt-3', 'ps-3'); q.classList.add('blockquote', 'border-start', 'border-5', 'border-success', 'mt-3', 'ps-3');
} }
for (const l of root.querySelectorAll('ul')) {
l.classList.add('list-group');
}
for (const l of root.querySelectorAll('li')) {
l.classList.add('list-group-item');
}
}, },
renderInto(el, md) { renderInto(el, md) {

View file

@ -1,4 +1,4 @@
{# show label unless hidden/custom #} <!-- FIELD: {{ field_name }} ({{ field_type }}) -->
{% if field_type != 'hidden' and field_label %} {% if field_type != 'hidden' and field_label %}
<label for="{{ field_name }}" <label for="{{ field_name }}"
{% if label_attrs %}{% for k,v in label_attrs.items() %} {% if label_attrs %}{% for k,v in label_attrs.items() %}
@ -15,6 +15,7 @@
{% endif %} {% endif %}
{% if field_type == 'select' %} {% if field_type == 'select' %}
{#
<select name="{{ field_name }}" id="{{ field_name }}" <select name="{{ field_name }}" id="{{ field_name }}"
{% if attrs %}{% for k,v in attrs.items() %} {% if attrs %}{% for k,v in attrs.items() %}
{{k}}{% if v is not sameas true %}="{{ v }}"{% endif %} {{k}}{% if v is not sameas true %}="{{ v }}"{% endif %}
@ -31,6 +32,13 @@
<option value="">-- No selection available --</option> <option value="">-- No selection available --</option>
{% endif %} {% endif %}
</select> </select>
#}
{% if value %}
{% set sel_label = (options | selectattr('value', 'equalto', value) | first)['label'] %}
{% else %}
{% set sel_label = "-- Select --" %}
{% endif %}
<button type="button" class="btn btn-outline-secondary d-block w-100" id="{{ field_name }}-button" data-value="{{ value }}">{{ sel_label }}</button>
{% elif field_type == 'textarea' %} {% elif field_type == 'textarea' %}
<textarea name="{{ field_name }}" id="{{ field_name }}" <textarea name="{{ field_name }}" id="{{ field_name }}"