BrickTracker/templates/macro/form.html

41 lines
1.8 KiB
HTML
Raw Normal View History

{% macro checkbox(prefix, id, text, url, checked, delete=false) %}
2025-01-17 14:36:48 +01:00
{% if g.login.is_authenticated() %}
<input class="form-check-input" type="checkbox" id="{{ prefix }}-{{ id }}" {% if checked %}checked{% endif %}
2025-01-29 16:14:52 +01:00
{% if not delete %}
data-changer-id="{{ id }}" data-changer-prefix="{{ prefix }}" data-changer-url="{{ url }}" data-changer-parent="set"
{% else %}
disabled
{% endif %}
autocomplete="off">
<label class="form-check-label" for="{{ prefix }}-{{ id }}">
{{ text }} <i id="status-{{ prefix }}-{{ id }}" class="mb-1"></i>
2025-01-17 11:03:00 +01:00
</label>
2025-01-17 14:36:48 +01:00
{% else %}
<input class="form-check-input text-reset" type="checkbox" {% if checked %}checked{% endif %} disabled>
{{ text }}
2025-01-17 11:03:00 +01:00
{% endif %}
{% endmacro %}
2025-01-29 15:12:10 +01:00
{% macro input(name, id, prefix, url, value, all=none, read_only=none) %}
{% if all or read_only %}
{{ value }}
{% else %}
<label class="visually-hidden" for="{{ prefix }}-{{ id }}">{{ name }}</label>
<div class="input-group">
<input class="form-control form-control-sm flex-shrink-1" type="text" id="{{ prefix }}-{{ id }}" value="{% if value %}{{ value }}{% endif %}"
2025-01-29 16:14:52 +01:00
{% if g.login.is_authenticated() %}
2025-01-29 15:58:41 +01:00
data-changer-id="{{ id }}" data-changer-prefix="{{ prefix }}" data-changer-url="{{ url }}"
2025-01-29 16:14:52 +01:00
{% else %}
disabled
{% endif %}
autocomplete="off">
{% if g.login.is_authenticated() %}
<span id="status-{{ prefix }}-{{ id }}" class="input-group-text ri-save-line"></span>
2025-01-29 16:14:52 +01:00
<button id="clear-{{ prefix }}-{{ id }}" type="button" class="btn btn-sm btn-light btn-outline-danger border"><i class="ri-eraser-line"></i></button>
{% else %}
<span class="input-group-text ri-prohibited-line"></span>
{% endif %}
</div>
2025-01-29 15:12:10 +01:00
{% endif %}
{% endmacro %}