mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Server: Improved user list page
This commit is contained in:
parent
37d446b970
commit
4d38397cd5
@ -45,6 +45,10 @@ table.table th .sort-button i {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
table.table tr.is-disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ router.get('users', async (_path: SubPath, ctx: AppContext) => {
|
||||
view.content.users = users.map(user => {
|
||||
return {
|
||||
...user,
|
||||
displayName: user.full_name ? user.full_name : '(not set)',
|
||||
formattedItemMaxSize: formatMaxItemSize(user),
|
||||
formattedTotalSize: formatTotalSize(user),
|
||||
formattedMaxTotalSize: formatMaxTotalSize(user),
|
||||
@ -114,6 +115,7 @@ router.get('users', async (_path: SubPath, ctx: AppContext) => {
|
||||
totalSizeClass: totalSizeClass(user),
|
||||
formattedAccountType: accountTypeToString(user.account_type),
|
||||
formattedCanShareFolder: yesOrNo(getCanShareFolder(user)),
|
||||
rowClassName: user.enabled ? '' : 'is-disabled',
|
||||
};
|
||||
});
|
||||
return view;
|
||||
|
@ -1,5 +1,6 @@
|
||||
<div class="block">
|
||||
<a class="button is-primary" href="{{{global.baseUrl}}}/users/new">Add user</a>
|
||||
<a class="button is-link toggle-disabled-button hide-disabled" href="#">Hide disabled</a>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
@ -12,24 +13,18 @@
|
||||
<th>Total Size</th>
|
||||
<th>Max Total Size</th>
|
||||
<th>Can share</th>
|
||||
<th>Is admin?</th>
|
||||
<th>Enabled?</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#users}}
|
||||
<tr>
|
||||
<td>{{full_name}}</td>
|
||||
<tr class="{{rowClassName}}">
|
||||
<td><a href="{{{global.baseUrl}}}/users/{{id}}">{{displayName}}</a></td>
|
||||
<td>{{email}}</td>
|
||||
<td>{{formattedAccountType}}</td>
|
||||
<td>{{formattedItemMaxSize}}</td>
|
||||
<td class="{{totalSizeClass}}">{{formattedTotalSize}} ({{formattedTotalSizePercent}})</td>
|
||||
<td>{{formattedMaxTotalSize}}</td>
|
||||
<td>{{formattedCanShareFolder}}</td>
|
||||
<td>{{is_admin}}</td>
|
||||
<td>{{enabled}}</td>
|
||||
<td><a href="{{{global.baseUrl}}}/users/{{id}}" class="button is-primary is-small">Edit</a></td>
|
||||
</tr>
|
||||
{{/users}}
|
||||
</tbody>
|
||||
@ -37,4 +32,29 @@
|
||||
|
||||
<div class="block">
|
||||
<a class="button is-primary" href="{{{global.baseUrl}}}/users/new">Add user</a>
|
||||
<a class="button is-link toggle-disabled-button hide-disabled" href="#">Hide disabled</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(() => {
|
||||
function toggleDisabled() {
|
||||
if ($('.hide-disabled').length) {
|
||||
$('.hide-disabled').addClass('show-disabled');
|
||||
$('.hide-disabled').removeClass('hide-disabled');
|
||||
$('.show-disabled').text('Show disabled');
|
||||
$('table tr.is-disabled').hide();
|
||||
} else {
|
||||
$('.show-disabled').addClass('hide-disabled');
|
||||
$('.show-disabled').removeClass('show-disabled');
|
||||
$('.hide-disabled').text('Hide disabled');
|
||||
$('table tr.is-disabled').show();
|
||||
}
|
||||
}
|
||||
|
||||
toggleDisabled();
|
||||
|
||||
$('.toggle-disabled-button').click(() => {
|
||||
toggleDisabled();
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user