findon
February 10, 2021, 6:45pm
1
I’ve seen a couple of mentions on this, but no real solutions.
Ideally i’d like to customise the user list in the panel completely, but as a minimum show some extra fields like email address in the list view (as you can with page sections using ‘info’ and ‘text’).
Is there any easy(ish) way to achieve this that I am missing?
texnixe
February 10, 2021, 7:16pm
2
I haven’t tried yet, but overwriting default views should now be possible, so you could create a custom users view with all the changes you need.
1 Like
findon
February 10, 2021, 7:17pm
3
Oh wow, is this documented anywhere yet?
texnixe
February 10, 2021, 7:20pm
4
Not 100% sure this is up-to-date, but yes:
1 Like
findon
February 10, 2021, 7:23pm
5
Oh so i have to overwrite the view completely with a plugin… complex!
texnixe
February 10, 2021, 7:26pm
6
Depending on how much you need to change, it shouldn’t actually be that complex. But since I haven’t really done it yet, I can’t promise anything …
findon
February 10, 2021, 7:36pm
7
It’s really just exposing some extra fields in each of the rows to identify the users better
texnixe
February 10, 2021, 7:49pm
8
I actually managed to create a card layout, so that stuff works, although the docs are not quite correct:
index.js
import UsersView from "./components/UsersView.vue";
panel.plugin('texnixe/users-view', {
views: {
Users: {
component: UsersView,
icon: "user",
label: "Users"
}
}
});
And the in UsersView.vue, copy/paste the stuff from the original users view and play around with the stuff, e.g. add layout="cards" to the <k-collection> component.
I’d suggest you have a look at the source code of the Users.Vue in the kirby repo:
<template>
<k-inside>
<k-view class="k-users-view">
<k-header>
{{ $t("view.users") }}
<template #left>
<k-button-group
:buttons="[
{
disabled: $permissions.users.create === false,
text: $t('user.create'),
icon: 'add',
click: () => $dialog('users/create')
}
]"
/>
</template>
<template v-if="roles.length > 1" #right>
This file has been truncated. show original
Basically, you could probably copy this and make your changes.
findon
February 11, 2021, 12:41am
9
Brilliant, thanks, a combination of both links got me to an answer, being able to customise these views is brilliant!