From 3e1ad050a80b69035412cad9e543cb800f8d8192 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 18 Oct 2022 13:52:26 +0200 Subject: [PATCH] add more subnavigation for customer-email section; correctly display next_to elements when type=label in formfields Signed-off-by: Michael Kaufmann --- customer_email.php | 84 ++++++++++++++++++++- templates/Froxlor/form/formfields.html.twig | 52 +++++++------ 2 files changed, 107 insertions(+), 29 deletions(-) diff --git a/customer_email.php b/customer_email.php index abb13d04..7ea5cc61 100644 --- a/customer_email.php +++ b/customer_email.php @@ -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' + ] + ], ]); } } diff --git a/templates/Froxlor/form/formfields.html.twig b/templates/Froxlor/form/formfields.html.twig index 8b9dab12..94e9e869 100644 --- a/templates/Froxlor/form/formfields.html.twig +++ b/templates/Froxlor/form/formfields.html.twig @@ -7,7 +7,10 @@ {% if em %} {% endif %} - {{ field.label.title|raw }}{% if field.mandatory is defined and field.mandatory %}*{% endif %} + {{ field.label.title|raw }} + {% if field.mandatory is defined and field.mandatory %} + * + {% endif %} {% if em %} {% endif %} @@ -19,7 +22,10 @@ {% if em %} {% endif %} - {{ field.label|raw }}{% if field.mandatory is defined and field.mandatory %}*{% endif %} + {{ field.label|raw }} + {% if field.mandatory is defined and field.mandatory %} + * + {% endif %} {% if em %} {% endif %} @@ -66,18 +72,18 @@ {# installation specific format #} {% macro field(id, field, norow = true, nohide = false, em = false) %} {% if field.type == 'checkbox' %} -
- - - -
+
+ + + +
{% elseif field.type == 'hidden' %} {{ _self.fieldrow(id, field, norow, nohide, em) }} {% else %} -
- {{ _self.fieldrow(id, field, norow, nohide, em) }} - -
+
+ {{ _self.fieldrow(id, field, norow, nohide, em) }} + +
{% endif %} {% endmacro %} @@ -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 %}
- + @@ -93,8 +99,8 @@ {% endfor %} {% else %}
- - + +
{% endif %} {% endmacro %} @@ -116,18 +122,14 @@ {% endmacro %} {% macro plain(id, field) %} + {% if field.next_to is defined %} -
- {% endif %} - - {% if field.next_to is defined %} - {% for nid, nfield in field.next_to %} - {% if nfield.next_to_prefix is defined %} - {{ nfield.next_to_prefix }} - {% endif %} - {{ _self.fieldrow(nid, nfield, true) }} - {% endfor %} -
+ {% for nid, nfield in field.next_to %} + {% if nfield.next_to_prefix is defined %} + {{ nfield.next_to_prefix }} + {% endif %} + {{ _self.fieldrow(nid, nfield, true) }} + {% endfor %} {% endif %} {% endmacro %}