show apikey details in modal-overlay; todo: edit allowed_from and valid_until

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-04-09 13:32:08 +02:00
parent 9272c15706
commit 7f0eb97f9b
11 changed files with 143 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
{% macro form(form_data, formaction, title = "", hiddenid = "") %}
{% macro form(form_data, formaction, title = "", hiddenid = "", nosubmit = false) %}
{% import "Froxlor/form/formfields.html.twig" as formfields %}
@@ -21,25 +21,27 @@
</div>
{% endfor %}
<!-- submit buttons -->
<div>
{% if hiddenid is not empty %}
<input type="hidden" name="id" value="{{ hiddenid }}"/>
{% endif %}
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="action" value="{{ action }}"/>
<input type="hidden" name="send" value="send"/>
<div class="col-12 text-end">
{% if form_data.buttons is defined and form_data.buttons is iterable %}
{% for btn in form_data.buttons %}
<button type="{{ btn.type|default("submit") }}" class="btn {{ btn.class|default(" btn-primary") }}">{{ btn.label }}</button>
{% endfor %}
{% else %}
<button type="reset" class="btn btn-outline-secondary">{{ lng('panel.cancel') }}</button>
<button type="submit" class="btn btn-primary">{{ lng('panel.save') }}</button>
{% if nosubmit == false %}
<!-- submit buttons -->
<div>
{% if hiddenid is not empty %}
<input type="hidden" name="id" value="{{ hiddenid }}"/>
{% endif %}
<input type="hidden" name="page" value="{{ page }}"/>
<input type="hidden" name="action" value="{{ action }}"/>
<input type="hidden" name="send" value="send"/>
<div class="col-12 text-end">
{% if form_data.buttons is defined and form_data.buttons is iterable %}
{% for btn in form_data.buttons %}
<button type="{{ btn.type|default("submit") }}" class="btn {{ btn.class|default(" btn-primary") }}">{{ btn.label }}</button>
{% endfor %}
{% else %}
<button type="reset" class="btn btn-outline-secondary">{{ lng('panel.cancel') }}</button>
<button type="submit" class="btn btn-primary">{{ lng('panel.save') }}</button>
{% endif %}
</div>
</div>
</div>
{% endif %}
</form>
{% endmacro %}

View File

@@ -31,27 +31,45 @@
{% macro link(data) %}
{% apply spaceless %}
<a href="{{ data.href }}" {% if data.class is defined %} class="{{ data.class }}" {% endif %} {% if data.target is defined %} target="{{ data.target }}" {% endif %}{% if data.title is defined %} title="{{ data.title }}" {% endif %}>
{% if data.icon is defined %}
<i class="{{ data.icon }}"></i>
{% endif %}
{% if data.text is defined %}
{{ data.text }}
{% endif %}
</a>
<a href="{{ data.href }}" {% if data.class is defined %} class="{{ data.class }}" {% endif %} {% if data.target is defined %} target="{{ data.target }}" {% endif %} {% if data.title is defined %} title="{{ data.title }}" {% endif %}>
{% if data.icon is defined %}
<i class="{{ data.icon }}"></i>
{% endif %}
{% if data.text is defined %}
{{ data.text }}
{% endif %}
</a>
{% endapply %}
{% endmacro %}
{% macro button(data) %}
{% apply spaceless %}
<a class="{% if data.class is defined %}btn btn-sm {{ data.class }}{% else %}btn btn-sm btn-outline-secondary{% endif %}" href="{{ data.href }}" {% if data.target is defined %} target="{{ data.target }}" {% endif %}{% if data.title is defined %} title="{{ data.title }}" {% endif %}>
{% if data.icon is defined %}
<i class="{{ data.icon }}"></i>
{% endif %}
{% if data.text is defined %}
{{ data.text }}
{% endif %}
</a>
<a class="{% if data.class is defined %}btn btn-sm {{ data.class }}{% else %}btn btn-sm btn-outline-secondary{% endif %}" {% if data.modal is defined and data.modal is iterable %} data-bs-toggle="modal" role="button" href="#{{ data.modal.id }}" {% else %} href="{{ data.href }}" {% endif %} {% if data.target is defined %} target="{{ data.target }}" {% endif %} {% if data.title is defined %} title="{{ data.title }}" {% endif %}>
{% if data.icon is defined %}
<i class="{{ data.icon }}"></i>
{% endif %}
{% if data.text is defined %}
{{ data.text }}
{% endif %}
</a>
{% if data.modal is defined and data.modal is iterable %}
<div class="modal fade" id="{{ data.modal.id }}" aria-hidden="true" aria-labelledby="{{ data.modal.id }}Label" tabindex="-1">
<div class="modal-dialog {{ data.modal.size|default('modal-xl') }} modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="{{ data.modal.id }}Label">{{ data.modal.title }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ lng('panel.modalclose') }}"></button>
</div>
<div class="modal-body text-start">
{{ data.modal.body|raw }}
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-bs-dismiss="modal">{{ lng('panel.modalclose') }}</button>
</div>
</div>
</div>
</div>
{% endif %}
{% endapply %}
{% endmacro %}

View File

@@ -0,0 +1,2 @@
{% import "Froxlor/form/form.html.twig" as form %}
{{ form.form(formdata, formaction|default('#'), formdata.title, editid|default(''), true) }}