re-add image-logo upload in settings

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-07-22 11:44:01 +02:00
parent 6b36508388
commit b48c135d6d
4 changed files with 24 additions and 2 deletions

View File

@@ -47,6 +47,8 @@
{{ _self.itemlist(id, field) }}
{% elseif field.type == 'infotext' %}
{{ _self.infotext(id, field) }}
{% elseif field.type == 'image' %}
{{ _self.image(id, field) }}
{% else %}
<div class="alert alert-warning" role="alert">Unknown field-type
{{ field.type }}</div>
@@ -133,7 +135,7 @@
{% if field.next_to is defined %}
<div class="input-group">
{% endif %}
<input type="{{ field.type }}" {% if field.visible is defined and field.visible == false %} disabled {% endif %} {% if field.type == 'number' and field.min is defined %} min="{{ field.min }}" {% endif %} {% if field.type == 'number' and field.max is defined %} max="{{ field.max }}" {% endif %} {% if field.type != 'number' and field.maxlength is defined %} maxlength="{{ field.maxlength }}" {% endif %} id="{{ id }}" name="{{ id }}" value="{{ field.value }}" class="form-control {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.mandatory is defined and field.mandatory %} required {% endif %} {% if field.readonly is defined and field.readonly %} readonly {% endif %} {% if field.autocomplete is defined %} autocomplete="{{ field.autocomplete }}" {% endif %} {% if field.placeholder is defined %} placeholder="{{ field.placeholder }}" {% endif %}/>
<input type="{{ field.type }}" {% if field.visible is defined and field.visible == false %} disabled {% endif %} {% if field.type == 'number' and field.min is defined %} min="{{ field.min }}" {% endif %} {% if field.type == 'number' and field.max is defined %} max="{{ field.max }}" {% endif %} {% if field.type != 'number' and field.maxlength is defined %} maxlength="{{ field.maxlength }}" {% endif %} id="{{ id }}" name="{{ id }}" value="{{ field.value }}" class="form-control {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.mandatory is defined and field.mandatory %} required {% endif %} {% if field.readonly is defined and field.readonly %} readonly {% endif %} {% if field.autocomplete is defined %} autocomplete="{{ field.autocomplete }}" {% endif %} {% if field.placeholder is defined %} placeholder="{{ field.placeholder }}" {% endif %} {% if field.type == 'file' and field.accept is defined %} accept="{{ field.accept }}" {% endif %}/>
{% if field.type == 'hidden' and field.display is defined %}
<input type="text" readonly class="form-control-plaintext" value="{{ field.display }}">
{% endif %}
@@ -148,6 +150,20 @@
{% endif %}
{% endmacro %}
{% macro image(id, field) %}
{% if field.value is not empty %}
<img src="/{{ field.value }}" alt="Current Image" class="field-image-preview"><br>
<div class="form-check form-switch mb-2">
<input type="checkbox" value="1" name="{{ id }}_delete" class="form-check-input">
<label class="form-check-label">
{{ lng('panel.image_field_delete') }}
</label>
</div>
{% endif %}
{% set field = field|merge({'type':'file'}) %}
{{ _self.input(id, field) }}
{% endmacro %}
{% macro input_ul(id, field) %}
{% set max = "" %}
{% if field.maxlength is defined %}

View File

@@ -27,7 +27,7 @@
{% endblock %}
{% block content %}
<form action="{{ action|default(filename) }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
<form action="{{ action|default(filename) }}" method="post" enctype="multipart/form-data" class="form">
{% block settings %}
<div class="row row-cols-2 row-cols-md-2 row-cols-xl-4 g-3">
{% for field in fields %}

View File

@@ -63,3 +63,7 @@
outline: none !important;
box-shadow: none !important;
}
.field-image-preview {
max-height: 5em;
}