Replaced all occurances of bootstrap-select with tomSelect

All choice fields should now use tomselect by default to improve user UX
This commit is contained in:
Jan Böhmer 2023-02-02 00:36:42 +01:00
parent 3c3a03a179
commit 2e18065d5a
13 changed files with 100 additions and 93 deletions

View file

@ -23,12 +23,12 @@
{% block si_unit_widget %}
<div class="input-group {% if sm %}input-group-sm{% endif %}">
{{ form_widget(form.value) }}
{% if form.prefix is defined %}
{{ form_widget(form.prefix, {'attr': {'class': '', 'style': 'max-width: 40px;'}}) }}
{% endif %}
{% if unit is not empty %}
<label class="input-group-text">{{ unit }}</label>
{% endif %}
{% if form.prefix is defined %}
{{ form_widget(form.prefix, {'attr': {'class': '', 'style': 'max-width: 40px;'}}) }}
{% endif %}
{% if unit is not empty %}
<label class="input-group-text">{{ unit }}</label>
{% endif %}
</div>
{{ form_errors(form.value) }}
{% endblock %}
@ -98,12 +98,24 @@
{%- block choice_widget_collapsed -%}
{# Only add the BS5 form-select class if we dont use bootstrap-selectpicker #}
{% if attr["data-controller"] is defined and attr["data-controller"] not in ["elements--selectpicker"] %}
{# {% if attr["data-controller"] is defined and attr["data-controller"] not in ["elements--selectpicker"] %}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-select')|trim}) -%}
{% else %}
{# If it is an selectpicker add form-control class to fill whole width #}
{# If it is an selectpicker add form-control class to fill whole width
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%}
{% endif %}
#}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-select')|trim}) -%}
{# If no data-controller was explictly defined add data-controller=elements--select #}
{% if attr["data-controller"] is not defined %}
{%- set attr = attr|merge({"data-controller": "elements--select"}) -%}
{% if attr["data-empty-message"] is not defined %}
{%- set attr = attr|merge({"data-empty-message": ("selectpicker.nothing_selected"|trans)}) -%}
{% endif %}
{% endif %}
{{- block("choice_widget_collapsed", "bootstrap_base_layout.html.twig") -}}
{%- endblock choice_widget_collapsed -%}