[TASK] add input group element with interaction
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m49s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
Marie Birner
2025-05-02 17:24:40 +02:00
parent a73bbf059f
commit c47b1988b2
6 changed files with 109 additions and 68 deletions

View File

@ -174,9 +174,40 @@ function setChoiceByLabel(choicesInstance, label) {
{% if autofocus %}autofocus{% endif %}
{% if accept %}accept="{{ accept }}"{% endif %}
{% if pattern %}pattern="{{ pattern }}"{% endif %}
{% if readonly %}readonly{% endif %}>
{% if readonly %}readonly{% endif %}/>
</div>
{% endmacro input %}
{% macro inputgroup(label, name, type, required=false, class='', value='', min='', hide_label=false, id='', autofocus=false, wrapper_class='', pattern='', readonly=false, accept='') %}
<div class="{{ wrapper_class }}">
<label for="{{ name }}"
class="{% if hide_label %} sr-only {% else %} text-sm text-gray-600 dark:text-white {% endif %}">
{{ label }}
</label>
<div class="input-group">
<input {% if type=='datetime-local' %}onclick='if (!this.value) setCurrentdate(this)'{% endif %}
{% if id %} id="{{ id }}" {% else %} id="{{ name }}" {% endif %}
name="{{ name }}"
type="{{ type }}"
{% if required %}required{% endif %}
value="{{ value }}"
class="input {% if readonly %}rounded-md{% else %}rounded-l-md{% endif %} {{ class }}"
placeholder="{% if hide_label %}{{ label }}{% endif %}"
{% if min is defined %}min="{{ min }}"{% endif %}
{% if autofocus %}autofocus{% endif %}
{% if accept %}accept="{{ accept }}"{% endif %}
{% if pattern %}pattern="{{ pattern }}"{% endif %}
readonly/>
{% if allowed_to_edit %}
<button type="button" class="btn btn-primary rounded-l-none-important edit-js">Ändern</button>
<input value="x" type="reset" class="edit-js btn btn-alert btn-hidden rounded-none-important"/>
<input value="💾" type="submit" class="btn btn-primary btn-hidden rounded-l-none-important" />
{% endif %}
</div>
</div>
{% endmacro inputgroup %}
{% macro checkbox(label, name, id='', checked=false, class='', disabled=false, readonly=false) %}
<label for="{{ name }}{{ id }}"
class="flex items-center cursor-pointer text-black dark:text-white hover:text-gray-900 dark:hover:text-gray-100 {{ class }}">