Added organisations to users page

This commit is contained in:
2022-03-08 13:13:20 +00:00
parent 012b633eaf
commit 45a4591f73
5 changed files with 125 additions and 1 deletions

View File

@@ -38,6 +38,7 @@
}, },
"js/pages/user": { "js/pages/user": {
"scripts": [ "scripts": [
"organisations/js/widgets/members.js",
"organisations/js/widgets/users.js", "organisations/js/widgets/users.js",
"organisations/js/pages/user.js" "organisations/js/pages/user.js"
], ],

View File

@@ -16,6 +16,20 @@
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
displaY: inline-block; display: inline-block;
white-space: nowrap; 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%;
} }

View File

@@ -9,5 +9,6 @@
$(document).ready(function() { $(document).ready(function() {
// Control buttons // Control buttons
bindMemberButtons($("#view-user"))
bindUserButtonsExtra($("#view-user"), { delete_redirect: page.delete_redirect }); bindUserButtonsExtra($("#view-user"), { delete_redirect: page.delete_redirect });
}); });

View File

@@ -167,6 +167,10 @@ return [
2 => 'Administrators', 2 => 'Administrators',
], ],
'USER' => [
'ORGANISATIONS' => 'User Organisations',
],
'CREATED_ON' => 'Created on', 'CREATED_ON' => 'Created on',
'MERGE' => 'Merge', 'MERGE' => 'Merge',

View File

@@ -0,0 +1,104 @@
{% extends "@blockier-templates/pages/user.html.twig" %}
{% block tools %}
<li>
<a href="#" class="js-user-edit" data-user_name="{{user.user_name}}">
<i class="fas fa-edit fa-fw"></i> {{translate('EDIT')}}
</a>
</li>
{% if 'password' not in tools.hidden %}
<li>
<a href="#" class="js-user-password" data-user_name="{{user.user_name}}">
<i class="fas fa-lock fa-fw"></i> {{translate('PASSWORD')}}
</a>
</li>
{% endif %}
{% if 'roles' not in tools.hidden %}
<li>
<a href="#" class="js-user-roles" data-user_name="{{user.user_name}}">
<i class="fas fa-id-card fa-fw"></i> {{translate('ROLE', 2)}}
</a>
</li>
{% endif %}
{% if 'organisations' not in tools.hidden %}
<li>
<a href="#" class="js-user-organisations" data-user_name="{{user.user_name}}">
<i class="fas fa-sitemap fa-fw"></i> {{translate('ORGANISATION', 2)}}
</a>
</li>
{% endif %}
{% if 'activate' not in tools.hidden and user.flag_verified == "0" %}
<li>
<a href="#" class="js-user-activate" data-user_name="{{user.user_name}}">
<i class="fas fa-bolt fa-fw"></i> {{translate('ACTIVATE')}}
</a>
</li>
{% endif %}
{% if 'enable' not in tools.hidden %}
{% if user.flag_enabled == "1" %}
<li>
<a href="#" class="js-user-disable" data-user_name="{{user.user_name}}">
<i class="fas fa-minus-circle fa-fw"></i> {{translate('DISABLE')}}
</a>
</li>
{% else %}
<li>
<a href="#" class="js-user-enable" data-user_name="{{user.user_name}}">
<i class="fas fa-plus-circle fa-fw"></i> {{translate('ENABLE')}}
</a>
</li>
{% endif %}
{% endif %}
{% if 'delete' not in tools.hidden %}
<li>
<a href="#" class="js-user-delete" data-user_name="{{user.user_name}}">
<i class="fas fa-trash-alt fa-fw"></i> {{translate('DELETE')}}
</a>
</li>
{% endif %}
{% endblock %}
{% block user_box %}
{{ parent() }}
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"><i class="fas fa-sitemap"></i> {{translate('USER.ORGANISATIONS')}}</h3>
</div>
<div class="box-body">
<p class="box-profile-property">
{% for organisation in user.organisations %}
<div class="row">
<div class="col-xs-9">
<a href="{{site.uri.public}}/organisations/o/{{organisation.slug}}" class="label bg-primary {% if organisation.flag_approved != 1 %}organisation-pending{% endif %} {% if organisation.pivot.flag_admin %}organisation-admin{% endif %}" title="{{organisation.description}}" data-text="{{organisation.name}}" style="font-size: 100%;">{{organisation.name}}</a>
<br>
<small class="user-organisation-description">{{organisation.description}}</small>
</div>
{% if hasRole('site-admin') or hasRole('organisations-admin') -%}
<div class="col-xs-3">
<button type="button" data-slug="{{organisation.slug}}" data-user_name="{{user.user_name}}" class="btn btn-danger js-member-remove margin-r-5" style="min-width: 70px">{{translate("REMOVE")}}</button>
</div>
{% endif -%}
</div>
<hr class="row-divider">
{% endfor %}
{% for organisation in user.pendingOrganisations %}
<div class="row">
<div class="col-xs-9">
<a href="{{site.uri.public}}/organisations/o/{{organisation.slug}}" class="label bg-primary {% if organisation.flag_approved != 1 %}organisation-pending{% endif %} {% if organisation.pivot.flag_admin %}organisation-admin{% endif %}" title="{{organisation.description}}" data-text="{{organisation.name}}" style="font-size: 100%;">{{organisation.name}}</a>
<br>
<small class="user-organisation-description">{{organisation.description}}</small>
</div>
{% if hasRole('site-admin') or hasRole('organisations-admin') -%}
<div class="col-xs-3">
<button type="button" data-slug="{{organisation.slug}}" data-user_name="{{user.user_name}}" class="btn btn-danger js-member-remove margin-r-5" style="min-width: 70px">{{translate("REMOVE")}}</button>
</div>
{% endif -%}
</div>
<hr class="row-divider">
{% endfor %}
</p>
</div>
</div>
{% endblock %}