From 8edaabbabf864f0d9dbb4f5d81e607a96adf6265 Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Tue, 23 Nov 2021 21:09:45 +0000 Subject: [PATCH] [TWIG][Settings] WIP Refactoring of user panel. Now using macros to diminish repeated code. [CONTROLLER][UserPanel] Replaced form names. More readable. --- src/Controller/UserPanel.php | 4 +- templates/settings/account.html.twig | 5 - templates/settings/base.html.twig | 150 ++++++++++++--------- templates/settings/notifications.html.twig | 25 ---- templates/settings/profile.html.twig | 5 - 5 files changed, 86 insertions(+), 103 deletions(-) delete mode 100644 templates/settings/account.html.twig delete mode 100644 templates/settings/notifications.html.twig delete mode 100644 templates/settings/profile.html.twig diff --git a/src/Controller/UserPanel.php b/src/Controller/UserPanel.php index 063b20dc65..9259e1219e 100644 --- a/src/Controller/UserPanel.php +++ b/src/Controller/UserPanel.php @@ -82,8 +82,8 @@ class UserPanel extends Controller return [ '_template' => 'settings/base.html.twig', - 'prof' => $personal_form->createView(), - 'acc' => $account_form->createView(), + 'profile' => $personal_form->createView(), + 'account' => $account_form->createView(), 'tabbed_forms_notify' => $notifications_form_array, 'open_details_query' => $this->string('open'), ]; diff --git a/templates/settings/account.html.twig b/templates/settings/account.html.twig deleted file mode 100644 index 255af77a60..0000000000 --- a/templates/settings/account.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% block form_account %} -
- {{ form(acc) }} -
-{% endblock %} diff --git a/templates/settings/base.html.twig b/templates/settings/base.html.twig index d24ae25bc4..53b1bec5ce 100644 --- a/templates/settings/base.html.twig +++ b/templates/settings/base.html.twig @@ -1,6 +1,6 @@ {% extends '/stdgrid.html.twig' %} -{% block title %}{% endblock %} +{% block title %}{{ 'Settings' | trans }}{% endblock %} {% block stylesheets %} {{ parent() }} @@ -8,90 +8,108 @@ {% endblock stylesheets %} -{% block body %} - - -
- + {% elseif title == 'Account' %}
  • -
    - -

    Account{{ icon('arrow-down', 'icon icon-details-open') | raw }}

    - Email, Password and Language -
    - -
    - {% block form_account %} - {% include '/settings/account.html.twig' %} - {% endblock %} -
    -
    + {{ form(context.account) }}
  • - -
    - + {% elseif title == 'Notifications' %}
  • -
    - -

    Notifications{{ icon('arrow-down', 'icon icon-details-open') | raw }}

    - Enable/disable notifications (Email, XMPP, Replies...) -
    +
    +
  • +
    + {% endfor %} + + + + {% endif %} + +{% endmacro settings_details_container %} + +{% block body %} + diff --git a/templates/settings/notifications.html.twig b/templates/settings/notifications.html.twig deleted file mode 100644 index 70f14f787b..0000000000 --- a/templates/settings/notifications.html.twig +++ /dev/null @@ -1,25 +0,0 @@ -{% block form_notify %} -
    - - - -
    -{% endblock %} \ No newline at end of file diff --git a/templates/settings/profile.html.twig b/templates/settings/profile.html.twig deleted file mode 100644 index 1f48e88d2f..0000000000 --- a/templates/settings/profile.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% block form_profile %} -
    - {{ form(prof) }} -
    -{% endblock %} \ No newline at end of file