From 45a4591f73970cfe22695f644838fa268706209c Mon Sep 17 00:00:00 2001 From: Craig Williams Date: Tue, 8 Mar 2022 13:13:20 +0000 Subject: [PATCH] Added organisations to users page --- asset-bundles.json | 1 + assets/organisations/css/organisations.css | 16 +++- assets/organisations/js/pages/user.js | 1 + locale/en_US/messages.php | 4 + templates/pages/user.html.twig | 104 +++++++++++++++++++++ 5 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 templates/pages/user.html.twig diff --git a/asset-bundles.json b/asset-bundles.json index fb9306a..fa9029c 100644 --- a/asset-bundles.json +++ b/asset-bundles.json @@ -38,6 +38,7 @@ }, "js/pages/user": { "scripts": [ + "organisations/js/widgets/members.js", "organisations/js/widgets/users.js", "organisations/js/pages/user.js" ], diff --git a/assets/organisations/css/organisations.css b/assets/organisations/css/organisations.css index 13d73bf..a2b3486 100644 --- a/assets/organisations/css/organisations.css +++ b/assets/organisations/css/organisations.css @@ -16,6 +16,20 @@ text-overflow: ellipsis; overflow: hidden; width: 100%; - displaY: inline-block; + display: inline-block; white-space: nowrap; +} + +.user-organisation-description { + text-overflow: ellipsis; + overflow: hidden; + width: 100%; + display: inline-block; + white-space: nowrap; + margin-top: 0.5em; +} + +hr.row-divider { + margin-top: 0.3em; + width: 80%; } \ No newline at end of file diff --git a/assets/organisations/js/pages/user.js b/assets/organisations/js/pages/user.js index 22603f0..c990021 100644 --- a/assets/organisations/js/pages/user.js +++ b/assets/organisations/js/pages/user.js @@ -9,5 +9,6 @@ $(document).ready(function() { // Control buttons + bindMemberButtons($("#view-user")) bindUserButtonsExtra($("#view-user"), { delete_redirect: page.delete_redirect }); }); diff --git a/locale/en_US/messages.php b/locale/en_US/messages.php index 2192da0..0fbd4a8 100644 --- a/locale/en_US/messages.php +++ b/locale/en_US/messages.php @@ -167,6 +167,10 @@ return [ 2 => 'Administrators', ], + 'USER' => [ + 'ORGANISATIONS' => 'User Organisations', + ], + 'CREATED_ON' => 'Created on', 'MERGE' => 'Merge', diff --git a/templates/pages/user.html.twig b/templates/pages/user.html.twig new file mode 100644 index 0000000..feda475 --- /dev/null +++ b/templates/pages/user.html.twig @@ -0,0 +1,104 @@ +{% extends "@blockier-templates/pages/user.html.twig" %} + + +{% block tools %} +
  • + + {{translate('EDIT')}} + +
  • + {% if 'password' not in tools.hidden %} +
  • + + {{translate('PASSWORD')}} + +
  • + {% endif %} + {% if 'roles' not in tools.hidden %} +
  • + + {{translate('ROLE', 2)}} + +
  • + {% endif %} + {% if 'organisations' not in tools.hidden %} +
  • + + {{translate('ORGANISATION', 2)}} + +
  • + {% endif %} + {% if 'activate' not in tools.hidden and user.flag_verified == "0" %} +
  • + + {{translate('ACTIVATE')}} + +
  • + {% endif %} + {% if 'enable' not in tools.hidden %} + {% if user.flag_enabled == "1" %} +
  • + + {{translate('DISABLE')}} + +
  • + {% else %} +
  • + + {{translate('ENABLE')}} + +
  • + {% endif %} + {% endif %} + {% if 'delete' not in tools.hidden %} +
  • + + {{translate('DELETE')}} + +
  • + {% endif %} +{% endblock %} + + +{% block user_box %} + {{ parent() }} +
    +
    +

    {{translate('USER.ORGANISATIONS')}}

    +
    +
    +

    + {% for organisation in user.organisations %} +

    +
    + {{organisation.name}} +
    + {{organisation.description}} +
    + {% if hasRole('site-admin') or hasRole('organisations-admin') -%} +
    + +
    + {% endif -%} +
    +
    + {% endfor %} + {% for organisation in user.pendingOrganisations %} +
    +
    + {{organisation.name}} +
    + {{organisation.description}} +
    + {% if hasRole('site-admin') or hasRole('organisations-admin') -%} +
    + +
    + {% endif -%} +
    +
    + {% endfor %} +

    +
    +
    +{% endblock %} \ No newline at end of file