add parent to url
This commit is contained in:
@@ -2,7 +2,7 @@ import type { UmbDataTypeDetailRepository } from '../../repository/detail/data-t
|
||||
import { UMB_DATA_TYPE_CREATE_OPTIONS_MODAL } from './modal/index.js';
|
||||
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbModalManagerContext} from '@umbraco-cms/backoffice/modal';
|
||||
import type { UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
|
||||
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase<UmbDataTypeDetailRepository> {
|
||||
@@ -22,7 +22,10 @@ export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase<UmbDataTy
|
||||
|
||||
this.#modalManagerContext?.open(UMB_DATA_TYPE_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.unique,
|
||||
parent: {
|
||||
entityType: this.entityType,
|
||||
unique: this.unique,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,27 +21,30 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbModalBaseElement<Um
|
||||
|
||||
#onClick(event: PointerEvent) {
|
||||
event.stopPropagation();
|
||||
if (this.data?.parentUnique === undefined) throw new Error('A parent unique is required to create a folder');
|
||||
if (this.data?.parent === undefined) throw new Error('A parent is required to create a folder');
|
||||
|
||||
const folderModalHandler = this.#modalContext?.open(UMB_FOLDER_CREATE_MODAL, {
|
||||
data: {
|
||||
folderRepositoryAlias: UMB_DATA_TYPE_FOLDER_REPOSITORY_ALIAS,
|
||||
parentUnique: this.data.parentUnique,
|
||||
parentUnique: this.data.parent.unique,
|
||||
},
|
||||
});
|
||||
|
||||
folderModalHandler?.onSubmit().then(() => this._submitModal());
|
||||
}
|
||||
|
||||
#getCreateHref() {
|
||||
return `section/settings/workspace/data-type/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || null
|
||||
}`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-body-layout headline="Create Data Type">
|
||||
<uui-box>
|
||||
<!-- TODO: construct url -->
|
||||
<uui-menu-item
|
||||
href=${`section/settings/workspace/data-type/create/${this.data?.parentUnique || null}`}
|
||||
label="New Data Type..."
|
||||
@click=${this._submitModal}>
|
||||
<uui-menu-item href=${this.#getCreateHref()} label="New Data Type..." @click=${this._submitModal}>
|
||||
<uui-icon slot="icon" name="icon-autofill"></uui-icon>
|
||||
</uui-menu-item>
|
||||
<uui-menu-item @click=${this.#onClick} label="New Folder...">
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbDataTypeCreateOptionsModalData {
|
||||
parentUnique: string | null;
|
||||
parent: {
|
||||
entityType: string;
|
||||
unique: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export const UMB_DATA_TYPE_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbDataTypeCreateOptionsModalData>(
|
||||
|
||||
Reference in New Issue
Block a user