add more subnavigation for customer-email section; correctly display next_to elements when type=label in formfields

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann 2022-10-18 13:52:26 +02:00
parent 60beaf8440
commit 3e1ad050a8
No known key found for this signature in database
GPG Key ID: C121F97338D7A352
2 changed files with 107 additions and 29 deletions

View File

@ -285,7 +285,26 @@ if ($page == 'overview' || $page == 'emails') {
UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $account_add_data['emails_addaccount']
'formdata' => $account_add_data['emails_addaccount'],
'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
}
} else {
@ -324,7 +343,26 @@ if ($page == 'overview' || $page == 'emails') {
UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $account_changepw_data['emails_accountchangepasswd']
'formdata' => $account_changepw_data['emails_accountchangepasswd'],
'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
}
}
@ -358,7 +396,26 @@ if ($page == 'overview' || $page == 'emails') {
UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $quota_edit_data['emails_accountchangequota']
'formdata' => $quota_edit_data['emails_accountchangequota'],
'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
}
}
@ -425,7 +482,26 @@ if ($page == 'overview' || $page == 'emails') {
UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $forwarder_add_data['emails_addforwarder']
'formdata' => $forwarder_add_data['emails_addforwarder'],
'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
}
}

View File

@ -7,7 +7,10 @@
{% if em %}
<mark>
{% endif %}
{{ field.label.title|raw }}{% if field.mandatory is defined and field.mandatory %}<span class="text-danger">*</span>{% endif %}
{{ field.label.title|raw }}
{% if field.mandatory is defined and field.mandatory %}
<span class="text-danger">*</span>
{% endif %}
{% if em %}
</mark>
{% endif %}
@ -19,7 +22,10 @@
{% if em %}
<mark>
{% endif %}
{{ field.label|raw }}{% if field.mandatory is defined and field.mandatory %}<span class="text-danger">*</span>{% endif %}
{{ field.label|raw }}
{% if field.mandatory is defined and field.mandatory %}
<span class="text-danger">*</span>
{% endif %}
{% if em %}
</mark>
{% endif %}
@ -67,7 +73,7 @@
{% macro field(id, field, norow = true, nohide = false, em = false) %}
{% if field.type == 'checkbox' %}
<div class="form-check form-switch mb-3">
<input type="hidden" value="0" name="{{ id }}" />
<input type="hidden" value="0" name="{{ id }}"/>
<input type="checkbox" {% if (field.visible is defined and field.visible == false) or (field.disabled is defined and field.disabled == true) %} disabled {% endif %} value="{{ field.value }}" id="{{ id }}" name="{{ id }}" class="form-check-input {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.checked is defined and field.checked == 1 %} checked="checked" {% endif %}>
<label for="{{ id }}" class="form-check-label">{{ field.label|raw }}</label>
</div>
@ -85,7 +91,7 @@
{% if field.is_array is defined and field.is_array == 1 and field.values is not empty %}
{% for subfield in field.values %}
<div class="form-check form-switch">
<input type="checkbox" {% if (field.visible is defined and field.visible == false) or (field.disabled is defined and field.disabled == true) %} disabled {% endif %} value="{{ subfield.value }}" name="{{ id }}[]" class="form-check-input" {% if field.value is defined and subfield.value in field.value %} checked="checked" {% endif %}{% if field.mandatory is defined and field.mandatory %} required {% endif %}>
<input type="checkbox" {% if (field.visible is defined and field.visible == false) or (field.disabled is defined and field.disabled == true) %} disabled {% endif %} value="{{ subfield.value }}" name="{{ id }}[]" class="form-check-input" {% if field.value is defined and subfield.value in field.value %} checked="checked" {% endif %} {% if field.mandatory is defined and field.mandatory %} required {% endif %}>
<label class="form-check-label">
{{ subfield.label|raw }}
</label>
@ -93,8 +99,8 @@
{% endfor %}
{% else %}
<div class="form-check form-switch">
<input type="hidden" value="0" name="{{ id }}" />
<input type="checkbox" {% if (field.visible is defined and field.visible == false) or (field.disabled is defined and field.disabled == true) %} disabled {% endif %} value="{{ field.value }}" id="{{ id }}" name="{{ id }}" class="form-check-input {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.checked is defined and field.checked == 1 %} checked="checked" {% endif %}{% if field.mandatory is defined and field.mandatory %} required {% endif %}>
<input type="hidden" value="0" name="{{ id }}"/>
<input type="checkbox" {% if (field.visible is defined and field.visible == false) or (field.disabled is defined and field.disabled == true) %} disabled {% endif %} value="{{ field.value }}" id="{{ id }}" name="{{ id }}" class="form-check-input {% if field.valid is defined and field.valid == false %}is-invalid{% endif %}" {% if field.checked is defined and field.checked == 1 %} checked="checked" {% endif %} {% if field.mandatory is defined and field.mandatory %} required {% endif %}>
</div>
{% endif %}
{% endmacro %}
@ -116,9 +122,6 @@
{% endmacro %}
{% macro plain(id, field) %}
{% if field.next_to is defined %}
<div class="input-group">
{% endif %}
<input type="text" readonly class="form-control-plaintext" id="{{ id }}" name="{{ id }}" value="{{ field.value|raw }}">
{% if field.next_to is defined %}
{% for nid, nfield in field.next_to %}
@ -127,7 +130,6 @@
{% endif %}
{{ _self.fieldrow(nid, nfield, true) }}
{% endfor %}
</div>
{% endif %}
{% endmacro %}