pass parent unique and entityType to all the modals
This commit is contained in:
@@ -21,7 +21,10 @@ export class UmbCreateFolderEntityAction<T extends UmbFolderRepository> extends
|
||||
const modalContext = this.#modalContext.open(UMB_FOLDER_CREATE_MODAL, {
|
||||
data: {
|
||||
folderRepositoryAlias: this.repositoryAlias,
|
||||
parentUnique: this.unique ?? null,
|
||||
parent: {
|
||||
unique: this.unique,
|
||||
entityType: this.entityType,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ export class UmbFolderCreateModalElement extends UmbFolderModalElementBase<
|
||||
async onFormSubmit({ name }: { name: string }): Promise<void> {
|
||||
if (!this.folderRepository) throw new Error('A folder repository is required to create a folder');
|
||||
if (!this._folderScaffold) throw new Error('The folder scaffold was not initialized correctly');
|
||||
if (this.data?.parentUnique === undefined) throw new Error('A parent unique is required to create folder');
|
||||
if (!this.data?.parent) throw new Error('A parent is required to create folder');
|
||||
|
||||
const createFolderModel: UmbCreateFolderModel = {
|
||||
...this._folderScaffold,
|
||||
parentUnique: this.data.parentUnique,
|
||||
parentUnique: this.data.parent.unique,
|
||||
name,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@ import type { UmbFolderModel } from '@umbraco-cms/backoffice/tree';
|
||||
|
||||
export interface UmbFolderCreateModalData {
|
||||
folderRepositoryAlias: string;
|
||||
parentUnique: string | null;
|
||||
parent: {
|
||||
unique: string | null;
|
||||
entityType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface UmbFolderCreateModalValue {
|
||||
|
||||
@@ -21,12 +21,12 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbModalBaseElement<Um
|
||||
|
||||
#onClick(event: PointerEvent) {
|
||||
event.stopPropagation();
|
||||
if (this.data?.parent === undefined) throw new Error('A parent is required to create a folder');
|
||||
if (!this.data?.parent) 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.parent.unique,
|
||||
parent: this.data.parent,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbModalBaseElement<Um
|
||||
|
||||
#getCreateHref() {
|
||||
return `section/settings/workspace/data-type/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || null
|
||||
this.data?.parent.unique || 'null'
|
||||
}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { UmbDocumentTypeDetailRepository } from '../../repository/detail/do
|
||||
import { UMB_DOCUMENT_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<UmbDocumentTypeDetailRepository> {
|
||||
@@ -22,8 +22,10 @@ export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase<UmbDocume
|
||||
|
||||
this.#modalManagerContext?.open(UMB_DOCUMENT_TYPE_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.unique,
|
||||
entityType: this.entityType,
|
||||
parent: {
|
||||
unique: this.unique,
|
||||
entityType: this.entityType,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbModalBaseElement<Um
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
if (this.data?.parentUnique === undefined) throw new Error('A parent unique is required to create a folder');
|
||||
if (!this.data?.parent) throw new Error('A parent is required to create a folder');
|
||||
|
||||
this.#createFolderAction = new UmbCreateFolderEntityAction(
|
||||
this,
|
||||
@@ -19,8 +18,8 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbModalBaseElement<Um
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// TODO: allow null for entity actions. Some actions can be executed on the root item
|
||||
this.data.parentUnique,
|
||||
this.data.entityType,
|
||||
this.data.parent.unique,
|
||||
this.data.parent.entityType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,15 +39,18 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbModalBaseElement<Um
|
||||
this._rejectModal();
|
||||
}
|
||||
|
||||
#getCreateHref() {
|
||||
return `section/settings/workspace/document-type/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || 'null'
|
||||
}`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-body-layout headline="Create Document Type">
|
||||
<uui-box>
|
||||
<!-- TODO: construct url -->
|
||||
<uui-menu-item
|
||||
href=${`section/settings/workspace/document-type/create/${this.data?.parentUnique || 'null'}`}
|
||||
label="New Document Type..."
|
||||
@click=${this.#onNavigate}>
|
||||
<uui-menu-item href=${this.#getCreateHref()} label="New Document Type..." @click=${this.#onNavigate}>
|
||||
<uui-icon slot="icon" name="icon-autofill"></uui-icon>}
|
||||
</uui-menu-item>
|
||||
<uui-menu-item @click=${this.#onCreateFolderClick} label="New Folder...">
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbDocumentTypeCreateOptionsModalData {
|
||||
parentUnique: string | null;
|
||||
entityType: string;
|
||||
parent: {
|
||||
unique: string | null;
|
||||
entityType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const UMB_DOCUMENT_TYPE_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbDocumentTypeCreateOptionsModalData>(
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { UmbMediaTypeDetailRepository } from '../../repository/detail/media
|
||||
import { UMB_MEDIA_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 UmbCreateMediaTypeEntityAction extends UmbEntityActionBase<UmbMediaTypeDetailRepository> {
|
||||
@@ -22,7 +22,10 @@ export class UmbCreateMediaTypeEntityAction extends UmbEntityActionBase<UmbMedia
|
||||
|
||||
this.#modalManagerContext?.open(UMB_MEDIA_TYPE_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentKey: this.unique,
|
||||
parent: {
|
||||
unique: this.unique,
|
||||
entityType: this.entityType,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbMediaTypeCreateOptionsModalData {
|
||||
parentKey: string | null;
|
||||
parent: {
|
||||
unique: string | null;
|
||||
entityType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const UMB_MEDIA_TYPE_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbMediaTypeCreateOptionsModalData>(
|
||||
|
||||
@@ -28,12 +28,12 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbLitElement {
|
||||
|
||||
#onClick(event: PointerEvent) {
|
||||
event.stopPropagation();
|
||||
if (this.data?.parentKey === undefined) throw new Error('A parent unique is required to create a folder');
|
||||
if (!this.data?.parent) throw new Error('A parent is required to create a folder');
|
||||
|
||||
const folderModalHandler = this.#modalContext?.open(UMB_FOLDER_CREATE_MODAL, {
|
||||
data: {
|
||||
folderRepositoryAlias: UMB_MEDIA_TYPE_FOLDER_REPOSITORY_ALIAS,
|
||||
parentUnique: this.data?.parentKey,
|
||||
parent: this.data?.parent,
|
||||
},
|
||||
});
|
||||
folderModalHandler?.onSubmit().then(() => this.modalContext?.submit());
|
||||
@@ -48,15 +48,18 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbLitElement {
|
||||
this.modalContext?.reject();
|
||||
}
|
||||
|
||||
#getCreateHref() {
|
||||
return `section/settings/workspace/media-type/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || 'null'
|
||||
}`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-body-layout headline="Create Media Type">
|
||||
<uui-box>
|
||||
<!-- TODO: construct url -->
|
||||
<uui-menu-item
|
||||
href=${`section/settings/workspace/media-type/create/${this.data?.parentKey || 'null'}`}
|
||||
label="New Media Type..."
|
||||
@click=${this.#onNavigate}>
|
||||
<uui-menu-item href=${this.#getCreateHref()} label="New Media Type..." @click=${this.#onNavigate}>
|
||||
<uui-icon slot="icon" name="icon-autofill"></uui-icon>
|
||||
</uui-menu-item>
|
||||
<uui-menu-item @click=${this.#onClick} label="New Folder...">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UMB_PARTIAL_VIEW_CREATE_OPTIONS_MODAL } from './options-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 UmbPartialViewCreateOptionsEntityAction extends UmbEntityActionBase<never> {
|
||||
@@ -21,8 +21,10 @@ export class UmbPartialViewCreateOptionsEntityAction extends UmbEntityActionBase
|
||||
|
||||
this.#modalManagerContext?.open(UMB_PARTIAL_VIEW_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.unique,
|
||||
entityType: this.entityType,
|
||||
parent: {
|
||||
unique: this.unique,
|
||||
entityType: this.entityType,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbPartialViewCreateOptionsModalData {
|
||||
parentUnique: string | null;
|
||||
entityType: string;
|
||||
parent: {
|
||||
unique: string | null;
|
||||
entityType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const UMB_PARTIAL_VIEW_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbPartialViewCreateOptionsModalData>(
|
||||
|
||||
@@ -24,8 +24,7 @@ export class UmbPartialViewCreateOptionsModalElement extends UmbModalBaseElement
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
if (this.data?.parentUnique === undefined) throw new Error('A parent unique is required to create a folder');
|
||||
if (!this.data?.parent) throw new Error('A parent unique is required to create a folder');
|
||||
|
||||
this.#createFolderAction = new UmbCreateFolderEntityAction(
|
||||
this,
|
||||
@@ -33,8 +32,8 @@ export class UmbPartialViewCreateOptionsModalElement extends UmbModalBaseElement
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// TODO: allow null for entity actions. Some actions can be executed on the root item
|
||||
this.data.parentUnique,
|
||||
this.data.entityType,
|
||||
this.data.parent.unique,
|
||||
this.data.parent.entityType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,11 +50,11 @@ export class UmbPartialViewCreateOptionsModalElement extends UmbModalBaseElement
|
||||
|
||||
async #onCreateFromSnippetClick(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) throw new Error('A parent is required to create a folder');
|
||||
|
||||
const modalContext = this.#modalManager?.open(UMB_PARTIAL_VIEW_FROM_SNIPPET_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.data.parentUnique,
|
||||
parent: this.data.parent,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -67,15 +66,18 @@ export class UmbPartialViewCreateOptionsModalElement extends UmbModalBaseElement
|
||||
this._submitModal();
|
||||
}
|
||||
|
||||
#getCreateHref() {
|
||||
return `section/settings/workspace/partial-view/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || 'null'
|
||||
}`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-body-layout headline="Create Partial View">
|
||||
<uui-box>
|
||||
<!-- TODO: construct url -->
|
||||
<uui-menu-item
|
||||
href=${`section/settings/workspace/partial-view/create/${this.data?.parentUnique || 'null'}`}
|
||||
label="New empty partial view"
|
||||
@click=${this.#onNavigate}>
|
||||
<uui-menu-item href=${this.#getCreateHref()} label="New empty partial view" @click=${this.#onNavigate}>
|
||||
<uui-icon slot="icon" name="icon-article"></uui-icon>}
|
||||
</uui-menu-item>
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbCreatePartialViewFromSnippetModalData {
|
||||
parentUnique: string | null;
|
||||
parent: {
|
||||
unique: string | null;
|
||||
entityType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const UMB_PARTIAL_VIEW_FROM_SNIPPET_MODAL = new UmbModalToken<UmbCreatePartialViewFromSnippetModalData, string>(
|
||||
|
||||
@@ -17,6 +17,12 @@ export class UmbPartialViewCreateFromSnippetModalElement extends UmbModalBaseEle
|
||||
@state()
|
||||
_snippets: Array<UmbSnippetLinkModel> = [];
|
||||
|
||||
#getCreateHref(snippet) {
|
||||
return `section/settings/workspace/partial-view/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || 'null'
|
||||
}/snippet/${snippet.id}`;
|
||||
}
|
||||
|
||||
protected async firstUpdated() {
|
||||
const { data } = await tryExecuteAndNotify(this, PartialViewResource.getPartialViewSnippet({ take: 10000 }));
|
||||
|
||||
@@ -24,9 +30,7 @@ export class UmbPartialViewCreateFromSnippetModalElement extends UmbModalBaseEle
|
||||
this._snippets = data.items.map((snippet) => {
|
||||
return {
|
||||
name: snippet.name,
|
||||
path: `section/settings/workspace/partial-view/create/${this.data?.parentUnique || 'null'}/snippet/${
|
||||
snippet.id
|
||||
}`,
|
||||
path: this.#getCreateHref(snippet),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UMB_SCRIPT_CREATE_OPTIONS_MODAL } from './options-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 UmbScriptCreateOptionsEntityAction extends UmbEntityActionBase<never> {
|
||||
@@ -21,8 +21,10 @@ export class UmbScriptCreateOptionsEntityAction extends UmbEntityActionBase<neve
|
||||
|
||||
this.#modalManagerContext?.open(UMB_SCRIPT_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.unique,
|
||||
entityType: this.entityType,
|
||||
parent: {
|
||||
entityType: this.entityType,
|
||||
unique: this.unique,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbScriptCreateOptionsModalData {
|
||||
parentUnique: string | null;
|
||||
entityType: string;
|
||||
parent: {
|
||||
unique: string | null;
|
||||
entityType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const UMB_SCRIPT_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbScriptCreateOptionsModalData>(
|
||||
|
||||
@@ -20,8 +20,7 @@ export class UmbScriptCreateOptionsModalElement extends UmbModalBaseElement<UmbS
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
if (this.data?.parentUnique === undefined) throw new Error('A parent unique is required to create a folder');
|
||||
if (!this.data?.parent) throw new Error('A parent is required to create a folder');
|
||||
|
||||
this.#createFolderAction = new UmbCreateFolderEntityAction(
|
||||
this,
|
||||
@@ -29,8 +28,8 @@ export class UmbScriptCreateOptionsModalElement extends UmbModalBaseElement<UmbS
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// TODO: allow null for entity actions. Some actions can be executed on the root item
|
||||
this.data.parentUnique,
|
||||
this.data.entityType,
|
||||
this.data.parent.unique,
|
||||
this.data.parent.entityType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,15 +49,18 @@ export class UmbScriptCreateOptionsModalElement extends UmbModalBaseElement<UmbS
|
||||
this._submitModal();
|
||||
}
|
||||
|
||||
#getCreateHref() {
|
||||
return `section/settings/workspace/script/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || 'null'
|
||||
}`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-body-layout headline="Create Script">
|
||||
<uui-box>
|
||||
<!-- TODO: construct url -->
|
||||
<uui-menu-item
|
||||
href=${`section/settings/workspace/script/create/${this.data?.parentUnique || 'null'}`}
|
||||
label="New Javascript file"
|
||||
@click=${this.#onNavigate}>
|
||||
<uui-menu-item href=${this.#getCreateHref()} label="New Javascript file" @click=${this.#onNavigate}>
|
||||
<uui-icon slot="icon" name="icon-article"></uui-icon>}
|
||||
</uui-menu-item>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UMB_STYLESHEET_CREATE_OPTIONS_MODAL } from './options-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 UmbStylesheetCreateOptionsEntityAction extends UmbEntityActionBase<never> {
|
||||
@@ -21,8 +21,10 @@ export class UmbStylesheetCreateOptionsEntityAction extends UmbEntityActionBase<
|
||||
|
||||
this.#modalManagerContext?.open(UMB_STYLESHEET_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.unique,
|
||||
entityType: this.entityType,
|
||||
parent: {
|
||||
unique: this.unique,
|
||||
entityType: this.entityType,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbStylesheetCreateOptionsModalData {
|
||||
parentUnique: string | null;
|
||||
entityType: string;
|
||||
parent: {
|
||||
unique: string | null;
|
||||
entityType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const UMB_STYLESHEET_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbStylesheetCreateOptionsModalData>(
|
||||
|
||||
@@ -13,8 +13,7 @@ export class UmbStylesheetCreateOptionsModalElement extends UmbModalBaseElement<
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
|
||||
if (this.data?.parentUnique === undefined) throw new Error('A parent unique is required to create a folder');
|
||||
if (!this.data?.parent) throw new Error('A parent is required to create a folder');
|
||||
|
||||
this.#createFolderAction = new UmbCreateFolderEntityAction(
|
||||
this,
|
||||
@@ -22,8 +21,8 @@ export class UmbStylesheetCreateOptionsModalElement extends UmbModalBaseElement<
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
// TODO: allow null for entity actions. Some actions can be executed on the root item
|
||||
this.data.parentUnique,
|
||||
this.data.entityType,
|
||||
this.data.parent.unique,
|
||||
this.data.parent.entityType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,22 +42,23 @@ export class UmbStylesheetCreateOptionsModalElement extends UmbModalBaseElement<
|
||||
this._submitModal();
|
||||
}
|
||||
|
||||
#getCreateHref() {
|
||||
return `section/settings/workspace/stylesheet/create/parent/${this.data?.parent.entityType}/${
|
||||
this.data?.parent.unique || 'null'
|
||||
}`;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-body-layout headline="Create Stylesheet">
|
||||
<uui-box>
|
||||
<!-- TODO: construct url -->
|
||||
<uui-menu-item
|
||||
href=${`section/settings/workspace/stylesheet/create/${this.data?.parentUnique || 'null'}/view/code`}
|
||||
label="New Stylesheet"
|
||||
@click=${this.#onNavigate}>
|
||||
<uui-menu-item href=${`${this.#getCreateHref()}/view/code`} label="New Stylesheet" @click=${this.#onNavigate}>
|
||||
<uui-icon slot="icon" name="icon-article"></uui-icon>}
|
||||
</uui-menu-item>
|
||||
|
||||
<uui-menu-item
|
||||
href=${`section/settings/workspace/stylesheet/create/${
|
||||
this.data?.parentUnique || 'null'
|
||||
}/view/rich-text-editor`}
|
||||
href=${`${this.#getCreateHref()}/view/rich-text-editor`}
|
||||
label="New Rich Text Editor Stylesheet"
|
||||
@click=${this.#onNavigate}>
|
||||
<uui-icon slot="icon" name="icon-article"></uui-icon>}
|
||||
|
||||
@@ -6,9 +6,7 @@ export class UmbCreateEntityAction<T extends { copy(): Promise<void> }> extends
|
||||
super(host, repositoryAlias, unique, entityType);
|
||||
}
|
||||
|
||||
// TODO: can we make this a generic create action
|
||||
async execute() {
|
||||
// TODO: get entity type from repository?
|
||||
const url = `section/settings/workspace/template/create/${this.unique || 'null'}`;
|
||||
// TODO: how do we handle this with a href?
|
||||
history.pushState(null, '', url);
|
||||
|
||||
Reference in New Issue
Block a user