register collection action invite button
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { UmbUserCollectionContext } from '../user-collection.context.js';
|
||||
import { UmbCollectionActionBase } from '@umbraco-cms/backoffice/collection';
|
||||
import { UmbContextConsumerController } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import {
|
||||
UMB_INVITE_USER_MODAL,
|
||||
UMB_MODAL_MANAGER_CONTEXT_TOKEN,
|
||||
UmbModalManagerContext,
|
||||
} from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export class UmbInviteUserCollectionAction extends UmbCollectionActionBase<UmbUserCollectionContext> {
|
||||
#modalManagerContext: UmbModalManagerContext | undefined;
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host);
|
||||
|
||||
new UmbContextConsumerController(this.host, UMB_MODAL_MANAGER_CONTEXT_TOKEN, (instance) => {
|
||||
this.#modalManagerContext = instance;
|
||||
});
|
||||
}
|
||||
|
||||
async execute() {
|
||||
const modalContext = this.#modalManagerContext?.open(UMB_INVITE_USER_MODAL);
|
||||
await modalContext?.onSubmit();
|
||||
}
|
||||
|
||||
destroy(): void {}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { UmbCreateUserCollectionAction } from './create-user.collection-action.js';
|
||||
import { UmbInviteUserCollectionAction } from './invite-user.collection-action.js';
|
||||
import { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const createManifest: ManifestTypes = {
|
||||
@@ -6,9 +7,21 @@ export const createManifest: ManifestTypes = {
|
||||
kind: 'button',
|
||||
alias: 'Umb.CollectionAction.User.Create',
|
||||
api: UmbCreateUserCollectionAction,
|
||||
weight: 200,
|
||||
meta: {
|
||||
label: 'Create User',
|
||||
label: 'Create',
|
||||
},
|
||||
};
|
||||
|
||||
export const manifests = [createManifest];
|
||||
export const inviteManifest: ManifestTypes = {
|
||||
type: 'collectionAction',
|
||||
kind: 'button',
|
||||
alias: 'Umb.CollectionAction.User.Invite',
|
||||
api: UmbInviteUserCollectionAction,
|
||||
weight: 100,
|
||||
meta: {
|
||||
label: 'Invite',
|
||||
},
|
||||
};
|
||||
|
||||
export const manifests = [createManifest, inviteManifest];
|
||||
|
||||
Reference in New Issue
Block a user